Skip to content

Commit

Permalink
Merge pull request #529 from spencermountain/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
spencermountain committed Apr 14, 2023
2 parents c654377 + d76618d commit 4a3bc7e
Show file tree
Hide file tree
Showing 15 changed files with 277 additions and 354 deletions.
4 changes: 2 additions & 2 deletions builds/wtf_wikipedia-client.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions builds/wtf_wikipedia-client.mjs

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions builds/wtf_wikipedia.cjs
@@ -1,4 +1,4 @@
/*! wtf_wikipedia 10.1.3 MIT */
/*! wtf_wikipedia 10.1.4 MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch')) :
typeof define === 'function' && define.amd ? define(['isomorphic-unfetch'], factory) :
Expand Down Expand Up @@ -4658,11 +4658,8 @@
}
let perc = Number(obj.numerator) / Number(obj.denominator);
perc *= 100;
let dec = Number(obj.decimals);
if (isNaN(dec)) {
dec = 1;
}
return Number(perc.toFixed(dec))
Number(obj.decimals);
return parseInt(perc, 10)
};

const toNumber = function (str = '') {
Expand Down Expand Up @@ -4775,7 +4772,7 @@
// https://en.wikipedia.org/wiki/Template:First_word
'first word': (tmpl) => {
let obj = parser(tmpl, ['text']);
let str = obj.text;
let str = obj.text || '';
if (obj.sep) {
return str.split(obj.sep)[0]
}
Expand All @@ -4784,7 +4781,7 @@

trunc: (tmpl) => {
let obj = parser(tmpl, ['str', 'len']);
return obj.str.substr(0, obj.len)
return (obj.str || '').substr(0, obj.len)
},

'str mid': (tmpl) => {
Expand Down Expand Up @@ -5248,7 +5245,7 @@
},
// some math
'min': (tmpl) => {
let arr = parser(tmpl).list;
let arr = parser(tmpl).list || [];
let min = Number(arr[0]) || 0;
arr.forEach(str => {
let n = Number(str);
Expand Down Expand Up @@ -10425,7 +10422,7 @@
})
};

var version = '10.1.3';
var version = '10.1.4';

/**
* use the native client-side fetch function
Expand Down
17 changes: 7 additions & 10 deletions builds/wtf_wikipedia.mjs
@@ -1,4 +1,4 @@
/*! wtf_wikipedia 10.1.3 MIT */
/*! wtf_wikipedia 10.1.4 MIT */
import unfetch from 'isomorphic-unfetch';

/**
Expand Down Expand Up @@ -4650,11 +4650,8 @@ const percentage = function (obj) {
}
let perc = Number(obj.numerator) / Number(obj.denominator);
perc *= 100;
let dec = Number(obj.decimals);
if (isNaN(dec)) {
dec = 1;
}
return Number(perc.toFixed(dec))
Number(obj.decimals);
return parseInt(perc, 10)
};

const toNumber = function (str = '') {
Expand Down Expand Up @@ -4767,7 +4764,7 @@ var functions = {
// https://en.wikipedia.org/wiki/Template:First_word
'first word': (tmpl) => {
let obj = parser(tmpl, ['text']);
let str = obj.text;
let str = obj.text || '';
if (obj.sep) {
return str.split(obj.sep)[0]
}
Expand All @@ -4776,7 +4773,7 @@ var functions = {

trunc: (tmpl) => {
let obj = parser(tmpl, ['str', 'len']);
return obj.str.substr(0, obj.len)
return (obj.str || '').substr(0, obj.len)
},

'str mid': (tmpl) => {
Expand Down Expand Up @@ -5240,7 +5237,7 @@ var functions = {
},
// some math
'min': (tmpl) => {
let arr = parser(tmpl).list;
let arr = parser(tmpl).list || [];
let min = Number(arr[0]) || 0;
arr.forEach(str => {
let n = Number(str);
Expand Down Expand Up @@ -10417,7 +10414,7 @@ const fetch = function (title, options, callback) {
})
};

var version = '10.1.3';
var version = '10.1.4';

/**
* use the native client-side fetch function
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Expand Up @@ -3,6 +3,11 @@
- **[new]** - fallbackTemplateFn handler #509
-->
#### 10.1.4 [Apr 2023]
- **[fix]** - #528 template runtime errors
- **[fix]** - remove stray console.log (thank you @mxunknown)
- **[update]** - some work on gamelog template

#### 10.1.3 [Mar 2023]
- **[fix]** - #519 date parsing issue
- **[fix]** - #518 support slash in infobox property
Expand Down

0 comments on commit 4a3bc7e

Please sign in to comment.