chaffjs 0.17.0 → 0.19.0
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.md +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +20 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +35 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +7 -4
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +138 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +110 -16
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +76 -30
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +24 -3
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/suppressions.ts +30 -2
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +77 -30
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
package/src/structure/of.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { markdownOutline } from "../document.ts";
|
|
2
|
-
import type { DocumentProfile, StructureNode, StructurePatterns } from "../plugin.ts";
|
|
3
|
-
import { buildTree } from "./build.ts";
|
|
2
|
+
import type { DocumentProfile, Lexicon, StructureNode, StructurePatterns } from "../plugin.ts";
|
|
3
|
+
import { buildTree, type Outline } from "./build.ts";
|
|
4
4
|
import { textOutline } from "../page-furniture.ts";
|
|
5
|
+
import { emailParts, emailVocabulary } from "../email-parts.ts";
|
|
5
6
|
|
|
6
7
|
export type SourceInput = {
|
|
7
8
|
readonly path: string;
|
|
@@ -9,8 +10,15 @@ export type SourceInput = {
|
|
|
9
10
|
readonly language: string;
|
|
10
11
|
readonly markdown: boolean;
|
|
11
12
|
readonly profile?: DocumentProfile | undefined;
|
|
13
|
+
/** 言語パッケージの語彙表。メールの引用した返信を見分けて、木に入れない。無ければ見分けない。 */
|
|
14
|
+
readonly lexicons?: Readonly<Record<string, Lexicon>> | undefined;
|
|
12
15
|
};
|
|
13
16
|
|
|
17
|
+
const outlineOf = (input: SourceInput): Outline =>
|
|
18
|
+
input.markdown
|
|
19
|
+
? markdownOutline(input.source, input.lexicons)
|
|
20
|
+
: textOutline(input.source, emailParts(input.source, emailVocabulary(input.lexicons ?? {})).replyQuotes);
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* 文字列から木を作る。Markdown なら見出しとコードの範囲を先に取る。
|
|
16
24
|
* lint は文書モデルを作るときの解析を使い回すので、ここを通らずに buildTree を呼ぶ。
|
|
@@ -21,7 +29,7 @@ export const buildStructure = (input: SourceInput, patterns: StructurePatterns):
|
|
|
21
29
|
path: input.path,
|
|
22
30
|
source: input.source,
|
|
23
31
|
language: input.language,
|
|
24
|
-
outline:
|
|
32
|
+
outline: outlineOf(input),
|
|
25
33
|
markdown: input.markdown,
|
|
26
34
|
profile: input.profile,
|
|
27
35
|
},
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { StructureIssue } from "./issues.ts";
|
|
2
|
+
import { runsOf, TABLE_ROW, TABLE_RULE, type Line } from "./runs.ts";
|
|
3
|
+
import { columnOf, isTotalLabel, type Amount } from "./total.ts";
|
|
4
|
+
import { CELL_SEPARATOR } from "./bare-numbers.ts";
|
|
5
|
+
import { joined, lineAbove, linesAbove } from "../text-above.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 一つの全体を分けた割合(構成比、内訳、breakdown)の和が 100% にならない。箇条書きの続いた項目か、表の続いた行の百分率を足す。
|
|
9
|
+
* 全体を分けたものと読むのは、表のその列の見出しか、すぐ上の文や見出しに割合の語があるときだけ。行ごとの率(利用率)は足さない。
|
|
10
|
+
* 丸めの誤差は、項目ごとに最後の桁の半分まで認める(少なくとも 1 ポイント)。合計の行がある並びは total-mismatch に任せる。
|
|
11
|
+
*/
|
|
12
|
+
export type ShareWords = {
|
|
13
|
+
readonly labels: readonly string[];
|
|
14
|
+
/** 足しても 100% にならない集計(複数回答)。 */
|
|
15
|
+
readonly exceptions: readonly string[];
|
|
16
|
+
readonly units: readonly string[];
|
|
17
|
+
readonly totalLabels: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const WHOLE = 100;
|
|
21
|
+
const MIN_PARTS = 2;
|
|
22
|
+
const HALF = 0.5;
|
|
23
|
+
const DECIMAL_BASE = 10;
|
|
24
|
+
|
|
25
|
+
type Share = Amount & { readonly column: number; readonly decimals: number; readonly signed: boolean };
|
|
26
|
+
|
|
27
|
+
/** 数の前に書いた符号(+3%、-2%、▲2%)。増減の率で、全体の一部ではない。行頭の箇条書きの - は符号にしない。 */
|
|
28
|
+
const SIGNS = "-+−▲△";
|
|
29
|
+
|
|
30
|
+
const isSigned = (source: string, line: Line, offset: number): boolean => {
|
|
31
|
+
const before = source.slice(line.start, offset).trimEnd();
|
|
32
|
+
return SIGNS.includes(before.at(-1) ?? " ") && before.slice(0, -1).trim().length > 0;
|
|
33
|
+
};
|
|
34
|
+
const DECIMALS = /\.(\d+)/u;
|
|
35
|
+
|
|
36
|
+
const includesAny = (text: string, words: readonly string[]): boolean => {
|
|
37
|
+
const lowered = text.toLowerCase();
|
|
38
|
+
return words.some((word) => lowered.includes(word.toLowerCase()));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** 位置の順に並べた百分率のうち、offset 以後の最初のもの。 */
|
|
42
|
+
const firstFrom = (percents: readonly Amount[], offset: number, low = 0, high = percents.length): number => {
|
|
43
|
+
if (low >= high) return low;
|
|
44
|
+
const middle = Math.floor((low + high) / 2);
|
|
45
|
+
return (percents[middle]?.offset ?? 0) < offset ? firstFrom(percents, offset, middle + 1, high) : firstFrom(percents, offset, low, middle);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** 行の中の百分率。百分率は位置の順に並んでいるので、行の頭から探して行の終わりで止める。 */
|
|
49
|
+
const onLine = (percents: readonly Amount[], line: Line): Amount[] => {
|
|
50
|
+
const from = firstFrom(percents, line.start);
|
|
51
|
+
const past = firstFrom(percents, line.end + 1, from);
|
|
52
|
+
return percents.slice(from, past);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const sharesIn = (source: string, line: Line, percents: readonly Amount[]): Share[] =>
|
|
56
|
+
onLine(percents, line).map((amount) => ({
|
|
57
|
+
...amount,
|
|
58
|
+
column: columnOf(source, line, amount.offset),
|
|
59
|
+
signed: isSigned(source, line, amount.offset),
|
|
60
|
+
decimals: DECIMALS.exec(source.slice(amount.offset, amount.end))?.[1]?.length ?? 0,
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
/** 表の見出しの行の升。区切りの行のすぐ上の行。表でなければ無い。 */
|
|
64
|
+
const headerCells = (source: string, firstRow: Line): string[] => {
|
|
65
|
+
const rule = lineAbove(source, firstRow.start);
|
|
66
|
+
if (rule === undefined || !TABLE_RULE.test(rule.text)) return [];
|
|
67
|
+
const header = lineAbove(source, rule.start);
|
|
68
|
+
return header === undefined ? [] : header.text.split(CELL_SEPARATOR);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** 並びのすぐ上の文か見出し。表なら見出しの行と区切りの行を飛ばして、その上。 */
|
|
72
|
+
const textAbove = (source: string, run: readonly Line[]): string => {
|
|
73
|
+
const first = run[0];
|
|
74
|
+
return first === undefined
|
|
75
|
+
? ""
|
|
76
|
+
: (joined(
|
|
77
|
+
source,
|
|
78
|
+
linesAbove(source, first.start, (text) => TABLE_ROW.test(text)),
|
|
79
|
+
)?.text ?? "");
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** 列の百分率。どの行にもちょうど一つあり、符号の無いときだけ。 */
|
|
83
|
+
const columnShares = (rows: readonly Share[][], column: number): Share[] | undefined => {
|
|
84
|
+
const cells = rows.map((row) => row.filter((share) => share.column === column));
|
|
85
|
+
if (cells.some((cell) => cell.length !== 1)) return undefined;
|
|
86
|
+
const shares = cells.flat();
|
|
87
|
+
return shares.some((share) => share.signed) ? undefined : shares;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const sumOf = (shares: readonly Share[]): number => shares.reduce((total, share) => total + share.value, 0);
|
|
91
|
+
|
|
92
|
+
const decimalsOf = (shares: readonly Share[]): number => Math.max(0, ...shares.map((share) => share.decimals));
|
|
93
|
+
|
|
94
|
+
/** 丸めで離れうる幅。項目ごとに最後の桁の半分、少なくとも 1 ポイント。 */
|
|
95
|
+
const tolerance = (shares: readonly Share[]): number => Math.max(1, shares.length * HALF * DECIMAL_BASE ** -decimalsOf(shares));
|
|
96
|
+
|
|
97
|
+
/** 和は、項目のいちばん細かい桁で、最初の項目の単位を付けて見せる。 */
|
|
98
|
+
const shownSum = (shares: readonly Share[]): string => `${sumOf(shares).toFixed(decimalsOf(shares))}${shares[0]?.unit ?? ""}`;
|
|
99
|
+
|
|
100
|
+
type Named = { readonly header: readonly string[]; readonly above: string };
|
|
101
|
+
|
|
102
|
+
/** 列が全体を分けた割合と名指されているか。表は列の見出しか、百分率の列が一つだけの表の上の文。箇条書きは上の文。 */
|
|
103
|
+
const namesShares = (named: Named, column: number, percentColumns: number, words: ShareWords): boolean => {
|
|
104
|
+
const header = named.header[column] ?? "";
|
|
105
|
+
if (named.header.length > 0 && includesAny(header, words.labels)) return true;
|
|
106
|
+
return (named.header.length === 0 || percentColumns === 1) && includesAny(named.above, words.labels);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** 足してよい並び: 二行以上で、合計の行が無い。 */
|
|
110
|
+
const isBreakdown = (source: string, run: readonly Line[], totalLabels: readonly string[]): boolean =>
|
|
111
|
+
run.length >= MIN_PARTS && !run.some((line) => isTotalLabel(source.slice(line.start, line.end), totalLabels));
|
|
112
|
+
|
|
113
|
+
const namingOf = (source: string, run: readonly Line[], first: Line): Named => ({ header: headerCells(source, first), above: textAbove(source, run) });
|
|
114
|
+
|
|
115
|
+
const mismatchesIn = (source: string, run: readonly Line[], percents: readonly Amount[], words: ShareWords): StructureIssue[] => {
|
|
116
|
+
const first = run[0];
|
|
117
|
+
if (first === undefined || !isBreakdown(source, run, words.totalLabels)) return [];
|
|
118
|
+
const rows = run.map((line) => sharesIn(source, line, percents));
|
|
119
|
+
const columns = [...new Set((rows[0] ?? []).map((share) => share.column))];
|
|
120
|
+
if (columns.length === 0) return [];
|
|
121
|
+
const named = namingOf(source, run, first);
|
|
122
|
+
if (includesAny([...named.header, named.above].join(" "), words.exceptions)) return [];
|
|
123
|
+
return columns.flatMap((column) => {
|
|
124
|
+
const shares = columnShares(rows, column);
|
|
125
|
+
if (shares === undefined || !namesShares(named, column, columns.length, words)) return [];
|
|
126
|
+
if (Math.abs(sumOf(shares) - WHOLE) <= tolerance(shares)) return [];
|
|
127
|
+
return [{ offset: shares[0]?.offset ?? first.start, values: { sum: shownSum(shares) } }];
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const percentSumMismatches = (source: string, amounts: readonly Amount[], words: ShareWords): StructureIssue[] => {
|
|
132
|
+
if (words.labels.length === 0) return [];
|
|
133
|
+
const percents = amounts.filter((amount) => words.units.includes(amount.unit)).toSorted((a, b) => a.offset - b.offset);
|
|
134
|
+
return runsOf(source).flatMap((run) => mismatchesIn(source, run, percents, words));
|
|
135
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StructureNode } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
type Visit = { readonly node: StructureNode; readonly leaving: boolean };
|
|
4
|
+
|
|
5
|
+
const keyOf = (node: StructureNode): string | undefined => (node.ordinal === undefined || node.address === "" ? undefined : `${node.kind}/${node.address}`);
|
|
6
|
+
|
|
7
|
+
/** 開いた節を番地ごとに積む。同じ番地の節がもう開いていれば、その一番近いものが中に自分の番号を持つ。 */
|
|
8
|
+
const enter = (open: Map<string, StructureNode[]>, key: string, node: StructureNode, quoting: Set<StructureNode>): void => {
|
|
9
|
+
const holders = open.get(key) ?? [];
|
|
10
|
+
const nearest = holders.at(-1);
|
|
11
|
+
if (nearest !== undefined) quoting.add(nearest);
|
|
12
|
+
holders.push(node);
|
|
13
|
+
open.set(key, holders);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 同じ種類・同じ番地の番号付きの節を中に持つ節。自分の中に自分は無いので、これはこの文書の番号ではなく、
|
|
18
|
+
* 書き方の手本(「§ 163.25」の下に書き直した「§ 163.25」)のように、ほかの文書の条を名前として引いている。
|
|
19
|
+
* 木を一度だけ歩く。一番近い祖先だけに印を付ければ、その外側は内側の祖先が付ける。深い木でも再帰しない。
|
|
20
|
+
*/
|
|
21
|
+
export const numbersQuotedInside = (tree: StructureNode): ReadonlySet<StructureNode> => {
|
|
22
|
+
const quoting = new Set<StructureNode>();
|
|
23
|
+
const open = new Map<string, StructureNode[]>();
|
|
24
|
+
const pending: Visit[] = [{ node: tree, leaving: false }];
|
|
25
|
+
for (let visit = pending.pop(); visit !== undefined; visit = pending.pop()) {
|
|
26
|
+
const key = keyOf(visit.node);
|
|
27
|
+
if (visit.leaving) {
|
|
28
|
+
if (key !== undefined) open.get(key)?.pop();
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (key !== undefined) enter(open, key, visit.node, quoting);
|
|
32
|
+
pending.push({ node: visit.node, leaving: true });
|
|
33
|
+
visit.node.children.toReversed().forEach((child) => pending.push({ node: child, leaving: false }));
|
|
34
|
+
}
|
|
35
|
+
return quoting;
|
|
36
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { DocumentProfile, Mention, RelativeVocabulary, Span } from "../plugin.ts";
|
|
2
|
+
import { isOneCharacter, withoutClosedPairs } from "./closed-pairs.ts";
|
|
3
|
+
import { asideDepth, characters, type AsideDepth } from "./aside-depth.ts";
|
|
4
|
+
import { knownMentions, type KnownMentions } from "./known-mentions.ts";
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* 前条・次項・同号・本条・前各項・前二項・前条第二項、条を書かない「第一項」を行の中から探す。語は文書の種類(profiles/*.yaml)が決める。
|
|
@@ -74,17 +77,6 @@ const countOf = (count: string | undefined, vocabulary: RelativeVocabulary, numb
|
|
|
74
77
|
|
|
75
78
|
type Substitution = NonNullable<RelativeVocabulary["substitution"]>;
|
|
76
79
|
|
|
77
|
-
/** 文字と、その位置(UTF-16 の単位で)。絵文字のような 2 単位の文字も 1 文字として読む。 */
|
|
78
|
-
const characters = (text: string): { readonly char: string; readonly at: number }[] => {
|
|
79
|
-
const found: { char: string; at: number }[] = [];
|
|
80
|
-
let at = 0;
|
|
81
|
-
for (const char of text) {
|
|
82
|
-
found.push({ char, at });
|
|
83
|
-
at += char.length;
|
|
84
|
-
}
|
|
85
|
-
return found;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
80
|
/** 一番外側の括弧の範囲。閉じの無い開きは捨てる。 */
|
|
89
81
|
const outerQuotes = (text: string, quote: Substitution): Span[] => {
|
|
90
82
|
const spans: Span[] = [];
|
|
@@ -118,20 +110,23 @@ export const substitutedDocuments = (mentions: readonly Mention[], text: string,
|
|
|
118
110
|
);
|
|
119
111
|
};
|
|
120
112
|
|
|
121
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* 閉じた括弧書きを内側から外す。開きと閉じが 1 字ずつなら、組ごと 1 度で外す(深い入れ子でも本文を読み直さない)。
|
|
115
|
+
* 2 字以上の括弧は、内側の組を外すのを変わらなくなるまで繰り返す。
|
|
116
|
+
*/
|
|
122
117
|
const withoutAsides = (gap: string, aside: RelativeVocabulary["aside"]): string => {
|
|
123
118
|
if (aside === undefined) return gap;
|
|
119
|
+
if (isOneCharacter(aside.open) && isOneCharacter(aside.close)) return withoutClosedPairs(gap, aside.open, aside.close);
|
|
124
120
|
const inner = new RegExp(`${escape(aside.open)}[^${escape(aside.open)}${escape(aside.close)}]*${escape(aside.close)}`, "gu");
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
let rest = gap;
|
|
122
|
+
for (let once = rest.replace(inner, ""); once !== rest; once = rest.replace(inner, "")) rest = once;
|
|
123
|
+
return rest;
|
|
127
124
|
};
|
|
128
125
|
|
|
129
126
|
/** あいだが、並びをつなぐもの・つなぎの語・閉じた括弧書き・空白だけか。 */
|
|
130
127
|
const onlyJoins = (gap: string, patterns: Compiled, vocabulary: RelativeVocabulary): boolean =>
|
|
131
128
|
withoutAsides(gap, vocabulary.aside).replace(patterns.joins, "").trim() === "";
|
|
132
129
|
|
|
133
|
-
const overlaps = (start: number, end: number, others: readonly Mention[]): boolean => others.some((other) => start < other.end && other.start < end);
|
|
134
|
-
|
|
135
130
|
/** 行き先を決められない番地。並びの続きを止めるためだけに覚え、参照にはしない。 */
|
|
136
131
|
const OPAQUE = "opaque";
|
|
137
132
|
|
|
@@ -154,53 +149,45 @@ const bareCandidates = (text: string, patterns: Compiled, vocabulary: RelativeVo
|
|
|
154
149
|
/** 並びの中での扱い: 前の参照の続きか、今いるところの中か、行き先を決められないか。 */
|
|
155
150
|
type BareWay = { readonly way: string; readonly continues?: Mention | undefined };
|
|
156
151
|
|
|
157
|
-
/**
|
|
158
|
-
|
|
152
|
+
/** 本文と、その括弧書きの深さ。並びは同じ深さの参照どうしでつながる。 */
|
|
153
|
+
type Line = { readonly text: string; readonly asides: AsideDepth };
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 並びの中での扱い: 前の参照の続きか、今いるところの中か、行き先を決められないか。続きなら、どの参照の続きか。
|
|
157
|
+
* 前の参照とつながらなくても、参照の直後に開いた括弧書きの中なら、その参照の続き。
|
|
158
|
+
* 「第二十七条(第四項を除き、第五項及び第六項の規定を…)」の番地は、どれも第二十七条の中。
|
|
159
|
+
*/
|
|
160
|
+
const wayOfBare = (line: Line, bare: Bare, known: KnownMentions, patterns: Compiled, vocabulary: RelativeVocabulary): BareWay => {
|
|
161
|
+
const { text, asides } = line;
|
|
159
162
|
if (glued(text, bare.start, patterns)) return { way: OPAQUE };
|
|
160
|
-
const
|
|
161
|
-
const sameDepth = known.filter((other) => other.end <= bare.start && openAsides(text, other.end, vocabulary).length === depth);
|
|
162
|
-
const previous = sameDepth.toSorted((left, right) => left.end - right.end).at(-1);
|
|
163
|
+
const previous = known.previous(bare.start, asides.depth(bare.start));
|
|
163
164
|
const joined = previous !== undefined && onlyJoins(text.slice(previous.end, bare.start), patterns, vocabulary) ? previous : undefined;
|
|
164
|
-
const
|
|
165
|
+
const open = asides.innermost(bare.start);
|
|
166
|
+
const continues = joined ?? (open === undefined ? undefined : known.endingAt(open));
|
|
165
167
|
if (continues === undefined) return { way: "current" };
|
|
166
168
|
return continues.attrs["relative"] === OPAQUE ? { way: OPAQUE } : { way: "continue", continues };
|
|
167
169
|
};
|
|
168
170
|
|
|
169
|
-
/** at の位置で開いたままの括弧書きの開きの位置。並びは同じ深さの参照どうしでつながる。 */
|
|
170
|
-
const openAsides = (text: string, at: number, vocabulary: RelativeVocabulary): number[] => {
|
|
171
|
-
const aside = vocabulary.aside;
|
|
172
|
-
const opens: number[] = [];
|
|
173
|
-
if (aside === undefined) return opens;
|
|
174
|
-
characters(text.slice(0, at)).forEach(({ char, at: position }) => {
|
|
175
|
-
if (char === aside.open) opens.push(position);
|
|
176
|
-
if (char === aside.close) opens.pop();
|
|
177
|
-
});
|
|
178
|
-
return opens;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* 参照の直後に開いた括弧書きの中なら、その参照。「第二十七条(第四項を除き、第五項及び第六項の規定を…)」の番地は、どれも第二十七条の中。
|
|
183
|
-
*/
|
|
184
|
-
const ownerOfAside = (text: string, at: number, known: readonly Mention[], vocabulary: RelativeVocabulary): Mention | undefined => {
|
|
185
|
-
const open = openAsides(text, at, vocabulary).at(-1);
|
|
186
|
-
return open === undefined ? undefined : known.find((other) => other.end === open);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
171
|
/**
|
|
190
172
|
* 条を書かない「第一項」。すぐ前の参照とのあいだがつなぎの語だけなら、その参照の続き(continue)。
|
|
191
173
|
* そうでなければ、書いた場所を含む一つ上のまとまり(current)の中。
|
|
192
174
|
*/
|
|
193
175
|
const bareMentions = (text: string, patterns: Compiled, vocabulary: RelativeVocabulary, number: NumberReader, before: readonly Mention[]): Mention[] => {
|
|
176
|
+
const candidates = bareCandidates(text, patterns, vocabulary, number);
|
|
177
|
+
if (candidates.length === 0) return [];
|
|
178
|
+
const line = { text, asides: asideDepth(text, vocabulary.aside) };
|
|
179
|
+
const known = knownMentions(before, line.asides.depth);
|
|
194
180
|
const found: Mention[] = [];
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const { way, continues } = wayOfBare(text, bare, known, patterns, vocabulary);
|
|
181
|
+
candidates.forEach((bare) => {
|
|
182
|
+
if (known.overlaps(bare.start, bare.end)) return;
|
|
183
|
+
const { way, continues } = wayOfBare(line, bare, known, patterns, vocabulary);
|
|
199
184
|
// 条を書かない番地は、その一つ上(level)ではなく、書いた単位(level + 1)から名指しする。「第一項」は「同条」の行き先を変えない。
|
|
200
185
|
// continues は、続きの元の参照がどれだけ前から始まるか。木の中で、その参照を位置で引く。
|
|
201
186
|
const back = continues === undefined ? {} : { continues: bare.start - continues.start };
|
|
202
187
|
const attrs = { label: bare.label, relative: way, level: bare.first - 1, count: 1, suffix: bare.suffix, names: bare.first, ...back };
|
|
203
|
-
|
|
188
|
+
const mention = { start: bare.start, end: bare.end, attrs };
|
|
189
|
+
found.push(mention);
|
|
190
|
+
known.add(mention, line.asides.depth(mention.end));
|
|
204
191
|
});
|
|
205
192
|
return found.filter((mention) => mention.attrs["relative"] !== OPAQUE);
|
|
206
193
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StructureNode } from "../plugin.ts";
|
|
2
|
+
import { preOrder } from "../tree-walk.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 相対の参照(relative-find.ts が見つけたもの)に番地を与える。木ができてからでないと「次条」は決まらないので、ここは木を読むだけの後段。
|
|
@@ -24,11 +25,18 @@ const placeOf = (node: StructureNode): Place | undefined =>
|
|
|
24
25
|
NUMBERED.has(node.kind) && node.level !== undefined ? { address: node.address, level: node.level, range: node.ordinalTo !== undefined } : undefined;
|
|
25
26
|
|
|
26
27
|
/** 番号の付いた子。Markdown の見出し(section)は番号の外なので、その中まで見る。 */
|
|
27
|
-
const numberedChildren = (node: StructureNode, level: number): StructureNode[] =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const numberedChildren = (node: StructureNode, level: number): StructureNode[] => {
|
|
29
|
+
const found: StructureNode[] = [];
|
|
30
|
+
const pending = node.children.toReversed();
|
|
31
|
+
while (pending.length > 0) {
|
|
32
|
+
const child = pending.pop();
|
|
33
|
+
if (child === undefined) break;
|
|
34
|
+
if (NUMBERED.has(child.kind)) {
|
|
35
|
+
if (child.level === level) found.push(child);
|
|
36
|
+
} else if (child.kind === "section") child.children.toReversed().forEach((inner) => pending.push(inner));
|
|
37
|
+
}
|
|
38
|
+
return found;
|
|
39
|
+
};
|
|
32
40
|
|
|
33
41
|
type Context = {
|
|
34
42
|
readonly articles: readonly Place[];
|
|
@@ -182,27 +190,65 @@ const resolveOne = (node: StructureNode, path: readonly StructureNode[], context
|
|
|
182
190
|
|
|
183
191
|
const isRelative = (node: StructureNode): boolean => node.kind === "reference" && node.attrs["relative"] !== undefined;
|
|
184
192
|
|
|
185
|
-
/**
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
/** 相対の参照に番地を決めて、その番地を覚える。決まらなければ木から外す(undefined)。 */
|
|
194
|
+
const resolvedReference = (node: StructureNode, path: readonly StructureNode[], context: Context): StructureNode | undefined => {
|
|
195
|
+
const resolved = resolveOne(node, path, context);
|
|
196
|
+
if (resolved === undefined) return undefined;
|
|
197
|
+
const reference = lastOf(resolved);
|
|
198
|
+
context.byStart.set(node.span.start, reference);
|
|
199
|
+
remember(context, reference, Number(node.attrs["names"] ?? node.attrs["level"]));
|
|
200
|
+
return resolved;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/** 番地を名指した参照の番地を覚える。 */
|
|
204
|
+
const noteReference = (node: StructureNode, context: Context): void => {
|
|
205
|
+
if (node.kind !== "reference") return;
|
|
206
|
+
const reference = lastOf(node);
|
|
207
|
+
context.byStart.set(node.span.start, reference);
|
|
208
|
+
remember(context, reference, context.articleLevel ?? 0);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/** 子を読んでいる節点。next は次に読む子。 */
|
|
212
|
+
type Visit = { readonly node: StructureNode; readonly kept: StructureNode[]; next: number };
|
|
213
|
+
|
|
214
|
+
/** 読み終えた節点を、残した子で作り直して親に渡す。親が無ければ(根なら)それを返す。 */
|
|
215
|
+
const close = (visits: Visit[]): StructureNode | undefined => {
|
|
216
|
+
const visit = visits.pop();
|
|
217
|
+
if (visit === undefined) return undefined;
|
|
218
|
+
const rebuilt = { ...visit.node, children: visit.kept };
|
|
219
|
+
const parent = visits.at(-1);
|
|
220
|
+
if (parent === undefined) return rebuilt;
|
|
221
|
+
parent.kept.push(rebuilt);
|
|
222
|
+
return undefined;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/** 文書の順に読み、参照ごとに「その前の参照」を覚える。相対の参照は置き換えて、その中は読まない。 */
|
|
226
|
+
const walk = (tree: StructureNode, context: Context): StructureNode | undefined => {
|
|
227
|
+
if (isRelative(tree)) return resolvedReference(tree, [], context);
|
|
228
|
+
noteReference(tree, context);
|
|
229
|
+
const visits: Visit[] = [{ node: tree, kept: [], next: 0 }];
|
|
230
|
+
while (visits.length > 0) {
|
|
231
|
+
const visit = visits.at(-1);
|
|
232
|
+
const child = visit?.node.children[visit.next];
|
|
233
|
+
if (visit === undefined || child === undefined) {
|
|
234
|
+
const root = close(visits);
|
|
235
|
+
if (root !== undefined) return root;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
visit.next += 1;
|
|
239
|
+
if (isRelative(child)) {
|
|
240
|
+
const resolved = resolvedReference(
|
|
241
|
+
child,
|
|
242
|
+
visits.map((open) => open.node),
|
|
243
|
+
context,
|
|
244
|
+
);
|
|
245
|
+
if (resolved !== undefined) visit.kept.push(resolved);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
noteReference(child, context);
|
|
249
|
+
visits.push({ node: child, kept: [], next: 0 });
|
|
199
250
|
}
|
|
200
|
-
|
|
201
|
-
const children = node.children.flatMap((child) => {
|
|
202
|
-
const kept = walk(child, inside, context);
|
|
203
|
-
return kept === undefined ? [] : [kept];
|
|
204
|
-
});
|
|
205
|
-
return { ...node, children };
|
|
251
|
+
return undefined;
|
|
206
252
|
};
|
|
207
253
|
|
|
208
254
|
const optional = (value: string | number | undefined): string | undefined => (value === undefined ? undefined : String(value));
|
|
@@ -213,12 +259,13 @@ const lastOf = (reference: StructureNode): Last => ({
|
|
|
213
259
|
unitWord: optional(reference.attrs["unitWord"]),
|
|
214
260
|
});
|
|
215
261
|
|
|
216
|
-
const articlesOf = (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
262
|
+
const articlesOf = (root: StructureNode): Place[] =>
|
|
263
|
+
preOrder(root).flatMap((node) => {
|
|
264
|
+
const place = node.kind === "article" ? placeOf(node) : undefined;
|
|
265
|
+
return place === undefined ? [] : [place];
|
|
266
|
+
});
|
|
220
267
|
|
|
221
268
|
export const resolveRelative = (tree: StructureNode, implicitLevel: number | undefined): StructureNode => {
|
|
222
269
|
const articles = articlesOf(tree);
|
|
223
|
-
return walk(tree,
|
|
270
|
+
return walk(tree, { articles, articleLevel: articles[0]?.level, implicitLevel, last: new Map(), byStart: new Map() }) ?? tree;
|
|
224
271
|
};
|
package/src/structure/runs.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
type Kind = "list" | "table";
|
|
6
6
|
|
|
7
7
|
const LIST_ITEM = /^[ \t]{0,12}(?:[-*+]|\d{1,3}[.)])[ \t]/u;
|
|
8
|
-
const TABLE_ROW = /^[ \t]{0,12}\|/u;
|
|
8
|
+
export const TABLE_ROW = /^[ \t]{0,12}\|/u;
|
|
9
9
|
|
|
10
|
-
const TABLE_RULE = /^[ \t]{0,12}\|?[ \t]{0,4}:?-{3,}/u;
|
|
10
|
+
export const TABLE_RULE = /^[ \t]{0,12}\|?[ \t]{0,4}:?-{3,}/u;
|
|
11
11
|
const INDENT = /^[ \t]*/u;
|
|
12
12
|
|
|
13
13
|
export type Line = { readonly start: number; readonly end: number; readonly kind: Kind | undefined; readonly indent: number; readonly rule: boolean };
|
package/src/structure/sexp.ts
CHANGED
|
@@ -20,9 +20,21 @@ const keywords = (node: StructureNode): string[] => [
|
|
|
20
20
|
* 木を S 式にする。人と AI が読むための形で、JSON と同じ木から作る。
|
|
21
21
|
* `(kind "番地" :key value ... 子)`。番地を持たない葉は番地を書かない。
|
|
22
22
|
*/
|
|
23
|
-
export const toSexp = (
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
23
|
+
export const toSexp = (root: StructureNode, indent = ""): string => {
|
|
24
|
+
const lines: string[] = [];
|
|
25
|
+
// 1 行に 1 節点。節点を閉じる ")" は、その部分木の最後の行の後ろに付く。
|
|
26
|
+
const pending = [{ node: root, depth: 0, closing: false }];
|
|
27
|
+
while (pending.length > 0) {
|
|
28
|
+
const next = pending.pop();
|
|
29
|
+
if (next === undefined) break;
|
|
30
|
+
if (next.closing) {
|
|
31
|
+
lines.push(`${lines.pop() ?? ""})`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const head = [next.node.kind, ...(next.node.address === "" ? [] : [quote(next.node.address)]), ...keywords(next.node)].join(" ");
|
|
35
|
+
lines.push(`${indent}${" ".repeat(next.depth)}(${head}`);
|
|
36
|
+
pending.push({ ...next, closing: true });
|
|
37
|
+
next.node.children.toReversed().forEach((child) => pending.push({ node: child, depth: next.depth + 1, closing: false }));
|
|
38
|
+
}
|
|
39
|
+
return lines.join("\n");
|
|
28
40
|
};
|
package/src/structure/total.ts
CHANGED
|
@@ -27,7 +27,7 @@ type Cell = { readonly column: number; readonly unit: string };
|
|
|
27
27
|
type Placed = Amount & Cell & { readonly cents: number | undefined };
|
|
28
28
|
type Entry = { readonly label: boolean; readonly amounts: readonly Placed[] };
|
|
29
29
|
|
|
30
|
-
const columnOf = (source: string, line: Line, offset: number): number => source.slice(line.start, offset).split(CELL_SEPARATOR).length - 1;
|
|
30
|
+
export const columnOf = (source: string, line: Line, offset: number): number => source.slice(line.start, offset).split(CELL_SEPARATOR).length - 1;
|
|
31
31
|
|
|
32
32
|
const isNegative = (source: string, line: Line, amount: Amount): boolean => {
|
|
33
33
|
const before = source.slice(line.start, amount.offset);
|
|
@@ -48,7 +48,7 @@ const leadingText = (text: string): string =>
|
|
|
48
48
|
*/
|
|
49
49
|
const AFTER_LABEL = /^[*_]*[ \t\u3000]*(?:$|[::|((]|[-−▲△$€£¥¥\p{N}])/u;
|
|
50
50
|
|
|
51
|
-
const isTotalLabel = (text: string, labels: readonly string[]): boolean => {
|
|
51
|
+
export const isTotalLabel = (text: string, labels: readonly string[]): boolean => {
|
|
52
52
|
const lead = leadingText(text).toLowerCase();
|
|
53
53
|
return labels.some((label) => lead.startsWith(label.toLowerCase()) && AFTER_LABEL.test(lead.slice(label.length)));
|
|
54
54
|
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type { NumberedLine, NumberingContext } from "../plugin.ts";
|
|
1
|
+
import type { NumberedLine, NumberingContext, StructurePatterns } from "../plugin.ts";
|
|
2
|
+
import { numberInSentence } from "./number-in-sentence.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 「4.2 設定」「3.1.4 Scope」のような通し番号。数字と点だけで書くので言語を問わない。
|
|
5
6
|
* 各部分を 3 桁・深さを 6 までに抑え、後戻りが爆発しない形にしてある。
|
|
6
7
|
*/
|
|
7
|
-
const DOTTED = /^[ \t]{0,3}(?<number>\d{1,3}(?:\.\d{1,3}){0,5})
|
|
8
|
+
const DOTTED = /^[ \t]{0,3}(?<number>\d{1,3}(?:\.\d{1,3}){0,5})(?<closing>[..])?[ \t\u3000]+(?<rest>\S.*)$/u;
|
|
9
|
+
/**
|
|
10
|
+
* 見出しで、点で閉じた番号に題を詰めて書いたもの(「7.委託」「7.委託」「2.Overview」)。後ろが数字なら小数(「1.5万人」)、
|
|
11
|
+
* 小文字なら版(「2.x 系」)なので読まない。
|
|
12
|
+
*/
|
|
13
|
+
const TIGHT_HEADING = /^[ \t]{0,3}(?<number>\d{1,3}(?:\.\d{1,3}){0,5})(?<closing>[..])(?<rest>[^\s\d\p{Ll}..].*)$/u;
|
|
8
14
|
|
|
9
15
|
/**
|
|
10
16
|
* RFC のようなテキストの仕様書(Markdown でないもの)の章見出し「5. Security Considerations」。Markdown では、行内のコードを伏せた空白が
|
|
@@ -17,16 +23,38 @@ const MAX_TITLE = 80;
|
|
|
17
23
|
|
|
18
24
|
const isTopSection = (line: string, rest: string): boolean => TOP_SECTION.test(line) && rest.length <= MAX_TITLE && !SENTENCE_END.test(rest);
|
|
19
25
|
|
|
26
|
+
const dottedGroups = (line: string, context: NumberingContext): Readonly<Record<string, string | undefined>> | undefined =>
|
|
27
|
+
DOTTED.exec(line)?.groups ?? (context.isHeading ? TIGHT_HEADING.exec(line)?.groups : undefined);
|
|
28
|
+
|
|
29
|
+
/** closedByDot: 番号を点で閉じたか(「5. 」)。「1.5 万人」の 1.5 は閉じていない。 */
|
|
30
|
+
type DottedLine = NumberedLine & { readonly closedByDot: boolean };
|
|
31
|
+
|
|
20
32
|
/**
|
|
21
33
|
* 本文の「1. 」は箇条書きで、見出しの「1. 」は章番号。点を含まない番号は、見出しの行か、テキストの章見出しの形でだけ読む。
|
|
22
34
|
* 「4.2 」のように点を含むものは、.txt の仕様書でも見出しとして書かれるので本文でも読む。
|
|
23
35
|
*/
|
|
24
|
-
export const dottedNumber = (line: string, context: NumberingContext, plainText = false):
|
|
25
|
-
const groups =
|
|
36
|
+
export const dottedNumber = (line: string, context: NumberingContext, plainText = false): DottedLine | undefined => {
|
|
37
|
+
const groups = dottedGroups(line, context);
|
|
26
38
|
const number = groups?.["number"];
|
|
27
39
|
if (number === undefined) return undefined;
|
|
28
40
|
const depth = number.split(".").length;
|
|
29
41
|
const rest = groups?.["rest"]?.trim() ?? "";
|
|
30
42
|
if (depth < 2 && !context.isHeading && !(plainText && isTopSection(line, rest))) return undefined;
|
|
31
|
-
|
|
43
|
+
const closedByDot = groups?.["closing"] !== undefined;
|
|
44
|
+
return { kind: "article", depth, number, absolute: true, label: number, heading: rest, rest, ordinal: Number(number.split(".").at(-1)), closedByDot };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 番号の後ろが単位なら数量(「1.5 万人」「2.5 days」)。点で閉じた番号(「5. ページ自身の通信」「2. Days off」)は札で、
|
|
49
|
+
* 数量はそう書かないので、後ろに単位の語が来ても数量にしない。
|
|
50
|
+
*/
|
|
51
|
+
export const isAmount = (dotted: DottedLine, countedAfter: StructurePatterns["countedAfter"]): boolean =>
|
|
52
|
+
!dotted.closedByDot && countedAfter?.(dotted.number, dotted.rest) === true;
|
|
53
|
+
|
|
54
|
+
/** 言語を問わない通し番号。後ろが単位なら数量、本文の文の続きなら文の中の数なので、番号にしない。 */
|
|
55
|
+
export const universalNumber = (patterns: StructurePatterns, text: string, context: NumberingContext, plainText: boolean): NumberedLine | undefined => {
|
|
56
|
+
const dotted = dottedNumber(text, context, plainText);
|
|
57
|
+
if (dotted === undefined || isAmount(dotted, patterns.countedAfter)) return undefined;
|
|
58
|
+
const numbered = { number: dotted.number, rest: dotted.rest, isHeading: context.isHeading };
|
|
59
|
+
return numberInSentence(numbered, patterns.continuesSentence) ? undefined : dotted;
|
|
32
60
|
};
|