single-file-core 1.0.47 → 1.0.48
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/modules/template-formatter.js +13 -13
- package/package.json +1 -1
- package/single-file-core.js +4 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright 2010-2022 Gildas Lormeau
|
|
3
3
|
* contact : gildas.lormeau <at> gmail.com
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* This file is part of SingleFile.
|
|
6
6
|
*
|
|
7
|
-
* The code in this file is free software: you can redistribute it and/or
|
|
8
|
-
* modify it under the terms of the GNU Affero General Public License
|
|
7
|
+
* The code in this file is free software: you can redistribute it and/or
|
|
8
|
+
* modify it under the terms of the GNU Affero General Public License
|
|
9
9
|
* (GNU AGPL) as published by the Free Software Foundation, either version 3
|
|
10
10
|
* of the License, or (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* The code in this file is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
11
|
+
*
|
|
12
|
+
* The code in this file is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
|
|
15
15
|
* General Public License for more details.
|
|
16
16
|
*
|
|
17
|
-
* As additional permission under GNU AGPL version 3 section 7, you may
|
|
18
|
-
* distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU
|
|
19
|
-
* AGPL normally required by section 4, provided you include this license
|
|
20
|
-
* notice and a URL through which recipients can access the Corresponding
|
|
17
|
+
* As additional permission under GNU AGPL version 3 section 7, you may
|
|
18
|
+
* distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU
|
|
19
|
+
* AGPL normally required by section 4, provided you include this license
|
|
20
|
+
* notice and a URL through which recipients can access the Corresponding
|
|
21
21
|
* Source.
|
|
22
22
|
*/
|
|
23
23
|
|
|
@@ -1908,9 +1908,9 @@ const EMOJIS = Object.keys(EMOJI_NAMES);
|
|
|
1908
1908
|
export { formatFilename, evalTemplate };
|
|
1909
1909
|
|
|
1910
1910
|
async function formatFilename(content, options, util) {
|
|
1911
|
-
let filename = (await evalTemplate(options.filenameTemplate, options, content)) || "";
|
|
1911
|
+
let filename = (await evalTemplate(options.filenameTemplate, options, util, content)) || "";
|
|
1912
1912
|
if (options.replaceEmojisInFilename) {
|
|
1913
|
-
EMOJIS.forEach(emoji => filename = filename.replaceAll(emoji, " _" + EMOJI_NAMES[emoji] + "_ "));
|
|
1913
|
+
EMOJIS.forEach(emoji => (filename = filename.replaceAll(emoji, " _" + EMOJI_NAMES[emoji] + "_ ")));
|
|
1914
1914
|
}
|
|
1915
1915
|
const replacementCharacter = options.filenameReplacementCharacter;
|
|
1916
1916
|
filename = getValidFilename(filename, options.filenameReplacedCharacters, replacementCharacter);
|
package/package.json
CHANGED
package/single-file-core.js
CHANGED
|
@@ -100,9 +100,9 @@ const STAGES = [
|
|
|
100
100
|
{ action: "replaceInvalidElements" },
|
|
101
101
|
{ action: "resetCharsetMeta" },
|
|
102
102
|
{ option: "saveFavicon", action: "saveFavicon" },
|
|
103
|
-
{ action: "replaceCanvasElements" },
|
|
104
103
|
{ action: "insertFonts" },
|
|
105
104
|
{ action: "insertShadowRootContents" },
|
|
105
|
+
{ action: "replaceCanvasElements" },
|
|
106
106
|
{ action: "setInputValues" },
|
|
107
107
|
{ option: "moveStylesInHead", action: "moveStylesInHead" },
|
|
108
108
|
{ option: "blockScripts", action: "removeEmbedScripts" },
|
|
@@ -620,6 +620,9 @@ class Processor {
|
|
|
620
620
|
function hideNode(node) {
|
|
621
621
|
if (canHideNode(node)) {
|
|
622
622
|
node.style.setProperty("display", "none", "important");
|
|
623
|
+
node.removeAttribute("src");
|
|
624
|
+
node.removeAttribute("srcset");
|
|
625
|
+
node.removeAttribute("srcdoc");
|
|
623
626
|
Array.from(node.childNodes).forEach(removeNode);
|
|
624
627
|
}
|
|
625
628
|
}
|