single-file-cli 2.0.71 → 2.0.73

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.
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "2.0.71";
1
+ export const version = "2.0.73";
package/options.js CHANGED
@@ -90,6 +90,7 @@ const OPTIONS_INFO = {
90
90
  "filename-template": { description: "Template used to generate the output filename (see help page of the extension for more info)", type: "string", defaultValue: "%if-empty<{page-title}|No title> ({date-locale} {time-locale}).{filename-extension}" },
91
91
  "filename-conflict-action": { description: "Action when the filename is conflicting with existing one on the filesystem. The possible values are \"uniquify\" (default), \"overwrite\" and \"skip\"", type: "string", defaultValue: "uniquify" },
92
92
  "filename-replacement-character": { description: "The character used for replacing invalid characters in filenames", type: "string", defaultValue: "_" },
93
+ "filename-replaced-character": { description: "The replaced character and the character(s) used for replacing the replacement character in filenames separated by a space, e.g. --filename-replaced-character \">\" _GT_ to replace \">\" with _GT_", type: "string[]", defaultValue: ["~ ~", "+ +", "? ?", "% %", "* *", ": :", "| |", "\" "", "< <", "> >", "\\\\ \", "\\x00-\\x1f _", "\x7F _"] },
93
94
  "filename-max-length": { description: "Specify the maximum length of the filename", type: "number", defaultValue: 192 },
94
95
  "filename-max-length-unit": { description: "Specify the unit of the maximum length of the filename ('bytes' or 'chars')", type: "string", defaultValue: "bytes" },
95
96
  "replace-emojis-in-filename": { description: "Replace emojis in the filename with their unicode text representation", type: "boolean" },
@@ -324,6 +325,28 @@ function parseArgs(args, setDefaultValues = true) {
324
325
  result.options.blockedURLPatterns = result.options.blockedUrlPatterns;
325
326
  delete result.options.blockedUrlPatterns;
326
327
  }
328
+ if (result.options.filenameReplacedCharacters) {
329
+ const filenameReplacedCharacters = result.options.filenameReplacedCharacters;
330
+ result.options.filenameReplacedCharacters = [];
331
+ result.options.filenameReplacementCharacters = [];
332
+ filenameReplacedCharacters.forEach(replacement => {
333
+ let [replacedCharacter, replacementCharacter] = replacement.split(" ");
334
+ try {
335
+ replacedCharacter = JSON.parse(replacedCharacter);
336
+ } catch (error) {
337
+ // ignored
338
+ }
339
+ result.options.filenameReplacedCharacters.push(replacedCharacter);
340
+ if (replacementCharacter !== undefined) {
341
+ try {
342
+ replacementCharacter = JSON.parse(replacementCharacter);
343
+ } catch (error) {
344
+ // ignored
345
+ }
346
+ result.options.filenameReplacementCharacters.push(replacementCharacter);
347
+ }
348
+ });
349
+ }
327
350
  return result;
328
351
  }
329
352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-cli",
3
- "version": "2.0.71",
3
+ "version": "2.0.73",
4
4
  "description": "SingleFile CLI",
5
5
  "author": "Gildas Lormeau",
6
6
  "engines": {