single-file-core 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17014,8 +17014,14 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
17014
17014
  "encode-uri": value => { try { return encodeURI(value); } catch (error) { return value; } },
17015
17015
  "decode-uri": value => { try { return decodeURI(value); } catch (error) { return value; } },
17016
17016
  "encode-uri-component": value => { try { return encodeURIComponent(value); } catch (error) { return value; } },
17017
- "decode-uri-component": value => { try { return decodeURIComponent(value); } catch (error) { return value; } }
17017
+ "decode-uri-component": value => { try { return decodeURIComponent(value); } catch (error) { return value; } },
17018
+ "date-locale": locales => new Date().toLocaleDateString(locales),
17019
+ "time-locale": locales => new Date().toLocaleTimeString(locales),
17020
+ "datetime-locale": locales => new Date().toLocaleString(locales)
17018
17021
  };
17022
+ functions["date-locale"].dontReplaceSlash = false;
17023
+ functions["time-locale"].dontReplaceSlash = false;
17024
+ functions["datetime-locale"].dontReplaceSlash = false;
17019
17025
  if (doc) {
17020
17026
  functions["page-element-text"] = (selector) => {
17021
17027
  const element = doc.querySelector(selector);
@@ -17043,7 +17049,8 @@ async function evalTemplate(template = "", options, content, doc, dontReplaceSla
17043
17049
  .filter(argument => argument != undefined && argument != null && argument != "");
17044
17050
  if ((argument != undefined && argument != null && argument != "") || optionalArguments.length > 0) {
17045
17051
  try {
17046
- return await getValue(() => fn(argument, ...optionalArguments), true, options.filenameReplacementCharacter, lengthData);
17052
+ const dontReplaceSlash = fn.dontReplaceSlash === undefined ? true : fn.dontReplaceSlash;
17053
+ return await getValue(() => fn(argument, ...optionalArguments), dontReplaceSlash, options.filenameReplacementCharacter, lengthData);
17047
17054
  } catch (error) {
17048
17055
  return "";
17049
17056
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",