single-file-core 1.5.112 → 1.5.113
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/core/lib/doctype.js +50 -0
- package/core/util.js +1 -18
- package/package.json +1 -1
- package/processors/compression/compression-display.js +2 -17
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2010-2026 Gildas Lormeau
|
|
3
|
+
* contact : gildas.lormeau <at> gmail.com
|
|
4
|
+
*
|
|
5
|
+
* This file is part of SingleFile.
|
|
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
|
|
9
|
+
* (GNU AGPL) as published by the Free Software Foundation, either version 3
|
|
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
|
|
15
|
+
* General Public License for more details.
|
|
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
|
|
21
|
+
* Source.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// this module is imported by the script embedded in self-extracting archives, it
|
|
25
|
+
// must stay free of dependencies
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
getDoctypeString
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function getDoctypeString(doc) {
|
|
32
|
+
const docType = doc.doctype;
|
|
33
|
+
let docTypeString = "";
|
|
34
|
+
if (docType) {
|
|
35
|
+
docTypeString = "<!DOCTYPE " + docType.nodeName;
|
|
36
|
+
if (docType.publicId) {
|
|
37
|
+
docTypeString += " PUBLIC \"" + docType.publicId + "\"";
|
|
38
|
+
if (docType.systemId) {
|
|
39
|
+
docTypeString += " \"" + docType.systemId + "\"";
|
|
40
|
+
}
|
|
41
|
+
} else if (docType.systemId) {
|
|
42
|
+
docTypeString += " SYSTEM \"" + docType.systemId + "\"";
|
|
43
|
+
}
|
|
44
|
+
if (docType.internalSubset) {
|
|
45
|
+
docTypeString += " [" + docType.internalSubset + "]";
|
|
46
|
+
}
|
|
47
|
+
docTypeString += ">";
|
|
48
|
+
}
|
|
49
|
+
return docTypeString;
|
|
50
|
+
}
|
package/core/util.js
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import * as vendor from "./../vendor/index.js";
|
|
25
25
|
import * as modules from "./../modules/index.js";
|
|
26
26
|
import * as helper from "./helper.js";
|
|
27
|
+
import { getDoctypeString } from "./lib/doctype.js";
|
|
27
28
|
|
|
28
29
|
const DEBUG = false;
|
|
29
30
|
const ONE_MB = 1024 * 1024;
|
|
@@ -489,24 +490,6 @@ function guessMIMEType(expectedType, buffer) {
|
|
|
489
490
|
}
|
|
490
491
|
}
|
|
491
492
|
|
|
492
|
-
function getDoctypeString(doc) {
|
|
493
|
-
const docType = doc.doctype;
|
|
494
|
-
let docTypeString = "";
|
|
495
|
-
if (docType) {
|
|
496
|
-
docTypeString = "<!DOCTYPE " + docType.nodeName;
|
|
497
|
-
if (docType.publicId) {
|
|
498
|
-
docTypeString += " PUBLIC \"" + docType.publicId + "\"";
|
|
499
|
-
if (docType.systemId)
|
|
500
|
-
docTypeString += " \"" + docType.systemId + "\"";
|
|
501
|
-
} else if (docType.systemId)
|
|
502
|
-
docTypeString += " SYSTEM \"" + docType.systemId + "\"";
|
|
503
|
-
if (docType.internalSubset)
|
|
504
|
-
docTypeString += " [" + docType.internalSubset + "]";
|
|
505
|
-
docTypeString += "> ";
|
|
506
|
-
}
|
|
507
|
-
return docTypeString;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
493
|
function log(...args) {
|
|
511
494
|
console.log("S-File <browser>", ...args); // eslint-disable-line no-console
|
|
512
495
|
}
|
package/package.json
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
/* global DOMParser, setTimeout */
|
|
25
25
|
|
|
26
|
+
import { getDoctypeString } from "./../../core/lib/doctype.js";
|
|
27
|
+
|
|
26
28
|
export {
|
|
27
29
|
display
|
|
28
30
|
};
|
|
@@ -89,21 +91,4 @@ async function display(document, docContent, { disableFramePointerEvents, inPlac
|
|
|
89
91
|
});
|
|
90
92
|
document.documentElement.setAttribute("data-sfz", "");
|
|
91
93
|
document.querySelectorAll("link[rel*=icon]").forEach(element => element.replaceWith(element.cloneNode(true)));
|
|
92
|
-
function getDoctypeString(doc) {
|
|
93
|
-
const docType = doc.doctype;
|
|
94
|
-
let docTypeString = "";
|
|
95
|
-
if (docType) {
|
|
96
|
-
docTypeString = "<!DOCTYPE " + docType.nodeName;
|
|
97
|
-
if (docType.publicId) {
|
|
98
|
-
docTypeString += " PUBLIC \"" + docType.publicId + "\"";
|
|
99
|
-
if (docType.systemId)
|
|
100
|
-
docTypeString += " \"" + docType.systemId + "\"";
|
|
101
|
-
} else if (docType.systemId)
|
|
102
|
-
docTypeString += " SYSTEM \"" + docType.systemId + "\"";
|
|
103
|
-
if (docType.internalSubset)
|
|
104
|
-
docTypeString += " [" + docType.internalSubset + "]";
|
|
105
|
-
docTypeString += "> ";
|
|
106
|
-
}
|
|
107
|
-
return docTypeString;
|
|
108
|
-
}
|
|
109
94
|
}
|