open-agreements 0.7.5 → 0.7.6
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/README.de.md +300 -255
- package/README.es.md +301 -254
- package/README.md +389 -95
- package/README.pt-br.md +301 -254
- package/README.template.md +333 -0
- package/README.zh.md +300 -253
- package/SECURITY.md +34 -0
- package/content/recipes/nvca-stock-purchase-agreement/README.md +39 -0
- package/content/recipes/nvca-voting-agreement/README.md +43 -0
- package/content/templates/bonterms-mutual-nda/README.md +2 -2
- package/content/templates/bonterms-mutual-nda/metadata.yaml +5 -11
- package/content/templates/bonterms-professional-services-agreement/README.md +2 -2
- package/content/templates/bonterms-professional-services-agreement/metadata.yaml +2 -2
- package/content/templates/closing-checklist/template.docx +0 -0
- package/content/templates/closing-checklist/template.md +30 -0
- package/content/templates/common-paper-ai-addendum/template.docx +0 -0
- package/content/templates/common-paper-ai-addendum-in-app/template.docx +0 -0
- package/content/templates/common-paper-csa-with-ai/template.docx +0 -0
- package/content/templates/common-paper-independent-contractor-agreement/template.docx +0 -0
- package/content/templates/common-paper-mutual-nda/README.md +28 -0
- package/content/templates/common-paper-one-way-nda/metadata.yaml +1 -1
- package/content/templates/common-paper-term-sheet/template.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/.template.generated.json +74 -0
- package/content/templates/openagreements-board-consent-safe/README.md +61 -0
- package/content/templates/openagreements-board-consent-safe/metadata.yaml +53 -0
- package/content/templates/openagreements-board-consent-safe/reference-source.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/template.docx +0 -0
- package/content/templates/openagreements-board-consent-safe/template.md +66 -0
- package/content/templates/openagreements-due-diligence-request-list/README.md +68 -0
- package/content/templates/openagreements-due-diligence-request-list/metadata.yaml +300 -0
- package/content/templates/openagreements-due-diligence-request-list/template.docx +0 -0
- package/content/templates/openagreements-due-diligence-request-list/template.md +318 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/.template.generated.json +230 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/metadata.yaml +1 -1
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.docx +0 -0
- package/content/templates/openagreements-employee-ip-inventions-assignment/template.md +96 -35
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/README.md +1 -1
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/metadata.yaml +2 -2
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.docx +0 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.json +75 -0
- package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.md +8 -4
- package/content/templates/openagreements-employment-offer-letter/.template.generated.json +224 -0
- package/content/templates/openagreements-employment-offer-letter/README.md +65 -1
- package/content/templates/openagreements-employment-offer-letter/metadata.yaml +1 -1
- package/content/templates/openagreements-employment-offer-letter/template.docx +0 -0
- package/content/templates/openagreements-employment-offer-letter/template.md +70 -30
- package/content/templates/openagreements-restrictive-covenant-florida/.template.generated.json +456 -0
- package/content/templates/openagreements-restrictive-covenant-florida/README.md +141 -0
- package/content/templates/openagreements-restrictive-covenant-florida/metadata.yaml +419 -0
- package/content/templates/openagreements-restrictive-covenant-florida/template.docx +0 -0
- package/content/templates/openagreements-restrictive-covenant-florida/template.md +233 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/.template.generated.json +399 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/metadata.yaml +69 -12
- package/content/templates/openagreements-restrictive-covenant-wyoming/template.docx +0 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/template.md +110 -59
- package/content/templates/openagreements-stockholder-consent-safe/.template.generated.json +74 -0
- package/content/templates/openagreements-stockholder-consent-safe/README.md +62 -0
- package/content/templates/openagreements-stockholder-consent-safe/metadata.yaml +53 -0
- package/content/templates/openagreements-stockholder-consent-safe/reference-source.docx +0 -0
- package/content/templates/openagreements-stockholder-consent-safe/template.docx +0 -0
- package/content/templates/openagreements-stockholder-consent-safe/template.md +62 -0
- package/content/templates/working-group-list/template.docx +0 -0
- package/content/templates/working-group-list/template.md +18 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/fill.d.ts +1 -1
- package/dist/commands/fill.d.ts.map +1 -1
- package/dist/commands/fill.js +4 -1
- package/dist/commands/fill.js.map +1 -1
- package/dist/commands/list.js +10 -0
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/recipe.js.map +1 -1
- package/dist/core/employment/jurisdiction-rules.js +2 -2
- package/dist/core/employment/jurisdiction-rules.js.map +1 -1
- package/dist/core/employment/memo.d.ts +1 -1
- package/dist/core/employment/memo.d.ts.map +1 -1
- package/dist/core/employment/memo.js +14 -6
- package/dist/core/employment/memo.js.map +1 -1
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/engine.js +28 -0
- package/dist/core/engine.js.map +1 -1
- package/dist/core/fill-pipeline.d.ts +30 -5
- package/dist/core/fill-pipeline.d.ts.map +1 -1
- package/dist/core/fill-pipeline.js +173 -9
- package/dist/core/fill-pipeline.js.map +1 -1
- package/dist/core/humanize-docx.d.ts +21 -0
- package/dist/core/humanize-docx.d.ts.map +1 -0
- package/dist/core/humanize-docx.js +492 -0
- package/dist/core/humanize-docx.js.map +1 -0
- package/dist/core/metadata.d.ts +118 -65
- package/dist/core/metadata.d.ts.map +1 -1
- package/dist/core/metadata.js +268 -13
- package/dist/core/metadata.js.map +1 -1
- package/dist/core/recipe/bracket-normalizer.d.ts +1 -1
- package/dist/core/recipe/bracket-normalizer.d.ts.map +1 -1
- package/dist/core/recipe/bracket-normalizer.js +3 -0
- package/dist/core/recipe/bracket-normalizer.js.map +1 -1
- package/dist/core/recipe/computed.d.ts +1 -1
- package/dist/core/recipe/computed.d.ts.map +1 -1
- package/dist/core/recipe/index.d.ts.map +1 -1
- package/dist/core/recipe/index.js +22 -4
- package/dist/core/recipe/index.js.map +1 -1
- package/dist/core/recipe/types.d.ts +1 -1
- package/dist/core/recipe/types.d.ts.map +1 -1
- package/dist/core/template-listing.d.ts +6 -8
- package/dist/core/template-listing.d.ts.map +1 -1
- package/dist/core/template-listing.js +24 -0
- package/dist/core/template-listing.js.map +1 -1
- package/dist/core/unified-pipeline.d.ts +2 -0
- package/dist/core/unified-pipeline.d.ts.map +1 -1
- package/dist/core/unified-pipeline.js +19 -1
- package/dist/core/unified-pipeline.js.map +1 -1
- package/dist/core/validation/template.d.ts +32 -0
- package/dist/core/validation/template.d.ts.map +1 -1
- package/dist/core/validation/template.js +163 -3
- package/dist/core/validation/template.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +26 -12
- package/skills/canonical-markdown-authoring/CONNECTORS.md +67 -0
- package/skills/canonical-markdown-authoring/SKILL.md +565 -0
- package/skills/client-email/SKILL.md +2 -0
- package/skills/cloud-service-agreement/CONNECTORS.md +2 -2
- package/skills/cloud-service-agreement/SKILL.md +38 -1
- package/skills/cloud-service-agreement/template-filling-execution.md +2 -2
- package/skills/data-privacy-agreement/CONNECTORS.md +2 -2
- package/skills/data-privacy-agreement/SKILL.md +2 -0
- package/skills/delaware-franchise-tax/SKILL.md +2 -0
- package/skills/edit-docx-agreement/SKILL.md +2 -0
- package/skills/employment-contract/CONNECTORS.md +2 -2
- package/skills/employment-contract/SKILL.md +2 -0
- package/skills/iso-27001-evidence-collection/SKILL.md +2 -0
- package/skills/iso-27001-internal-audit/SKILL.md +2 -0
- package/skills/nda/CONNECTORS.md +2 -2
- package/skills/nda/SKILL.md +45 -1
- package/skills/nda/template-filling-execution.md +12 -6
- package/skills/non-compete-contract-explainer/SKILL.md +107 -0
- package/skills/non-compete-contract-explainer/content/wyoming.md +286 -0
- package/skills/non-compete-contract-explainer/manifest.json +18 -0
- package/skills/open-agreements/CONNECTORS.md +2 -2
- package/skills/open-agreements/SKILL.md +165 -67
- package/skills/open-agreements/template-filling-execution.md +2 -2
- package/skills/recipe-quality-audit/SKILL.md +2 -0
- package/skills/safe/CONNECTORS.md +2 -2
- package/skills/safe/SKILL.md +38 -1
- package/skills/safe/template-filling-execution.md +2 -2
- package/skills/services-agreement/CONNECTORS.md +2 -2
- package/skills/services-agreement/SKILL.md +40 -1
- package/skills/services-agreement/template-filling-execution.md +81 -0
- package/skills/shared/template-filling-execution.md +2 -2
- package/skills/soc2-readiness/SKILL.md +2 -0
- package/skills/unit-test-philosophy/SKILL.md +3 -0
- package/skills/venture-financing/CONNECTORS.md +2 -2
- package/skills/venture-financing/SKILL.md +2 -0
- package/content/templates/openagreements-restrictive-covenant-wyoming/practice-note.md +0 -103
- package/node_modules/@xmldom/xmldom/CHANGELOG.md +0 -939
- package/node_modules/@xmldom/xmldom/LICENSE +0 -8
- package/node_modules/@xmldom/xmldom/SECURITY.md +0 -50
- package/node_modules/@xmldom/xmldom/index.d.ts +0 -1664
- package/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +0 -3
- package/node_modules/@xmldom/xmldom/lib/conventions.js +0 -429
- package/node_modules/@xmldom/xmldom/lib/dom-parser.js +0 -586
- package/node_modules/@xmldom/xmldom/lib/dom.js +0 -3192
- package/node_modules/@xmldom/xmldom/lib/entities.js +0 -2171
- package/node_modules/@xmldom/xmldom/lib/errors.js +0 -202
- package/node_modules/@xmldom/xmldom/lib/grammar.js +0 -533
- package/node_modules/@xmldom/xmldom/lib/index.js +0 -41
- package/node_modules/@xmldom/xmldom/lib/sax.js +0 -929
- package/node_modules/@xmldom/xmldom/package.json +0 -74
- package/node_modules/@xmldom/xmldom/readme.md +0 -364
- package/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/core-util-is/README.md +0 -3
- package/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/core-util-is/package.json +0 -38
- package/node_modules/immediate/LICENSE.txt +0 -20
- package/node_modules/immediate/README.md +0 -93
- package/node_modules/immediate/dist/immediate.js +0 -75
- package/node_modules/immediate/dist/immediate.min.js +0 -1
- package/node_modules/immediate/lib/browser.js +0 -69
- package/node_modules/immediate/lib/index.js +0 -73
- package/node_modules/immediate/package.json +0 -42
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -45
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/jszip/.codeclimate.yml +0 -16
- package/node_modules/jszip/.editorconfig +0 -8
- package/node_modules/jszip/.eslintrc.js +0 -43
- package/node_modules/jszip/.github/workflows/pr.yaml +0 -58
- package/node_modules/jszip/.jekyll-metadata +0 -0
- package/node_modules/jszip/.travis.yml +0 -17
- package/node_modules/jszip/CHANGES.md +0 -204
- package/node_modules/jszip/LICENSE.markdown +0 -651
- package/node_modules/jszip/README.markdown +0 -33
- package/node_modules/jszip/deps.js +0 -37
- package/node_modules/jszip/dist/jszip.js +0 -11577
- package/node_modules/jszip/dist/jszip.min.js +0 -13
- package/node_modules/jszip/graph.svg +0 -601
- package/node_modules/jszip/index.d.ts +0 -330
- package/node_modules/jszip/lib/base64.js +0 -106
- package/node_modules/jszip/lib/compressedObject.js +0 -74
- package/node_modules/jszip/lib/compressions.js +0 -14
- package/node_modules/jszip/lib/crc32.js +0 -77
- package/node_modules/jszip/lib/defaults.js +0 -11
- package/node_modules/jszip/lib/external.js +0 -18
- package/node_modules/jszip/lib/flate.js +0 -85
- package/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -539
- package/node_modules/jszip/lib/generate/index.js +0 -57
- package/node_modules/jszip/lib/index.js +0 -55
- package/node_modules/jszip/lib/license_header.js +0 -11
- package/node_modules/jszip/lib/load.js +0 -88
- package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- package/node_modules/jszip/lib/nodejsUtils.js +0 -57
- package/node_modules/jszip/lib/object.js +0 -384
- package/node_modules/jszip/lib/readable-stream-browser.js +0 -10
- package/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- package/node_modules/jszip/lib/reader/DataReader.js +0 -116
- package/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- package/node_modules/jszip/lib/reader/StringReader.js +0 -38
- package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- package/node_modules/jszip/lib/reader/readerFor.js +0 -28
- package/node_modules/jszip/lib/signature.js +0 -7
- package/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- package/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- package/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- package/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- package/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- package/node_modules/jszip/lib/stream/StreamHelper.js +0 -214
- package/node_modules/jszip/lib/support.js +0 -38
- package/node_modules/jszip/lib/utf8.js +0 -275
- package/node_modules/jszip/lib/utils.js +0 -501
- package/node_modules/jszip/lib/zipEntries.js +0 -261
- package/node_modules/jszip/lib/zipEntry.js +0 -293
- package/node_modules/jszip/lib/zipObject.js +0 -133
- package/node_modules/jszip/package.json +0 -67
- package/node_modules/jszip/sponsors.md +0 -21
- package/node_modules/jszip/tsconfig.json +0 -101
- package/node_modules/jszip/vendor/FileSaver.js +0 -247
- package/node_modules/lie/README.md +0 -62
- package/node_modules/lie/dist/lie.js +0 -350
- package/node_modules/lie/dist/lie.min.js +0 -1
- package/node_modules/lie/dist/lie.polyfill.js +0 -358
- package/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- package/node_modules/lie/lib/browser.js +0 -273
- package/node_modules/lie/lib/index.js +0 -298
- package/node_modules/lie/license.md +0 -7
- package/node_modules/lie/lie.d.ts +0 -244
- package/node_modules/lie/package.json +0 -69
- package/node_modules/lie/polyfill.js +0 -4
- package/node_modules/pako/LICENSE +0 -21
- package/node_modules/pako/README.md +0 -191
- package/node_modules/pako/dist/pako.js +0 -6818
- package/node_modules/pako/dist/pako.min.js +0 -1
- package/node_modules/pako/dist/pako_deflate.js +0 -3997
- package/node_modules/pako/dist/pako_deflate.min.js +0 -1
- package/node_modules/pako/dist/pako_inflate.js +0 -3300
- package/node_modules/pako/dist/pako_inflate.min.js +0 -1
- package/node_modules/pako/index.js +0 -14
- package/node_modules/pako/lib/deflate.js +0 -400
- package/node_modules/pako/lib/inflate.js +0 -423
- package/node_modules/pako/lib/utils/common.js +0 -105
- package/node_modules/pako/lib/utils/strings.js +0 -187
- package/node_modules/pako/lib/zlib/README +0 -59
- package/node_modules/pako/lib/zlib/adler32.js +0 -51
- package/node_modules/pako/lib/zlib/constants.js +0 -68
- package/node_modules/pako/lib/zlib/crc32.js +0 -59
- package/node_modules/pako/lib/zlib/deflate.js +0 -1874
- package/node_modules/pako/lib/zlib/gzheader.js +0 -58
- package/node_modules/pako/lib/zlib/inffast.js +0 -345
- package/node_modules/pako/lib/zlib/inflate.js +0 -1556
- package/node_modules/pako/lib/zlib/inftrees.js +0 -343
- package/node_modules/pako/lib/zlib/messages.js +0 -32
- package/node_modules/pako/lib/zlib/trees.js +0 -1222
- package/node_modules/pako/lib/zlib/zstream.js +0 -47
- package/node_modules/pako/package.json +0 -44
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -25
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -685
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -52
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/readable-browser.js +0 -7
- package/node_modules/readable-stream/readable.js +0 -19
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -62
- package/node_modules/safe-buffer/package.json +0 -37
- package/node_modules/setimmediate/LICENSE.txt +0 -20
- package/node_modules/setimmediate/package.json +0 -30
- package/node_modules/setimmediate/setImmediate.js +0 -186
- package/node_modules/string_decoder/.travis.yml +0 -50
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -31
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Detects relevant unicode support for regular expressions in the runtime.
|
|
5
|
-
* Should the runtime not accepts the flag `u` or unicode ranges,
|
|
6
|
-
* character classes without unicode handling will be used.
|
|
7
|
-
*
|
|
8
|
-
* @param {typeof RegExp} [RegExpImpl=RegExp]
|
|
9
|
-
* For testing: the RegExp class.
|
|
10
|
-
* @returns {boolean}
|
|
11
|
-
* @see https://node.green/#ES2015-syntax-RegExp--y--and--u--flags
|
|
12
|
-
*/
|
|
13
|
-
function detectUnicodeSupport(RegExpImpl) {
|
|
14
|
-
try {
|
|
15
|
-
if (typeof RegExpImpl !== 'function') {
|
|
16
|
-
RegExpImpl = RegExp;
|
|
17
|
-
}
|
|
18
|
-
// eslint-disable-next-line es5/no-unicode-regex,es5/no-unicode-code-point-escape
|
|
19
|
-
var match = new RegExpImpl('\u{1d306}', 'u').exec('𝌆');
|
|
20
|
-
return !!match && match[0].length === 2;
|
|
21
|
-
} catch (error) {}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
var UNICODE_SUPPORT = detectUnicodeSupport();
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Removes `[`, `]` and any trailing quantifiers from the source of a RegExp.
|
|
28
|
-
*
|
|
29
|
-
* @param {RegExp} regexp
|
|
30
|
-
*/
|
|
31
|
-
function chars(regexp) {
|
|
32
|
-
if (regexp.source[0] !== '[') {
|
|
33
|
-
throw new Error(regexp + ' can not be used with chars');
|
|
34
|
-
}
|
|
35
|
-
return regexp.source.slice(1, regexp.source.lastIndexOf(']'));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Creates a new character list regular expression,
|
|
40
|
-
* by removing `search` from the source of `regexp`.
|
|
41
|
-
*
|
|
42
|
-
* @param {RegExp} regexp
|
|
43
|
-
* @param {string} search
|
|
44
|
-
* The character(s) to remove.
|
|
45
|
-
* @returns {RegExp}
|
|
46
|
-
*/
|
|
47
|
-
function chars_without(regexp, search) {
|
|
48
|
-
if (regexp.source[0] !== '[') {
|
|
49
|
-
throw new Error('/' + regexp.source + '/ can not be used with chars_without');
|
|
50
|
-
}
|
|
51
|
-
if (!search || typeof search !== 'string') {
|
|
52
|
-
throw new Error(JSON.stringify(search) + ' is not a valid search');
|
|
53
|
-
}
|
|
54
|
-
if (regexp.source.indexOf(search) === -1) {
|
|
55
|
-
throw new Error('"' + search + '" is not is /' + regexp.source + '/');
|
|
56
|
-
}
|
|
57
|
-
if (search === '-' && regexp.source.indexOf(search) !== 1) {
|
|
58
|
-
throw new Error('"' + search + '" is not at the first postion of /' + regexp.source + '/');
|
|
59
|
-
}
|
|
60
|
-
return new RegExp(regexp.source.replace(search, ''), UNICODE_SUPPORT ? 'u' : '');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Combines and Regular expressions correctly by using `RegExp.source`.
|
|
65
|
-
*
|
|
66
|
-
* @param {...(RegExp | string)[]} args
|
|
67
|
-
* @returns {RegExp}
|
|
68
|
-
*/
|
|
69
|
-
function reg(args) {
|
|
70
|
-
var self = this;
|
|
71
|
-
return new RegExp(
|
|
72
|
-
Array.prototype.slice
|
|
73
|
-
.call(arguments)
|
|
74
|
-
.map(function (part) {
|
|
75
|
-
var isStr = typeof part === 'string';
|
|
76
|
-
if (isStr && self === undefined && part === '|') {
|
|
77
|
-
throw new Error('use regg instead of reg to wrap expressions with `|`!');
|
|
78
|
-
}
|
|
79
|
-
return isStr ? part : part.source;
|
|
80
|
-
})
|
|
81
|
-
.join(''),
|
|
82
|
-
UNICODE_SUPPORT ? 'mu' : 'm'
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Like `reg` but wraps the expression in `(?:`,`)` to create a non tracking group.
|
|
88
|
-
*
|
|
89
|
-
* @param {...(RegExp | string)[]} args
|
|
90
|
-
* @returns {RegExp}
|
|
91
|
-
*/
|
|
92
|
-
function regg(args) {
|
|
93
|
-
if (arguments.length === 0) {
|
|
94
|
-
throw new Error('no parameters provided');
|
|
95
|
-
}
|
|
96
|
-
return reg.apply(regg, ['(?:'].concat(Array.prototype.slice.call(arguments), [')']));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// /**
|
|
100
|
-
// * Append ^ to the beginning of the expression.
|
|
101
|
-
// * @param {...(RegExp | string)[]} args
|
|
102
|
-
// * @returns {RegExp}
|
|
103
|
-
// */
|
|
104
|
-
// function reg_start(args) {
|
|
105
|
-
// if (arguments.length === 0) {
|
|
106
|
-
// throw new Error('no parameters provided');
|
|
107
|
-
// }
|
|
108
|
-
// return reg.apply(reg_start, ['^'].concat(Array.prototype.slice.call(arguments)));
|
|
109
|
-
// }
|
|
110
|
-
|
|
111
|
-
// https://www.w3.org/TR/xml/#document
|
|
112
|
-
// `[1] document ::= prolog element Misc*`
|
|
113
|
-
// https://www.w3.org/TR/xml11/#NT-document
|
|
114
|
-
// `[1] document ::= ( prolog element Misc* ) - ( Char* RestrictedChar Char* )`
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* A character usually appearing in wrongly converted strings.
|
|
118
|
-
*
|
|
119
|
-
* @type {string}
|
|
120
|
-
* @see https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character
|
|
121
|
-
* @see https://nodejs.dev/en/api/v18/buffer/#buffers-and-character-encodings
|
|
122
|
-
* @see https://www.unicode.org/faq/utf_bom.html#BOM
|
|
123
|
-
* @readonly
|
|
124
|
-
*/
|
|
125
|
-
var UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
126
|
-
// https://www.w3.org/TR/xml/#NT-Char
|
|
127
|
-
// any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
|
|
128
|
-
// `[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]`
|
|
129
|
-
// https://www.w3.org/TR/xml11/#NT-Char
|
|
130
|
-
// `[2] Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]`
|
|
131
|
-
// https://www.w3.org/TR/xml11/#NT-RestrictedChar
|
|
132
|
-
// `[2a] RestrictedChar ::= [#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]`
|
|
133
|
-
// https://www.w3.org/TR/xml11/#charsets
|
|
134
|
-
var Char = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/; // without \u10000-\uEFFFF
|
|
135
|
-
if (UNICODE_SUPPORT) {
|
|
136
|
-
// eslint-disable-next-line es5/no-unicode-code-point-escape
|
|
137
|
-
Char = reg('[', chars(Char), '\\u{10000}-\\u{10FFFF}', ']');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
var _SChar = /[\x20\x09\x0D\x0A]/;
|
|
141
|
-
var SChar_s = chars(_SChar);
|
|
142
|
-
// https://www.w3.org/TR/xml11/#NT-S
|
|
143
|
-
// `[3] S ::= (#x20 | #x9 | #xD | #xA)+`
|
|
144
|
-
var S = reg(_SChar, '+');
|
|
145
|
-
// optional whitespace described as `S?` in the grammar,
|
|
146
|
-
// simplified to 0-n occurrences of the character class
|
|
147
|
-
// instead of 0-1 occurrences of a non-capturing group around S
|
|
148
|
-
var S_OPT = reg(_SChar, '*');
|
|
149
|
-
|
|
150
|
-
// https://www.w3.org/TR/xml11/#NT-NameStartChar
|
|
151
|
-
// `[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]`
|
|
152
|
-
var NameStartChar =
|
|
153
|
-
/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; // without \u10000-\uEFFFF
|
|
154
|
-
if (UNICODE_SUPPORT) {
|
|
155
|
-
// eslint-disable-next-line es5/no-unicode-code-point-escape
|
|
156
|
-
NameStartChar = reg('[', chars(NameStartChar), '\\u{10000}-\\u{10FFFF}', ']');
|
|
157
|
-
}
|
|
158
|
-
var NameStartChar_s = chars(NameStartChar);
|
|
159
|
-
|
|
160
|
-
// https://www.w3.org/TR/xml11/#NT-NameChar
|
|
161
|
-
// `[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]`
|
|
162
|
-
var NameChar = reg('[', NameStartChar_s, chars(/[-.0-9\xB7]/), chars(/[\u0300-\u036F\u203F-\u2040]/), ']');
|
|
163
|
-
// https://www.w3.org/TR/xml11/#NT-Name
|
|
164
|
-
// `[5] Name ::= NameStartChar (NameChar)*`
|
|
165
|
-
var Name = reg(NameStartChar, NameChar, '*');
|
|
166
|
-
/*
|
|
167
|
-
https://www.w3.org/TR/xml11/#NT-Names
|
|
168
|
-
`[6] Names ::= Name (#x20 Name)*`
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
// https://www.w3.org/TR/xml11/#NT-Nmtoken
|
|
172
|
-
// `[7] Nmtoken ::= (NameChar)+`
|
|
173
|
-
var Nmtoken = reg(NameChar, '+');
|
|
174
|
-
/*
|
|
175
|
-
https://www.w3.org/TR/xml11/#NT-Nmtokens
|
|
176
|
-
`[8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*`
|
|
177
|
-
var Nmtokens = reg(Nmtoken, regg(/\x20/, Nmtoken), '*');
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
// https://www.w3.org/TR/xml11/#NT-EntityRef
|
|
181
|
-
// `[68] EntityRef ::= '&' Name ';'` [WFC: Entity Declared] [VC: Entity Declared] [WFC: Parsed Entity] [WFC: No Recursion]
|
|
182
|
-
var EntityRef = reg('&', Name, ';');
|
|
183
|
-
// https://www.w3.org/TR/xml11/#NT-CharRef
|
|
184
|
-
// `[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'` [WFC: Legal Character]
|
|
185
|
-
var CharRef = regg(/&#[0-9]+;|&#x[0-9a-fA-F]+;/);
|
|
186
|
-
|
|
187
|
-
/*
|
|
188
|
-
https://www.w3.org/TR/xml11/#NT-Reference
|
|
189
|
-
- `[67] Reference ::= EntityRef | CharRef`
|
|
190
|
-
- `[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'` [WFC: Legal Character]
|
|
191
|
-
- `[68] EntityRef ::= '&' Name ';'` [WFC: Entity Declared] [VC: Entity Declared] [WFC: Parsed Entity] [WFC: No Recursion]
|
|
192
|
-
*/
|
|
193
|
-
var Reference = regg(EntityRef, '|', CharRef);
|
|
194
|
-
|
|
195
|
-
// https://www.w3.org/TR/xml11/#NT-PEReference
|
|
196
|
-
// `[69] PEReference ::= '%' Name ';'`
|
|
197
|
-
// [VC: Entity Declared] [WFC: No Recursion] [WFC: In DTD]
|
|
198
|
-
var PEReference = reg('%', Name, ';');
|
|
199
|
-
|
|
200
|
-
// https://www.w3.org/TR/xml11/#NT-EntityValue
|
|
201
|
-
// `[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"`
|
|
202
|
-
var EntityValue = regg(
|
|
203
|
-
reg('"', regg(/[^%&"]/, '|', PEReference, '|', Reference), '*', '"'),
|
|
204
|
-
'|',
|
|
205
|
-
reg("'", regg(/[^%&']/, '|', PEReference, '|', Reference), '*', "'")
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
// https://www.w3.org/TR/xml11/#NT-AttValue
|
|
209
|
-
// `[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"`
|
|
210
|
-
var AttValue = regg('"', regg(/[^<&"]/, '|', Reference), '*', '"', '|', "'", regg(/[^<&']/, '|', Reference), '*', "'");
|
|
211
|
-
|
|
212
|
-
// https://www.w3.org/TR/xml-names/#ns-decl
|
|
213
|
-
// https://www.w3.org/TR/xml-names/#ns-qualnames
|
|
214
|
-
// NameStartChar without ":"
|
|
215
|
-
var NCNameStartChar = chars_without(NameStartChar, ':');
|
|
216
|
-
// https://www.w3.org/TR/xml-names/#orphans
|
|
217
|
-
// `[5] NCNameChar ::= NameChar - ':'`
|
|
218
|
-
// An XML NameChar, minus the ":"
|
|
219
|
-
var NCNameChar = chars_without(NameChar, ':');
|
|
220
|
-
// https://www.w3.org/TR/xml-names/#NT-NCName
|
|
221
|
-
// `[4] NCName ::= Name - (Char* ':' Char*)`
|
|
222
|
-
// An XML Name, minus the ":"
|
|
223
|
-
var NCName = reg(NCNameStartChar, NCNameChar, '*');
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
https://www.w3.org/TR/xml-names/#ns-qualnames
|
|
227
|
-
|
|
228
|
-
```
|
|
229
|
-
[7] QName ::= PrefixedName | UnprefixedName
|
|
230
|
-
=== (NCName ':' NCName) | NCName
|
|
231
|
-
=== NCName (':' NCName)?
|
|
232
|
-
[8] PrefixedName ::= Prefix ':' LocalPart
|
|
233
|
-
=== NCName ':' NCName
|
|
234
|
-
[9] UnprefixedName ::= LocalPart
|
|
235
|
-
=== NCName
|
|
236
|
-
[10] Prefix ::= NCName
|
|
237
|
-
[11] LocalPart ::= NCName
|
|
238
|
-
```
|
|
239
|
-
*/
|
|
240
|
-
var QName = reg(NCName, regg(':', NCName), '?');
|
|
241
|
-
var QName_exact = reg('^', QName, '$');
|
|
242
|
-
var QName_group = reg('(', QName, ')');
|
|
243
|
-
|
|
244
|
-
// https://www.w3.org/TR/xml11/#NT-SystemLiteral
|
|
245
|
-
// `[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")`
|
|
246
|
-
var SystemLiteral = regg(/"[^"]*"|'[^']*'/);
|
|
247
|
-
|
|
248
|
-
/*
|
|
249
|
-
https://www.w3.org/TR/xml11/#NT-PI
|
|
250
|
-
```
|
|
251
|
-
[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
|
|
252
|
-
[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
|
|
253
|
-
```
|
|
254
|
-
target /xml/i is not excluded!
|
|
255
|
-
*/
|
|
256
|
-
var PI = reg(/^<\?/, '(', Name, ')', regg(S, '(', Char, '*?)'), '?', /\?>/);
|
|
257
|
-
|
|
258
|
-
// https://www.w3.org/TR/xml11/#NT-PubidChar
|
|
259
|
-
// `[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]`
|
|
260
|
-
var PubidChar = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/;
|
|
261
|
-
|
|
262
|
-
// https://www.w3.org/TR/xml11/#NT-PubidLiteral
|
|
263
|
-
// `[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"`
|
|
264
|
-
var PubidLiteral = regg('"', PubidChar, '*"', '|', "'", chars_without(PubidChar, "'"), "*'");
|
|
265
|
-
|
|
266
|
-
// https://www.w3.org/TR/xml11/#NT-CharData
|
|
267
|
-
// `[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)`
|
|
268
|
-
|
|
269
|
-
var COMMENT_START = '<!--';
|
|
270
|
-
var COMMENT_END = '-->';
|
|
271
|
-
// https://www.w3.org/TR/xml11/#NT-Comment
|
|
272
|
-
// `[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'`
|
|
273
|
-
var Comment = reg(COMMENT_START, regg(chars_without(Char, '-'), '|', reg('-', chars_without(Char, '-'))), '*', COMMENT_END);
|
|
274
|
-
|
|
275
|
-
var PCDATA = '#PCDATA';
|
|
276
|
-
// https://www.w3.org/TR/xml11/#NT-Mixed
|
|
277
|
-
// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'`
|
|
278
|
-
// https://www.w3.org/TR/xml-names/#NT-Mixed
|
|
279
|
-
// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? QName)* S? ')*' | '(' S? '#PCDATA' S? ')'`
|
|
280
|
-
// [VC: Proper Group/PE Nesting] [VC: No Duplicate Types]
|
|
281
|
-
var Mixed = regg(
|
|
282
|
-
reg(/\(/, S_OPT, PCDATA, regg(S_OPT, /\|/, S_OPT, QName), '*', S_OPT, /\)\*/),
|
|
283
|
-
'|',
|
|
284
|
-
reg(/\(/, S_OPT, PCDATA, S_OPT, /\)/)
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
var _children_quantity = /[?*+]?/;
|
|
288
|
-
/*
|
|
289
|
-
`[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'` [VC: Proper Group/PE Nesting]
|
|
290
|
-
`[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'` [VC: Proper Group/PE Nesting]
|
|
291
|
-
simplification to solve circular referencing, but doesn't check validity constraint "Proper Group/PE Nesting"
|
|
292
|
-
var _choice_or_seq = reg('[', NameChar_s, SChar_s, chars(_children_quantity), '()|,]*');
|
|
293
|
-
```
|
|
294
|
-
[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
|
|
295
|
-
=== (Name | '(' S? cp ( S? '|' S? cp )+ S? ')' | '(' S? cp ( S? ',' S? cp )* S? ')') ('?' | '*' | '+')?
|
|
296
|
-
!== (Name | [_choice_or_seq]*) ('?' | '*' | '+')?
|
|
297
|
-
```
|
|
298
|
-
simplification to solve circular referencing, but doesn't check validity constraint "Proper Group/PE Nesting"
|
|
299
|
-
var cp = reg(regg(Name, '|', _choice_or_seq), _children_quantity);
|
|
300
|
-
*/
|
|
301
|
-
/*
|
|
302
|
-
Inefficient regular expression (High)
|
|
303
|
-
This part of the regular expression may cause exponential backtracking on strings starting with '(|' and containing many repetitions of '|'.
|
|
304
|
-
https://github.com/xmldom/xmldom/security/code-scanning/91
|
|
305
|
-
var choice = regg(/\(/, S_OPT, cp, regg(S_OPT, /\|/, S_OPT, cp), '+', S_OPT, /\)/);
|
|
306
|
-
*/
|
|
307
|
-
/*
|
|
308
|
-
Inefficient regular expression (High)
|
|
309
|
-
This part of the regular expression may cause exponential backtracking on strings starting with '(,' and containing many repetitions of ','.
|
|
310
|
-
https://github.com/xmldom/xmldom/security/code-scanning/92
|
|
311
|
-
var seq = regg(/\(/, S_OPT, cp, regg(S_OPT, /,/, S_OPT, cp), '*', S_OPT, /\)/);
|
|
312
|
-
*/
|
|
313
|
-
|
|
314
|
-
// `[47] children ::= (choice | seq) ('?' | '*' | '+')?`
|
|
315
|
-
// simplification to solve circular referencing, but doesn't check validity constraint "Proper Group/PE Nesting"
|
|
316
|
-
var children = reg(/\([^>]+\)/, _children_quantity /*regg(choice, '|', seq), _children_quantity*/);
|
|
317
|
-
|
|
318
|
-
// https://www.w3.org/TR/xml11/#NT-contentspec
|
|
319
|
-
// `[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children`
|
|
320
|
-
var contentspec = regg('EMPTY', '|', 'ANY', '|', Mixed, '|', children);
|
|
321
|
-
|
|
322
|
-
var ELEMENTDECL_START = '<!ELEMENT';
|
|
323
|
-
// https://www.w3.org/TR/xml11/#NT-elementdecl
|
|
324
|
-
// `[45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'`
|
|
325
|
-
// https://www.w3.org/TR/xml-names/#NT-elementdecl
|
|
326
|
-
// `[17] elementdecl ::= '<!ELEMENT' S QName S contentspec S? '>'`
|
|
327
|
-
// because of https://www.w3.org/TR/xml11/#NT-PEReference
|
|
328
|
-
// since xmldom is not supporting replacements of PEReferences in the DTD
|
|
329
|
-
// this also supports PEReference in the possible places
|
|
330
|
-
var elementdecl = reg(ELEMENTDECL_START, S, regg(QName, '|', PEReference), S, regg(contentspec, '|', PEReference), S_OPT, '>');
|
|
331
|
-
|
|
332
|
-
// https://www.w3.org/TR/xml11/#NT-NotationType
|
|
333
|
-
// `[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'`
|
|
334
|
-
// [VC: Notation Attributes] [VC: One Notation Per Element Type] [VC: No Notation on Empty Element] [VC: No Duplicate Tokens]
|
|
335
|
-
var NotationType = reg('NOTATION', S, /\(/, S_OPT, Name, regg(S_OPT, /\|/, S_OPT, Name), '*', S_OPT, /\)/);
|
|
336
|
-
// https://www.w3.org/TR/xml11/#NT-Enumeration
|
|
337
|
-
// `[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'`
|
|
338
|
-
// [VC: Enumeration] [VC: No Duplicate Tokens]
|
|
339
|
-
var Enumeration = reg(/\(/, S_OPT, Nmtoken, regg(S_OPT, /\|/, S_OPT, Nmtoken), '*', S_OPT, /\)/);
|
|
340
|
-
|
|
341
|
-
// https://www.w3.org/TR/xml11/#NT-EnumeratedType
|
|
342
|
-
// `[57] EnumeratedType ::= NotationType | Enumeration`
|
|
343
|
-
var EnumeratedType = regg(NotationType, '|', Enumeration);
|
|
344
|
-
|
|
345
|
-
/*
|
|
346
|
-
```
|
|
347
|
-
[55] StringType ::= 'CDATA'
|
|
348
|
-
[56] TokenizedType ::= 'ID' [VC: ID] [VC: One ID per Element Type] [VC: ID Attribute Default]
|
|
349
|
-
| 'IDREF' [VC: IDREF]
|
|
350
|
-
| 'IDREFS' [VC: IDREF]
|
|
351
|
-
| 'ENTITY' [VC: Entity Name]
|
|
352
|
-
| 'ENTITIES' [VC: Entity Name]
|
|
353
|
-
| 'NMTOKEN' [VC: Name Token]
|
|
354
|
-
| 'NMTOKENS' [VC: Name Token]
|
|
355
|
-
[54] AttType ::= StringType | TokenizedType | EnumeratedType
|
|
356
|
-
```*/
|
|
357
|
-
var AttType = regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, '|', EnumeratedType);
|
|
358
|
-
|
|
359
|
-
// `[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)`
|
|
360
|
-
// [WFC: No < in Attribute Values] [WFC: No External Entity References]
|
|
361
|
-
// [VC: Fixed Attribute Default] [VC: Required Attribute] [VC: Attribute Default Value Syntactically Correct]
|
|
362
|
-
var DefaultDecl = regg(/#REQUIRED|#IMPLIED/, '|', regg(regg('#FIXED', S), '?', AttValue));
|
|
363
|
-
|
|
364
|
-
// https://www.w3.org/TR/xml11/#NT-AttDef
|
|
365
|
-
// [53] AttDef ::= S Name S AttType S DefaultDecl
|
|
366
|
-
// https://www.w3.org/TR/xml-names/#NT-AttDef
|
|
367
|
-
// [1] NSAttName ::= PrefixedAttName | DefaultAttName
|
|
368
|
-
// [2] PrefixedAttName ::= 'xmlns:' NCName [NSC: Reserved Prefixes and Namespace Names]
|
|
369
|
-
// [3] DefaultAttName ::= 'xmlns'
|
|
370
|
-
// [21] AttDef ::= S (QName | NSAttName) S AttType S DefaultDecl
|
|
371
|
-
// === S Name S AttType S DefaultDecl
|
|
372
|
-
// xmldom is not distinguishing between QName and NSAttName on this level
|
|
373
|
-
// to support XML without namespaces in DTD we can not restrict it to QName
|
|
374
|
-
var AttDef = regg(S, Name, S, AttType, S, DefaultDecl);
|
|
375
|
-
|
|
376
|
-
var ATTLIST_DECL_START = '<!ATTLIST';
|
|
377
|
-
// https://www.w3.org/TR/xml11/#NT-AttlistDecl
|
|
378
|
-
// `[52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'`
|
|
379
|
-
// https://www.w3.org/TR/xml-names/#NT-AttlistDecl
|
|
380
|
-
// `[20] AttlistDecl ::= '<!ATTLIST' S QName AttDef* S? '>'`
|
|
381
|
-
// to support XML without namespaces in DTD we can not restrict it to QName
|
|
382
|
-
var AttlistDecl = reg(ATTLIST_DECL_START, S, Name, AttDef, '*', S_OPT, '>');
|
|
383
|
-
|
|
384
|
-
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#about:legacy-compat
|
|
385
|
-
var ABOUT_LEGACY_COMPAT = 'about:legacy-compat';
|
|
386
|
-
var ABOUT_LEGACY_COMPAT_SystemLiteral = regg('"' + ABOUT_LEGACY_COMPAT + '"', '|', "'" + ABOUT_LEGACY_COMPAT + "'");
|
|
387
|
-
var SYSTEM = 'SYSTEM';
|
|
388
|
-
var PUBLIC = 'PUBLIC';
|
|
389
|
-
// https://www.w3.org/TR/xml11/#NT-ExternalID
|
|
390
|
-
// `[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral`
|
|
391
|
-
var ExternalID = regg(regg(SYSTEM, S, SystemLiteral), '|', regg(PUBLIC, S, PubidLiteral, S, SystemLiteral));
|
|
392
|
-
var ExternalID_match = reg(
|
|
393
|
-
'^',
|
|
394
|
-
regg(
|
|
395
|
-
regg(SYSTEM, S, '(?<SystemLiteralOnly>', SystemLiteral, ')'),
|
|
396
|
-
'|',
|
|
397
|
-
regg(PUBLIC, S, '(?<PubidLiteral>', PubidLiteral, ')', S, '(?<SystemLiteral>', SystemLiteral, ')')
|
|
398
|
-
)
|
|
399
|
-
);
|
|
400
|
-
|
|
401
|
-
// https://www.w3.org/TR/xml11/#NT-NDataDecl
|
|
402
|
-
// `[76] NDataDecl ::= S 'NDATA' S Name` [VC: Notation Declared]
|
|
403
|
-
var NDataDecl = regg(S, 'NDATA', S, Name);
|
|
404
|
-
|
|
405
|
-
// https://www.w3.org/TR/xml11/#NT-EntityDef
|
|
406
|
-
// `[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)`
|
|
407
|
-
var EntityDef = regg(EntityValue, '|', regg(ExternalID, NDataDecl, '?'));
|
|
408
|
-
|
|
409
|
-
var ENTITY_DECL_START = '<!ENTITY';
|
|
410
|
-
// https://www.w3.org/TR/xml11/#NT-GEDecl
|
|
411
|
-
// `[71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'`
|
|
412
|
-
var GEDecl = reg(ENTITY_DECL_START, S, Name, S, EntityDef, S_OPT, '>');
|
|
413
|
-
// https://www.w3.org/TR/xml11/#NT-PEDef
|
|
414
|
-
// `[74] PEDef ::= EntityValue | ExternalID`
|
|
415
|
-
var PEDef = regg(EntityValue, '|', ExternalID);
|
|
416
|
-
// https://www.w3.org/TR/xml11/#NT-PEDecl
|
|
417
|
-
// `[72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'`
|
|
418
|
-
var PEDecl = reg(ENTITY_DECL_START, S, '%', S, Name, S, PEDef, S_OPT, '>');
|
|
419
|
-
// https://www.w3.org/TR/xml11/#NT-EntityDecl
|
|
420
|
-
// `[70] EntityDecl ::= GEDecl | PEDecl`
|
|
421
|
-
var EntityDecl = regg(GEDecl, '|', PEDecl);
|
|
422
|
-
|
|
423
|
-
// https://www.w3.org/TR/xml11/#NT-PublicID
|
|
424
|
-
// `[83] PublicID ::= 'PUBLIC' S PubidLiteral`
|
|
425
|
-
var PublicID = reg(PUBLIC, S, PubidLiteral);
|
|
426
|
-
// https://www.w3.org/TR/xml11/#NT-NotationDecl
|
|
427
|
-
// `[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'` [VC: Unique Notation Name]
|
|
428
|
-
var NotationDecl = reg('<!NOTATION', S, Name, S, regg(ExternalID, '|', PublicID), S_OPT, '>');
|
|
429
|
-
|
|
430
|
-
// https://www.w3.org/TR/xml11/#NT-Eq
|
|
431
|
-
// `[25] Eq ::= S? '=' S?`
|
|
432
|
-
var Eq = reg(S_OPT, '=', S_OPT);
|
|
433
|
-
// https://www.w3.org/TR/xml/#NT-VersionNum
|
|
434
|
-
// `[26] VersionNum ::= '1.' [0-9]+`
|
|
435
|
-
// https://www.w3.org/TR/xml11/#NT-VersionNum
|
|
436
|
-
// `[26] VersionNum ::= '1.1'`
|
|
437
|
-
var VersionNum = /1[.]\d+/;
|
|
438
|
-
// https://www.w3.org/TR/xml11/#NT-VersionInfo
|
|
439
|
-
// `[24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')`
|
|
440
|
-
var VersionInfo = reg(S, 'version', Eq, regg("'", VersionNum, "'", '|', '"', VersionNum, '"'));
|
|
441
|
-
// https://www.w3.org/TR/xml11/#NT-EncName
|
|
442
|
-
// `[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*`
|
|
443
|
-
var EncName = /[A-Za-z][-A-Za-z0-9._]*/;
|
|
444
|
-
// https://www.w3.org/TR/xml11/#NT-EncDecl
|
|
445
|
-
// `[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" )`
|
|
446
|
-
var EncodingDecl = regg(S, 'encoding', Eq, regg('"', EncName, '"', '|', "'", EncName, "'"));
|
|
447
|
-
// https://www.w3.org/TR/xml11/#NT-SDDecl
|
|
448
|
-
// `[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))`
|
|
449
|
-
var SDDecl = regg(S, 'standalone', Eq, regg("'", regg('yes', '|', 'no'), "'", '|', '"', regg('yes', '|', 'no'), '"'));
|
|
450
|
-
// https://www.w3.org/TR/xml11/#NT-XMLDecl
|
|
451
|
-
// [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
|
|
452
|
-
var XMLDecl = reg(/^<\?xml/, VersionInfo, EncodingDecl, '?', SDDecl, '?', S_OPT, /\?>/);
|
|
453
|
-
|
|
454
|
-
/*
|
|
455
|
-
https://www.w3.org/TR/xml/#NT-markupdecl
|
|
456
|
-
https://www.w3.org/TR/xml11/#NT-markupdecl
|
|
457
|
-
`[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment`
|
|
458
|
-
var markupdecl = regg(elementdecl, '|', AttlistDecl, '|', EntityDecl, '|', NotationDecl, '|', PI_unsafe, '|', Comment);
|
|
459
|
-
*/
|
|
460
|
-
/*
|
|
461
|
-
https://www.w3.org/TR/xml-names/#NT-doctypedecl
|
|
462
|
-
`[28a] DeclSep ::= PEReference | S`
|
|
463
|
-
https://www.w3.org/TR/xml11/#NT-intSubset
|
|
464
|
-
```
|
|
465
|
-
[28b] intSubset ::= (markupdecl | DeclSep)*
|
|
466
|
-
=== (markupdecl | PEReference | S)*
|
|
467
|
-
```
|
|
468
|
-
[WFC: PE Between Declarations]
|
|
469
|
-
var intSubset = reg(regg(markupdecl, '|', PEReference, '|', S), '*');
|
|
470
|
-
*/
|
|
471
|
-
var DOCTYPE_DECL_START = '<!DOCTYPE';
|
|
472
|
-
/*
|
|
473
|
-
https://www.w3.org/TR/xml11/#NT-doctypedecl
|
|
474
|
-
`[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'`
|
|
475
|
-
https://www.afterwardsw3.org/TR/xml-names/#NT-doctypedecl
|
|
476
|
-
`[16] doctypedecl ::= '<!DOCTYPE' S QName (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '>'`
|
|
477
|
-
var doctypedecl = reg('<!DOCTYPE', S, Name, regg(S, ExternalID), '?', S_OPT, regg(/\[/, intSubset, /]/, S_OPT), '?', '>');
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
var CDATA_START = '<![CDATA[';
|
|
481
|
-
var CDATA_END = ']]>';
|
|
482
|
-
var CDStart = /<!\[CDATA\[/;
|
|
483
|
-
var CDEnd = /\]\]>/;
|
|
484
|
-
var CData = reg(Char, '*?', CDEnd);
|
|
485
|
-
/*
|
|
486
|
-
https://www.w3.org/TR/xml/#dt-cdsection
|
|
487
|
-
`[18] CDSect ::= CDStart CData CDEnd`
|
|
488
|
-
`[19] CDStart ::= '<![CDATA['`
|
|
489
|
-
`[20] CData ::= (Char* - (Char* ']]>' Char*))`
|
|
490
|
-
`[21] CDEnd ::= ']]>'`
|
|
491
|
-
*/
|
|
492
|
-
var CDSect = reg(CDStart, CData);
|
|
493
|
-
|
|
494
|
-
// unit tested
|
|
495
|
-
exports.chars = chars;
|
|
496
|
-
exports.chars_without = chars_without;
|
|
497
|
-
exports.detectUnicodeSupport = detectUnicodeSupport;
|
|
498
|
-
exports.reg = reg;
|
|
499
|
-
exports.regg = regg;
|
|
500
|
-
exports.ABOUT_LEGACY_COMPAT = ABOUT_LEGACY_COMPAT;
|
|
501
|
-
exports.ABOUT_LEGACY_COMPAT_SystemLiteral = ABOUT_LEGACY_COMPAT_SystemLiteral;
|
|
502
|
-
exports.AttlistDecl = AttlistDecl;
|
|
503
|
-
exports.CDATA_START = CDATA_START;
|
|
504
|
-
exports.CDATA_END = CDATA_END;
|
|
505
|
-
exports.CDSect = CDSect;
|
|
506
|
-
exports.Char = Char;
|
|
507
|
-
exports.Comment = Comment;
|
|
508
|
-
exports.COMMENT_START = COMMENT_START;
|
|
509
|
-
exports.COMMENT_END = COMMENT_END;
|
|
510
|
-
exports.DOCTYPE_DECL_START = DOCTYPE_DECL_START;
|
|
511
|
-
exports.elementdecl = elementdecl;
|
|
512
|
-
exports.EntityDecl = EntityDecl;
|
|
513
|
-
exports.EntityValue = EntityValue;
|
|
514
|
-
exports.ExternalID = ExternalID;
|
|
515
|
-
exports.ExternalID_match = ExternalID_match;
|
|
516
|
-
exports.Name = Name;
|
|
517
|
-
exports.NotationDecl = NotationDecl;
|
|
518
|
-
exports.Reference = Reference;
|
|
519
|
-
exports.PEReference = PEReference;
|
|
520
|
-
exports.PI = PI;
|
|
521
|
-
exports.PUBLIC = PUBLIC;
|
|
522
|
-
exports.PubidLiteral = PubidLiteral;
|
|
523
|
-
exports.QName = QName;
|
|
524
|
-
exports.QName_exact = QName_exact;
|
|
525
|
-
exports.QName_group = QName_group;
|
|
526
|
-
exports.S = S;
|
|
527
|
-
exports.SChar_s = SChar_s;
|
|
528
|
-
exports.S_OPT = S_OPT;
|
|
529
|
-
exports.SYSTEM = SYSTEM;
|
|
530
|
-
exports.SystemLiteral = SystemLiteral;
|
|
531
|
-
exports.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER;
|
|
532
|
-
exports.UNICODE_SUPPORT = UNICODE_SUPPORT;
|
|
533
|
-
exports.XMLDecl = XMLDecl;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var conventions = require('./conventions');
|
|
3
|
-
exports.assign = conventions.assign;
|
|
4
|
-
exports.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
|
|
5
|
-
exports.isHTMLMimeType = conventions.isHTMLMimeType;
|
|
6
|
-
exports.isValidMimeType = conventions.isValidMimeType;
|
|
7
|
-
exports.MIME_TYPE = conventions.MIME_TYPE;
|
|
8
|
-
exports.NAMESPACE = conventions.NAMESPACE;
|
|
9
|
-
|
|
10
|
-
var errors = require('./errors');
|
|
11
|
-
exports.DOMException = errors.DOMException;
|
|
12
|
-
exports.DOMExceptionName = errors.DOMExceptionName;
|
|
13
|
-
exports.ExceptionCode = errors.ExceptionCode;
|
|
14
|
-
exports.ParseError = errors.ParseError;
|
|
15
|
-
|
|
16
|
-
var dom = require('./dom');
|
|
17
|
-
exports.Attr = dom.Attr;
|
|
18
|
-
exports.CDATASection = dom.CDATASection;
|
|
19
|
-
exports.CharacterData = dom.CharacterData;
|
|
20
|
-
exports.Comment = dom.Comment;
|
|
21
|
-
exports.Document = dom.Document;
|
|
22
|
-
exports.DocumentFragment = dom.DocumentFragment;
|
|
23
|
-
exports.DocumentType = dom.DocumentType;
|
|
24
|
-
exports.DOMImplementation = dom.DOMImplementation;
|
|
25
|
-
exports.Element = dom.Element;
|
|
26
|
-
exports.Entity = dom.Entity;
|
|
27
|
-
exports.EntityReference = dom.EntityReference;
|
|
28
|
-
exports.LiveNodeList = dom.LiveNodeList;
|
|
29
|
-
exports.NamedNodeMap = dom.NamedNodeMap;
|
|
30
|
-
exports.Node = dom.Node;
|
|
31
|
-
exports.NodeList = dom.NodeList;
|
|
32
|
-
exports.Notation = dom.Notation;
|
|
33
|
-
exports.ProcessingInstruction = dom.ProcessingInstruction;
|
|
34
|
-
exports.Text = dom.Text;
|
|
35
|
-
exports.XMLSerializer = dom.XMLSerializer;
|
|
36
|
-
|
|
37
|
-
var domParser = require('./dom-parser');
|
|
38
|
-
exports.DOMParser = domParser.DOMParser;
|
|
39
|
-
exports.normalizeLineEndings = domParser.normalizeLineEndings;
|
|
40
|
-
exports.onErrorStopParsing = domParser.onErrorStopParsing;
|
|
41
|
-
exports.onWarningStopParsing = domParser.onWarningStopParsing;
|