chaffjs 0.20.0 → 0.22.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 +7 -5
- package/dist/api.d.ts +16 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/cli-text.d.ts +2 -0
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +18 -5
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -11
- package/dist/cli.js.map +1 -1
- package/dist/command-help.d.ts +7 -0
- package/dist/command-help.d.ts.map +1 -0
- package/dist/command-help.js +18 -0
- package/dist/command-help.js.map +1 -0
- package/dist/commands/eval.js +2 -2
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +11 -1
- package/dist/commands/fix-plan.js.map +1 -1
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +7 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/init-command.d.ts +4 -0
- package/dist/commands/init-command.d.ts.map +1 -0
- package/dist/commands/init-command.js +15 -0
- package/dist/commands/init-command.js.map +1 -0
- package/dist/commands/plugin-init.d.ts +20 -0
- package/dist/commands/plugin-init.d.ts.map +1 -0
- package/dist/commands/plugin-init.js +129 -0
- package/dist/commands/plugin-init.js.map +1 -0
- package/dist/commands/plugin-test.d.ts +11 -0
- package/dist/commands/plugin-test.d.ts.map +1 -0
- package/dist/commands/plugin-test.js +81 -0
- package/dist/commands/plugin-test.js.map +1 -0
- package/dist/config/load.d.ts +2 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +1 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.js +2 -2
- package/dist/config/option-problems.js.map +1 -1
- package/dist/config/rule-problems.js +2 -2
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/custom/checked.d.ts +9 -0
- package/dist/custom/checked.d.ts.map +1 -0
- package/dist/custom/checked.js +3 -0
- package/dist/custom/checked.js.map +1 -0
- package/dist/custom/dsl-fields.d.ts +27 -0
- package/dist/custom/dsl-fields.d.ts.map +1 -0
- package/dist/custom/dsl-fields.js +86 -0
- package/dist/custom/dsl-fields.js.map +1 -0
- package/dist/custom/load.d.ts.map +1 -1
- package/dist/custom/load.js +2 -0
- package/dist/custom/load.js.map +1 -1
- package/dist/custom/parse.d.ts +14 -3
- package/dist/custom/parse.d.ts.map +1 -1
- package/dist/custom/parse.js +44 -40
- package/dist/custom/parse.js.map +1 -1
- package/dist/custom/problems.d.ts.map +1 -1
- package/dist/custom/problems.js +10 -1
- package/dist/custom/problems.js.map +1 -1
- package/dist/detectors/amount-for-count.d.ts +21 -0
- package/dist/detectors/amount-for-count.d.ts.map +1 -0
- package/dist/detectors/amount-for-count.js +55 -0
- package/dist/detectors/amount-for-count.js.map +1 -0
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +6 -4
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +22 -0
- package/dist/detectors/clause-shape.d.ts.map +1 -0
- package/dist/detectors/clause-shape.js +149 -0
- package/dist/detectors/clause-shape.js.map +1 -0
- package/dist/detectors/code-fences.d.ts +34 -0
- package/dist/detectors/code-fences.d.ts.map +1 -0
- package/dist/detectors/code-fences.js +100 -0
- package/dist/detectors/code-fences.js.map +1 -0
- package/dist/detectors/cross-definitions.d.ts +4 -0
- package/dist/detectors/cross-definitions.d.ts.map +1 -0
- package/dist/detectors/cross-definitions.js +43 -0
- package/dist/detectors/cross-definitions.js.map +1 -0
- package/dist/detectors/cross-facts.d.ts +4 -0
- package/dist/detectors/cross-facts.d.ts.map +1 -0
- package/dist/detectors/cross-facts.js +53 -0
- package/dist/detectors/cross-facts.js.map +1 -0
- package/dist/detectors/cross-registry/cross-doc-duplicate-definition.d.ts +3 -0
- package/dist/detectors/cross-registry/cross-doc-duplicate-definition.d.ts.map +1 -0
- package/dist/detectors/cross-registry/cross-doc-duplicate-definition.js +3 -0
- package/dist/detectors/cross-registry/cross-doc-duplicate-definition.js.map +1 -0
- package/dist/detectors/cross-registry/cross-doc-fact-conflict.d.ts +3 -0
- package/dist/detectors/cross-registry/cross-doc-fact-conflict.d.ts.map +1 -0
- package/dist/detectors/cross-registry/cross-doc-fact-conflict.js +3 -0
- package/dist/detectors/cross-registry/cross-doc-fact-conflict.js.map +1 -0
- package/dist/detectors/currency-notation.d.ts +29 -0
- package/dist/detectors/currency-notation.d.ts.map +1 -0
- package/dist/detectors/currency-notation.js +58 -0
- package/dist/detectors/currency-notation.js.map +1 -0
- package/dist/detectors/custom.d.ts.map +1 -1
- package/dist/detectors/custom.js +4 -1
- package/dist/detectors/custom.js.map +1 -1
- package/dist/detectors/dangling-opener.d.ts +14 -0
- package/dist/detectors/dangling-opener.d.ts.map +1 -0
- package/dist/detectors/dangling-opener.js +55 -0
- package/dist/detectors/dangling-opener.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts +25 -0
- package/dist/detectors/defined-term-form.d.ts.map +1 -0
- package/dist/detectors/defined-term-form.js +170 -0
- package/dist/detectors/defined-term-form.js.map +1 -0
- package/dist/detectors/email-letter.d.ts +46 -0
- package/dist/detectors/email-letter.d.ts.map +1 -0
- package/dist/detectors/email-letter.js +234 -0
- package/dist/detectors/email-letter.js.map +1 -0
- package/dist/detectors/footnote-mismatch.d.ts +11 -0
- package/dist/detectors/footnote-mismatch.d.ts.map +1 -0
- package/dist/detectors/footnote-mismatch.js +55 -0
- package/dist/detectors/footnote-mismatch.js.map +1 -0
- package/dist/detectors/form-minority.d.ts +13 -0
- package/dist/detectors/form-minority.d.ts.map +1 -0
- package/dist/detectors/form-minority.js +19 -0
- package/dist/detectors/form-minority.js.map +1 -0
- package/dist/detectors/heading-end-mark.d.ts +10 -0
- package/dist/detectors/heading-end-mark.d.ts.map +1 -0
- package/dist/detectors/heading-end-mark.js +59 -0
- package/dist/detectors/heading-end-mark.js.map +1 -0
- package/dist/detectors/impossible-date.d.ts +20 -0
- package/dist/detectors/impossible-date.d.ts.map +1 -0
- package/dist/detectors/impossible-date.js +105 -0
- package/dist/detectors/impossible-date.js.map +1 -0
- package/dist/detectors/impossible-time.d.ts +18 -0
- package/dist/detectors/impossible-time.d.ts.map +1 -0
- package/dist/detectors/impossible-time.js +116 -0
- package/dist/detectors/impossible-time.js.map +1 -0
- package/dist/detectors/link-shape.d.ts +11 -0
- package/dist/detectors/link-shape.d.ts.map +1 -0
- package/dist/detectors/link-shape.js +56 -0
- package/dist/detectors/link-shape.js.map +1 -0
- package/dist/detectors/list-marker.d.ts +7 -0
- package/dist/detectors/list-marker.d.ts.map +1 -0
- package/dist/detectors/list-marker.js +50 -0
- package/dist/detectors/list-marker.js.map +1 -0
- package/dist/detectors/mark-shape.d.ts +53 -0
- package/dist/detectors/mark-shape.d.ts.map +1 -0
- package/dist/detectors/mark-shape.js +160 -0
- package/dist/detectors/mark-shape.js.map +1 -0
- package/dist/detectors/markdown-slip.d.ts +19 -0
- package/dist/detectors/markdown-slip.d.ts.map +1 -0
- package/dist/detectors/markdown-slip.js +122 -0
- package/dist/detectors/markdown-slip.js.map +1 -0
- package/dist/detectors/numeral-opener.d.ts +10 -0
- package/dist/detectors/numeral-opener.d.ts.map +1 -0
- package/dist/detectors/numeral-opener.js +65 -0
- package/dist/detectors/numeral-opener.js.map +1 -0
- package/dist/detectors/ordinal-suffix.d.ts +12 -0
- package/dist/detectors/ordinal-suffix.d.ts.map +1 -0
- package/dist/detectors/ordinal-suffix.js +33 -0
- package/dist/detectors/ordinal-suffix.js.map +1 -0
- package/dist/detectors/range-notation.d.ts +15 -0
- package/dist/detectors/range-notation.d.ts.map +1 -0
- package/dist/detectors/range-notation.js +58 -0
- package/dist/detectors/range-notation.js.map +1 -0
- package/dist/detectors/registry/adverb-polarity.d.ts +3 -0
- package/dist/detectors/registry/adverb-polarity.d.ts.map +1 -0
- package/dist/detectors/registry/adverb-polarity.js +3 -0
- package/dist/detectors/registry/adverb-polarity.js.map +1 -0
- package/dist/detectors/registry/amount-for-count.d.ts +3 -0
- package/dist/detectors/registry/amount-for-count.d.ts.map +1 -0
- package/dist/detectors/registry/amount-for-count.js +3 -0
- package/dist/detectors/registry/amount-for-count.js.map +1 -0
- package/dist/detectors/registry/attachment-missing.d.ts +3 -0
- package/dist/detectors/registry/attachment-missing.d.ts.map +1 -0
- package/dist/detectors/registry/attachment-missing.js +3 -0
- package/dist/detectors/registry/attachment-missing.js.map +1 -0
- package/dist/detectors/registry/bare-url-mix.d.ts +3 -0
- package/dist/detectors/registry/bare-url-mix.d.ts.map +1 -0
- package/dist/detectors/registry/bare-url-mix.js +3 -0
- package/dist/detectors/registry/bare-url-mix.js.map +1 -0
- package/dist/detectors/registry/caps-shouting.d.ts +3 -0
- package/dist/detectors/registry/caps-shouting.d.ts.map +1 -0
- package/dist/detectors/registry/caps-shouting.js +3 -0
- package/dist/detectors/registry/caps-shouting.js.map +1 -0
- package/dist/detectors/registry/code-fence-language.d.ts +3 -0
- package/dist/detectors/registry/code-fence-language.d.ts.map +1 -0
- package/dist/detectors/registry/code-fence-language.js +3 -0
- package/dist/detectors/registry/code-fence-language.js.map +1 -0
- package/dist/detectors/registry/currency-notation.d.ts +3 -0
- package/dist/detectors/registry/currency-notation.d.ts.map +1 -0
- package/dist/detectors/registry/currency-notation.js +3 -0
- package/dist/detectors/registry/currency-notation.js.map +1 -0
- package/dist/detectors/registry/dangling-opener.d.ts +3 -0
- package/dist/detectors/registry/dangling-opener.d.ts.map +1 -0
- package/dist/detectors/registry/dangling-opener.js +3 -0
- package/dist/detectors/registry/dangling-opener.js.map +1 -0
- package/dist/detectors/registry/defined-name-repeated.d.ts +3 -0
- package/dist/detectors/registry/defined-name-repeated.d.ts.map +1 -0
- package/dist/detectors/registry/defined-name-repeated.js +3 -0
- package/dist/detectors/registry/defined-name-repeated.js.map +1 -0
- package/dist/detectors/registry/defined-term-form.d.ts +3 -0
- package/dist/detectors/registry/defined-term-form.d.ts.map +1 -0
- package/dist/detectors/registry/defined-term-form.js +3 -0
- package/dist/detectors/registry/defined-term-form.js.map +1 -0
- package/dist/detectors/registry/email-frame.d.ts +3 -0
- package/dist/detectors/registry/email-frame.d.ts.map +1 -0
- package/dist/detectors/registry/email-frame.js +3 -0
- package/dist/detectors/registry/email-frame.js.map +1 -0
- package/dist/detectors/registry/email-subject.d.ts +3 -0
- package/dist/detectors/registry/email-subject.d.ts.map +1 -0
- package/dist/detectors/registry/email-subject.js +3 -0
- package/dist/detectors/registry/email-subject.js.map +1 -0
- package/dist/detectors/registry/ending-run.d.ts +3 -0
- package/dist/detectors/registry/ending-run.d.ts.map +1 -0
- package/dist/detectors/registry/ending-run.js +3 -0
- package/dist/detectors/registry/ending-run.js.map +1 -0
- package/dist/detectors/registry/footnote-mismatch.d.ts +3 -0
- package/dist/detectors/registry/footnote-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/footnote-mismatch.js +3 -0
- package/dist/detectors/registry/footnote-mismatch.js.map +1 -0
- package/dist/detectors/registry/heading-command.d.ts +3 -0
- package/dist/detectors/registry/heading-command.d.ts.map +1 -0
- package/dist/detectors/registry/heading-command.js +3 -0
- package/dist/detectors/registry/heading-command.js.map +1 -0
- package/dist/detectors/registry/heading-end-punctuation.d.ts +3 -0
- package/dist/detectors/registry/heading-end-punctuation.d.ts.map +1 -0
- package/dist/detectors/registry/heading-end-punctuation.js +3 -0
- package/dist/detectors/registry/heading-end-punctuation.js.map +1 -0
- package/dist/detectors/registry/hyphen-dash.d.ts +3 -0
- package/dist/detectors/registry/hyphen-dash.d.ts.map +1 -0
- package/dist/detectors/registry/hyphen-dash.js +3 -0
- package/dist/detectors/registry/hyphen-dash.js.map +1 -0
- package/dist/detectors/registry/image-file-name-alt.d.ts +3 -0
- package/dist/detectors/registry/image-file-name-alt.d.ts.map +1 -0
- package/dist/detectors/registry/image-file-name-alt.js +3 -0
- package/dist/detectors/registry/image-file-name-alt.js.map +1 -0
- package/dist/detectors/registry/impossible-date.d.ts +3 -0
- package/dist/detectors/registry/impossible-date.d.ts.map +1 -0
- package/dist/detectors/registry/impossible-date.js +3 -0
- package/dist/detectors/registry/impossible-date.js.map +1 -0
- package/dist/detectors/registry/impossible-time.d.ts +3 -0
- package/dist/detectors/registry/impossible-time.d.ts.map +1 -0
- package/dist/detectors/registry/impossible-time.js +3 -0
- package/dist/detectors/registry/impossible-time.js.map +1 -0
- package/dist/detectors/registry/latin-abbreviation.d.ts +3 -0
- package/dist/detectors/registry/latin-abbreviation.d.ts.map +1 -0
- package/dist/detectors/registry/latin-abbreviation.js +3 -0
- package/dist/detectors/registry/latin-abbreviation.js.map +1 -0
- package/dist/detectors/registry/link-text-url-mismatch.d.ts +3 -0
- package/dist/detectors/registry/link-text-url-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/link-text-url-mismatch.js +3 -0
- package/dist/detectors/registry/link-text-url-mismatch.js.map +1 -0
- package/dist/detectors/registry/list-marker.d.ts +3 -0
- package/dist/detectors/registry/list-marker.d.ts.map +1 -0
- package/dist/detectors/registry/list-marker.js +3 -0
- package/dist/detectors/registry/list-marker.js.map +1 -0
- package/dist/detectors/registry/mark-consistency.d.ts +3 -0
- package/dist/detectors/registry/mark-consistency.d.ts.map +1 -0
- package/dist/detectors/registry/mark-consistency.js +3 -0
- package/dist/detectors/registry/mark-consistency.js.map +1 -0
- package/dist/detectors/registry/numeral-opener.d.ts +3 -0
- package/dist/detectors/registry/numeral-opener.d.ts.map +1 -0
- package/dist/detectors/registry/numeral-opener.js +3 -0
- package/dist/detectors/registry/numeral-opener.js.map +1 -0
- package/dist/detectors/registry/ordinal-suffix.d.ts +3 -0
- package/dist/detectors/registry/ordinal-suffix.d.ts.map +1 -0
- package/dist/detectors/registry/ordinal-suffix.js +3 -0
- package/dist/detectors/registry/ordinal-suffix.js.map +1 -0
- package/dist/detectors/registry/origin-particle.d.ts +3 -0
- package/dist/detectors/registry/origin-particle.d.ts.map +1 -0
- package/dist/detectors/registry/origin-particle.js +3 -0
- package/dist/detectors/registry/origin-particle.js.map +1 -0
- package/dist/detectors/registry/range-notation.d.ts +3 -0
- package/dist/detectors/registry/range-notation.d.ts.map +1 -0
- package/dist/detectors/registry/range-notation.js +3 -0
- package/dist/detectors/registry/range-notation.js.map +1 -0
- package/dist/detectors/registry/relative-pronoun-mix.d.ts +3 -0
- package/dist/detectors/registry/relative-pronoun-mix.d.ts.map +1 -0
- package/dist/detectors/registry/relative-pronoun-mix.js +3 -0
- package/dist/detectors/registry/relative-pronoun-mix.js.map +1 -0
- package/dist/detectors/registry/request-without-deadline.d.ts +3 -0
- package/dist/detectors/registry/request-without-deadline.d.ts.map +1 -0
- package/dist/detectors/registry/request-without-deadline.js +3 -0
- package/dist/detectors/registry/request-without-deadline.js.map +1 -0
- package/dist/detectors/registry/sentence-spacing.d.ts +3 -0
- package/dist/detectors/registry/sentence-spacing.d.ts.map +1 -0
- package/dist/detectors/registry/sentence-spacing.js +3 -0
- package/dist/detectors/registry/sentence-spacing.js.map +1 -0
- package/dist/detectors/registry/share-over-hundred.d.ts +3 -0
- package/dist/detectors/registry/share-over-hundred.d.ts.map +1 -0
- package/dist/detectors/registry/share-over-hundred.js +3 -0
- package/dist/detectors/registry/share-over-hundred.js.map +1 -0
- package/dist/detectors/registry/shell-prompt.d.ts +3 -0
- package/dist/detectors/registry/shell-prompt.d.ts.map +1 -0
- package/dist/detectors/registry/shell-prompt.js +3 -0
- package/dist/detectors/registry/shell-prompt.js.map +1 -0
- package/dist/detectors/registry/step-reference.d.ts +3 -0
- package/dist/detectors/registry/step-reference.d.ts.map +1 -0
- package/dist/detectors/registry/step-reference.js +3 -0
- package/dist/detectors/registry/step-reference.js.map +1 -0
- package/dist/detectors/registry/step-statement.d.ts +3 -0
- package/dist/detectors/registry/step-statement.d.ts.map +1 -0
- package/dist/detectors/registry/step-statement.js +3 -0
- package/dist/detectors/registry/step-statement.js.map +1 -0
- package/dist/detectors/registry/table-row-overflow.d.ts +3 -0
- package/dist/detectors/registry/table-row-overflow.d.ts.map +1 -0
- package/dist/detectors/registry/table-row-overflow.js +3 -0
- package/dist/detectors/registry/table-row-overflow.js.map +1 -0
- package/dist/detectors/registry/toc-heading.d.ts +3 -0
- package/dist/detectors/registry/toc-heading.d.ts.map +1 -0
- package/dist/detectors/registry/toc-heading.js +3 -0
- package/dist/detectors/registry/toc-heading.js.map +1 -0
- package/dist/detectors/registry/unclosed-code-fence.d.ts +3 -0
- package/dist/detectors/registry/unclosed-code-fence.d.ts.map +1 -0
- package/dist/detectors/registry/unclosed-code-fence.js +3 -0
- package/dist/detectors/registry/unclosed-code-fence.js.map +1 -0
- package/dist/detectors/registry/unpaired-parallel.d.ts +3 -0
- package/dist/detectors/registry/unpaired-parallel.d.ts.map +1 -0
- package/dist/detectors/registry/unpaired-parallel.js +3 -0
- package/dist/detectors/registry/unpaired-parallel.js.map +1 -0
- package/dist/detectors/registry/unrendered-emphasis.d.ts +3 -0
- package/dist/detectors/registry/unrendered-emphasis.d.ts.map +1 -0
- package/dist/detectors/registry/unrendered-emphasis.js +3 -0
- package/dist/detectors/registry/unrendered-emphasis.js.map +1 -0
- package/dist/detectors/relative-pronoun-mix.d.ts +19 -0
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -0
- package/dist/detectors/relative-pronoun-mix.js +60 -0
- package/dist/detectors/relative-pronoun-mix.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +23 -0
- package/dist/detectors/request-owner.d.ts.map +1 -0
- package/dist/detectors/request-owner.js +110 -0
- package/dist/detectors/request-owner.js.map +1 -0
- package/dist/detectors/share-over-hundred.d.ts +20 -0
- package/dist/detectors/share-over-hundred.d.ts.map +1 -0
- package/dist/detectors/share-over-hundred.js +55 -0
- package/dist/detectors/share-over-hundred.js.map +1 -0
- package/dist/detectors/step-reference.d.ts +20 -0
- package/dist/detectors/step-reference.d.ts.map +1 -0
- package/dist/detectors/step-reference.js +57 -0
- package/dist/detectors/step-reference.js.map +1 -0
- package/dist/detectors/technical-docs.d.ts +32 -0
- package/dist/detectors/technical-docs.d.ts.map +1 -0
- package/dist/detectors/technical-docs.js +199 -0
- package/dist/detectors/technical-docs.js.map +1 -0
- package/dist/detectors/toc-heading.d.ts +10 -0
- package/dist/detectors/toc-heading.d.ts.map +1 -0
- package/dist/detectors/toc-heading.js +99 -0
- package/dist/detectors/toc-heading.js.map +1 -0
- package/dist/extension/pack-read.d.ts +21 -0
- package/dist/extension/pack-read.d.ts.map +1 -0
- package/dist/extension/pack-read.js +117 -0
- package/dist/extension/pack-read.js.map +1 -0
- package/dist/extension/plugin-load.d.ts.map +1 -1
- package/dist/extension/plugin-load.js +44 -10
- package/dist/extension/plugin-load.js.map +1 -1
- package/dist/extension/plugin-parse.d.ts.map +1 -1
- package/dist/extension/plugin-parse.js +10 -3
- package/dist/extension/plugin-parse.js.map +1 -1
- package/dist/facts/address-values.d.ts +5 -0
- package/dist/facts/address-values.d.ts.map +1 -0
- package/dist/facts/address-values.js +64 -0
- package/dist/facts/address-values.js.map +1 -0
- package/dist/facts/cross-facts.d.ts +20 -0
- package/dist/facts/cross-facts.d.ts.map +1 -0
- package/dist/facts/cross-facts.js +41 -0
- package/dist/facts/cross-facts.js.map +1 -0
- package/dist/fix-plan/chosen-depth.d.ts +10 -0
- package/dist/fix-plan/chosen-depth.d.ts.map +1 -0
- package/dist/fix-plan/chosen-depth.js +24 -0
- package/dist/fix-plan/chosen-depth.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +13 -4
- package/dist/fix-plan/mode.d.ts.map +1 -1
- package/dist/fix-plan/mode.js +38 -7
- package/dist/fix-plan/mode.js.map +1 -1
- package/dist/fix-plan/plan.d.ts +20 -0
- package/dist/fix-plan/plan.d.ts.map +1 -1
- package/dist/fix-plan/plan.js +23 -5
- package/dist/fix-plan/plan.js.map +1 -1
- package/dist/fix-plan/render.d.ts.map +1 -1
- package/dist/fix-plan/render.js +24 -0
- package/dist/fix-plan/render.js.map +1 -1
- package/dist/fix-plan/text.d.ts +8 -0
- package/dist/fix-plan/text.d.ts.map +1 -1
- package/dist/fix-plan/text.js +36 -10
- package/dist/fix-plan/text.js.map +1 -1
- package/dist/genre-load.d.ts +1 -1
- package/dist/genre-load.d.ts.map +1 -1
- package/dist/genre-load.js +7 -4
- package/dist/genre-load.js.map +1 -1
- package/dist/genre-parse.d.ts +6 -0
- package/dist/genre-parse.d.ts.map +1 -1
- package/dist/genre-parse.js +18 -0
- package/dist/genre-parse.js.map +1 -1
- package/dist/init.js +10 -10
- package/dist/init.js.map +1 -1
- package/dist/known-genres.d.ts +8 -0
- package/dist/known-genres.d.ts.map +1 -0
- package/dist/known-genres.js +17 -0
- package/dist/known-genres.js.map +1 -0
- package/dist/link-shape.d.ts +20 -0
- package/dist/link-shape.d.ts.map +1 -0
- package/dist/link-shape.js +58 -0
- package/dist/link-shape.js.map +1 -0
- package/dist/list-marks.d.ts +21 -0
- package/dist/list-marks.d.ts.map +1 -0
- package/dist/list-marks.js +82 -0
- package/dist/list-marks.js.map +1 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +15 -4
- package/dist/reasons.js.map +1 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +11 -2
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.js +1 -1
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +12 -3
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.js +6 -6
- package/dist/render/rules-table.js.map +1 -1
- package/dist/render/semantic.js +2 -2
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/suppressions.js +2 -2
- package/dist/render/suppressions.js.map +1 -1
- package/dist/rewrite-depth.d.ts +22 -0
- package/dist/rewrite-depth.d.ts.map +1 -0
- package/dist/rewrite-depth.js +42 -0
- package/dist/rewrite-depth.js.map +1 -0
- package/dist/rule-fields.d.ts +28 -0
- package/dist/rule-fields.d.ts.map +1 -0
- package/dist/rule-fields.js +85 -0
- package/dist/rule-fields.js.map +1 -0
- package/dist/rule-guide.d.ts +3 -0
- package/dist/rule-guide.d.ts.map +1 -1
- package/dist/rule-guide.js +6 -0
- package/dist/rule-guide.js.map +1 -1
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +13 -5
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-offs.d.ts +14 -0
- package/dist/rule-offs.d.ts.map +1 -0
- package/dist/rule-offs.js +45 -0
- package/dist/rule-offs.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +14 -1
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/cross-definitions.d.ts +23 -0
- package/dist/structure/cross-definitions.d.ts.map +1 -0
- package/dist/structure/cross-definitions.js +34 -0
- package/dist/structure/cross-definitions.js.map +1 -0
- package/genres.yaml +14 -313
- package/package.json +3 -3
- package/rules/absolute-exception.yaml +3 -1
- package/rules/abstract-length.yaml +7 -1
- package/rules/acronym-expansion-conflict.yaml +2 -1
- package/rules/adverb-overuse.yaml +7 -1
- package/rules/adverb-without-negation.yaml +60 -0
- package/rules/adversative-ga-repeat.yaml +2 -1
- package/rules/agentless-passive.yaml +10 -1
- package/rules/agreement-slip.yaml +4 -1
- package/rules/ai-generated-composite.yaml +6 -1
- package/rules/ai-structure.yaml +8 -2
- package/rules/ai-tell.yaml +7 -1
- package/rules/all-caps-shouting.yaml +61 -0
- package/rules/announced-count-mismatch.yaml +3 -1
- package/rules/announcing-opener.yaml +7 -1
- package/rules/article-sound.yaml +6 -2
- package/rules/assistant-residue.yaml +4 -1
- package/rules/attachment-not-attached.yaml +112 -0
- package/rules/baito-keigo.yaml +64 -0
- package/rules/bare-url-mix.yaml +86 -0
- package/rules/bold-density.yaml +1 -0
- package/rules/bold-label-list.yaml +9 -1
- package/rules/bracket-nesting.yaml +2 -1
- package/rules/bracket-width-consistency.yaml +64 -0
- package/rules/broken-link.yaml +1 -1
- package/rules/chat-citation-residue.yaml +2 -1
- package/rules/citation-reference-mismatch.yaml +7 -1
- package/rules/citation-style-mix.yaml +7 -1
- package/rules/clause-chain.yaml +6 -1
- package/rules/cliche.yaml +67 -0
- package/rules/closing-cliche.yaml +7 -0
- package/rules/code-fence-language-mix.yaml +176 -0
- package/rules/colloquial-opener.yaml +62 -0
- package/rules/colon-lead-in.yaml +7 -1
- package/rules/concrete-evidence-density.yaml +6 -0
- package/rules/contraction-consistency.yaml +4 -1
- package/rules/contrast-framing.yaml +7 -1
- package/rules/cross-doc-duplicate-definition.yaml +70 -0
- package/rules/cross-doc-fact-conflict.yaml +64 -0
- package/rules/currency-notation-consistency.yaml +77 -0
- package/rules/cushion-phrase-density.yaml +8 -1
- package/rules/dangling-figure-reference.yaml +3 -1
- package/rules/dangling-participle.yaml +58 -0
- package/rules/dangling-reference.yaml +3 -1
- package/rules/date-format-consistency.yaml +3 -2
- package/rules/date-order.yaml +3 -1
- package/rules/date-range-reversed.yaml +3 -1
- package/rules/date-weekday-mismatch.yaml +3 -1
- package/rules/date-without-year.yaml +4 -3
- package/rules/defined-name-repeated.yaml +97 -0
- package/rules/defined-term-form.yaml +113 -0
- package/rules/demonstrative-opener-run.yaml +2 -1
- package/rules/double-keigo.yaml +6 -1
- package/rules/double-negative.yaml +5 -1
- package/rules/doubled-nado.yaml +2 -1
- package/rules/doubled-punctuation.yaml +1 -1
- package/rules/doubled-word.yaml +4 -1
- package/rules/duplicate-definition.yaml +3 -1
- package/rules/duplicate-heading.yaml +1 -1
- package/rules/duration-mismatch.yaml +2 -1
- package/rules/elapsed-years-mismatch.yaml +4 -1
- package/rules/email-greeting-closing.yaml +122 -0
- package/rules/email-subject-length.yaml +112 -0
- package/rules/emoji-density.yaml +3 -1
- package/rules/emoji-heading.yaml +7 -1
- package/rules/empty-intensifier.yaml +4 -0
- package/rules/empty-list-item.yaml +2 -1
- package/rules/empty-section.yaml +1 -1
- package/rules/empty-table-cell.yaml +2 -1
- package/rules/excessive-hedging.yaml +7 -1
- package/rules/exclamation-width-consistency.yaml +64 -0
- package/rules/expletive-construction.yaml +7 -1
- package/rules/fact-conflict.yaml +4 -1
- package/rules/figure-reference-order.yaml +7 -1
- package/rules/footnote-mismatch.yaml +91 -0
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/hankaku-kana.yaml +1 -1
- package/rules/heading-command-missing.yaml +109 -0
- package/rules/heading-echo.yaml +6 -1
- package/rules/heading-end-punctuation-mix.yaml +158 -0
- package/rules/heading-level-skip.yaml +3 -3
- package/rules/heading-numbering-mix.yaml +4 -3
- package/rules/hiragana-fukushi.yaml +4 -1
- package/rules/homophone-slip.yaml +5 -1
- package/rules/humble-for-others.yaml +63 -0
- package/rules/hyphen-as-dash.yaml +59 -0
- package/rules/idiom-misuse.yaml +4 -1
- package/rules/image-file-name-alt.yaml +83 -0
- package/rules/impossible-date.yaml +79 -0
- package/rules/impossible-time.yaml +76 -0
- package/rules/internal-jargon.yaml +1 -1
- package/rules/invisible-character.yaml +1 -1
- package/rules/katakana-density.yaml +2 -1
- package/rules/katakana-long-vowel.yaml +1 -1
- package/rules/known-misspelling.yaml +2 -1
- package/rules/kutoten-consistency.yaml +1 -1
- package/rules/latin-abbreviation-form.yaml +58 -0
- package/rules/latin-spacing.yaml +6 -2
- package/rules/less-for-fewer.yaml +59 -0
- package/rules/link-text-url-mismatch.yaml +72 -0
- package/rules/list-item-form-mix.yaml +7 -1
- package/rules/list-marker-mix.yaml +111 -0
- package/rules/max-kanji-continuous.yaml +10 -2
- package/rules/max-paragraph-length.yaml +4 -1
- package/rules/max-sentence-length.yaml +29 -21
- package/rules/max-ten.yaml +4 -1
- package/rules/misconversion.yaml +2 -1
- package/rules/modal-conflict.yaml +2 -1
- package/rules/name-variant.yaml +4 -3
- package/rules/ngram-repetition.yaml +5 -0
- package/rules/no-doubled-joshi.yaml +5 -1
- package/rules/no-em-dash.yaml +4 -1
- package/rules/no-lead.yaml +6 -1
- package/rules/no-mixed-desumasu.yaml +5 -2
- package/rules/no-nakaguro-parallel.yaml +3 -0
- package/rules/nominalization.yaml +5 -1
- package/rules/nonstandard-word.yaml +80 -0
- package/rules/number-style-consistency.yaml +6 -1
- package/rules/number-without-unit.yaml +2 -1
- package/rules/numbering-gap.yaml +1 -1
- package/rules/numeral-sentence-start.yaml +56 -0
- package/rules/one-sentence-paragraph-run.yaml +5 -1
- package/rules/ordinal-suffix-mismatch.yaml +65 -0
- package/rules/orthographic-variant.yaml +4 -1
- package/rules/outside-announced-list.yaml +2 -1
- package/rules/oxford-comma-consistency.yaml +3 -1
- package/rules/padded-intro.yaml +7 -0
- package/rules/paragraph-length-variance.yaml +7 -1
- package/rules/paragraph-restatement.yaml +6 -1
- package/rules/percent-sum-mismatch.yaml +3 -1
- package/rules/person-consistency.yaml +4 -1
- package/rules/preamble-length.yaml +6 -0
- package/rules/preferred-term.yaml +1 -1
- package/rules/proper-noun-density.yaml +8 -1
- package/rules/quote-style-consistency.yaml +66 -0
- package/rules/ra-nuki.yaml +4 -1
- package/rules/range-notation-consistency.yaml +73 -0
- package/rules/redundant-expression.yaml +4 -1
- package/rules/reference-title-mismatch.yaml +4 -3
- package/rules/reference-topic-missing.yaml +2 -1
- package/rules/relative-date-mismatch.yaml +2 -1
- package/rules/repeated-conjunction.yaml +4 -1
- package/rules/repeated-sentence-ending.yaml +62 -0
- package/rules/repeated-sentence-head.yaml +4 -0
- package/rules/request-without-deadline.yaml +92 -0
- package/rules/required-sections.yaml +1 -1
- package/rules/requirement-modal.yaml +1 -1
- package/rules/requirement-smell.yaml +12 -4
- package/rules/rule-of-three.yaml +8 -1
- package/rules/sasete-itadaku.yaml +7 -1
- package/rules/section-length-uniformity.yaml +7 -1
- package/rules/sentence-initial-conjunction-run.yaml +5 -1
- package/rules/sentence-initial-so.yaml +6 -1
- package/rules/sentence-rhythm.yaml +8 -1
- package/rules/sentence-spacing-consistency.yaml +63 -0
- package/rules/share-over-hundred.yaml +65 -0
- package/rules/shell-prompt-mix.yaml +128 -0
- package/rules/space-before-punctuation.yaml +1 -1
- package/rules/spelling-consistency.yaml +3 -1
- package/rules/step-reference-missing.yaml +85 -0
- package/rules/step-statement-mix.yaml +76 -0
- package/rules/stock-transition.yaml +8 -1
- package/rules/stray-space.yaml +2 -2
- package/rules/summary-fact-mismatch.yaml +4 -1
- package/rules/table-header-variant.yaml +2 -1
- package/rules/table-row-overflow.yaml +90 -0
- package/rules/taigen-dome-in-prose.yaml +6 -0
- package/rules/tari-unpaired.yaml +58 -0
- package/rules/teki-overuse.yaml +2 -1
- package/rules/title-case-consistency.yaml +1 -1
- package/rules/title-length.yaml +7 -1
- package/rules/toc-heading-mismatch.yaml +136 -0
- package/rules/topic-predicate-distance.yaml +6 -1
- package/rules/total-mismatch.yaml +3 -1
- package/rules/translationese-density.yaml +4 -1
- package/rules/unbalanced-bracket.yaml +3 -3
- package/rules/unclosed-code-fence.yaml +107 -0
- package/rules/uncomparable-graded.yaml +65 -0
- package/rules/undefined-acronym.yaml +8 -1
- package/rules/unfilled-placeholder.yaml +1 -1
- package/rules/unit-mismatch.yaml +2 -1
- package/rules/unknown-word.yaml +4 -1
- package/rules/unqualified-superlative.yaml +6 -1
- package/rules/unrendered-emphasis.yaml +73 -0
- package/rules/unused-definition.yaml +4 -3
- package/rules/url-run-on.yaml +1 -1
- package/rules/use-before-definition.yaml +4 -3
- package/rules/vague-figure-reference.yaml +3 -1
- package/rules/vague-link-text.yaml +2 -1
- package/rules/vague-word-density.yaml +2 -1
- package/rules/very-adjective.yaml +5 -1
- package/rules/weasel-word.yaml +6 -1
- package/rules/which-that-consistency.yaml +64 -0
- package/rules/wordy-phrase.yaml +6 -1
- package/rules/yori-as-from.yaml +61 -0
- package/skills/chaff/SKILL.md +7 -7
- package/src/api.ts +13 -1
- package/src/cli-text.ts +22 -7
- package/src/cli.ts +8 -9
- package/src/command-help.ts +26 -0
- package/src/commands/eval.ts +2 -2
- package/src/commands/fix-plan.ts +13 -1
- package/src/commands/help.ts +8 -0
- package/src/commands/init-command.ts +13 -0
- package/src/commands/plugin-init.ts +150 -0
- package/src/commands/plugin-test.ts +111 -0
- package/src/config/load.ts +3 -0
- package/src/config/option-problems.ts +2 -2
- package/src/config/rule-problems.ts +2 -2
- package/src/custom/checked.ts +8 -0
- package/src/custom/dsl-fields.ts +102 -0
- package/src/custom/load.ts +2 -0
- package/src/custom/parse.ts +72 -50
- package/src/custom/problems.ts +16 -2
- package/src/detectors/amount-for-count.ts +90 -0
- package/src/detectors/blank-structure.ts +12 -4
- package/src/detectors/clause-shape.ts +199 -0
- package/src/detectors/code-fences.ts +113 -0
- package/src/detectors/cross-definitions.ts +49 -0
- package/src/detectors/cross-facts.ts +60 -0
- package/src/detectors/cross-registry/cross-doc-duplicate-definition.ts +4 -0
- package/src/detectors/cross-registry/cross-doc-fact-conflict.ts +4 -0
- package/src/detectors/currency-notation.ts +90 -0
- package/src/detectors/custom.ts +10 -2
- package/src/detectors/dangling-opener.ts +74 -0
- package/src/detectors/defined-term-form.ts +200 -0
- package/src/detectors/email-letter.ts +262 -0
- package/src/detectors/footnote-mismatch.ts +72 -0
- package/src/detectors/form-minority.ts +21 -0
- package/src/detectors/heading-end-mark.ts +82 -0
- package/src/detectors/impossible-date.ts +141 -0
- package/src/detectors/impossible-time.ts +151 -0
- package/src/detectors/link-shape.ts +70 -0
- package/src/detectors/list-marker.ts +60 -0
- package/src/detectors/mark-shape.ts +202 -0
- package/src/detectors/markdown-slip.ts +140 -0
- package/src/detectors/numeral-opener.ts +72 -0
- package/src/detectors/ordinal-suffix.ts +40 -0
- package/src/detectors/range-notation.ts +76 -0
- package/src/detectors/registry/adverb-polarity.ts +4 -0
- package/src/detectors/registry/amount-for-count.ts +4 -0
- package/src/detectors/registry/attachment-missing.ts +4 -0
- package/src/detectors/registry/bare-url-mix.ts +4 -0
- package/src/detectors/registry/caps-shouting.ts +4 -0
- package/src/detectors/registry/code-fence-language.ts +4 -0
- package/src/detectors/registry/currency-notation.ts +4 -0
- package/src/detectors/registry/dangling-opener.ts +4 -0
- package/src/detectors/registry/defined-name-repeated.ts +4 -0
- package/src/detectors/registry/defined-term-form.ts +4 -0
- package/src/detectors/registry/email-frame.ts +4 -0
- package/src/detectors/registry/email-subject.ts +4 -0
- package/src/detectors/registry/ending-run.ts +4 -0
- package/src/detectors/registry/footnote-mismatch.ts +4 -0
- package/src/detectors/registry/heading-command.ts +4 -0
- package/src/detectors/registry/heading-end-punctuation.ts +4 -0
- package/src/detectors/registry/hyphen-dash.ts +4 -0
- package/src/detectors/registry/image-file-name-alt.ts +4 -0
- package/src/detectors/registry/impossible-date.ts +4 -0
- package/src/detectors/registry/impossible-time.ts +4 -0
- package/src/detectors/registry/latin-abbreviation.ts +4 -0
- package/src/detectors/registry/link-text-url-mismatch.ts +4 -0
- package/src/detectors/registry/list-marker.ts +4 -0
- package/src/detectors/registry/mark-consistency.ts +4 -0
- package/src/detectors/registry/numeral-opener.ts +4 -0
- package/src/detectors/registry/ordinal-suffix.ts +4 -0
- package/src/detectors/registry/origin-particle.ts +4 -0
- package/src/detectors/registry/range-notation.ts +4 -0
- package/src/detectors/registry/relative-pronoun-mix.ts +4 -0
- package/src/detectors/registry/request-without-deadline.ts +4 -0
- package/src/detectors/registry/sentence-spacing.ts +4 -0
- package/src/detectors/registry/share-over-hundred.ts +4 -0
- package/src/detectors/registry/shell-prompt.ts +4 -0
- package/src/detectors/registry/step-reference.ts +4 -0
- package/src/detectors/registry/step-statement.ts +4 -0
- package/src/detectors/registry/table-row-overflow.ts +4 -0
- package/src/detectors/registry/toc-heading.ts +4 -0
- package/src/detectors/registry/unclosed-code-fence.ts +4 -0
- package/src/detectors/registry/unpaired-parallel.ts +4 -0
- package/src/detectors/registry/unrendered-emphasis.ts +4 -0
- package/src/detectors/relative-pronoun-mix.ts +79 -0
- package/src/detectors/request-owner.ts +141 -0
- package/src/detectors/share-over-hundred.ts +75 -0
- package/src/detectors/step-reference.ts +83 -0
- package/src/detectors/technical-docs.ts +230 -0
- package/src/detectors/toc-heading.ts +125 -0
- package/src/extension/pack-read.ts +128 -0
- package/src/extension/plugin-load.ts +49 -9
- package/src/extension/plugin-parse.ts +10 -3
- package/src/facts/address-values.ts +74 -0
- package/src/facts/cross-facts.ts +54 -0
- package/src/fix-plan/chosen-depth.ts +28 -0
- package/src/fix-plan/mode.ts +57 -11
- package/src/fix-plan/plan.ts +37 -5
- package/src/fix-plan/render.ts +24 -0
- package/src/fix-plan/text.ts +47 -10
- package/src/genre-load.ts +7 -4
- package/src/genre-parse.ts +19 -0
- package/src/init.ts +10 -10
- package/src/known-genres.ts +19 -0
- package/src/link-shape.ts +62 -0
- package/src/list-marks.ts +106 -0
- package/src/reasons.ts +16 -4
- package/src/render/explain.ts +14 -2
- package/src/render/friendly.ts +1 -1
- package/src/render/rules-json.ts +14 -3
- package/src/render/rules-table.ts +6 -6
- package/src/render/semantic.ts +2 -2
- package/src/render/suppressions.ts +2 -2
- package/src/rewrite-depth.ts +60 -0
- package/src/rule-fields.ts +123 -0
- package/src/rule-guide.ts +9 -0
- package/src/rule-load.ts +10 -4
- package/src/rule-offs.ts +50 -0
- package/src/structure/build.ts +21 -1
- package/src/structure/cross-definitions.ts +60 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Detector, ProseDocument } from "../plugin.ts";
|
|
2
|
+
/** 時刻を読むのに要る語。before は時刻の前に書く午前・午後、after は後ろに書く AM・PM、units は時・分・秒の単位。 */
|
|
3
|
+
export type ClockWords = {
|
|
4
|
+
readonly before: readonly string[];
|
|
5
|
+
readonly after: readonly string[];
|
|
6
|
+
readonly units: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/** 時計に無い時刻 1 つ。reason は、午前・午後の付いた時が 12 を超える(hour)か、分か秒が 59 を超える(minute)か。 */
|
|
9
|
+
export type ImpossibleTime = {
|
|
10
|
+
readonly offset: number;
|
|
11
|
+
readonly written: string;
|
|
12
|
+
readonly reason: "hour" | "minute";
|
|
13
|
+
};
|
|
14
|
+
/** 文字列の中の、時計に無い時刻。重なる所に二つの形が当たれば、先の形(午前・午後の付いたもの)だけ。 */
|
|
15
|
+
export declare const impossibleTimes: (text: string, words: ClockWords) => ImpossibleTime[];
|
|
16
|
+
export declare const clockWordsOf: (doc: ProseDocument) => ClockWords;
|
|
17
|
+
export declare const impossibleTime: Detector;
|
|
18
|
+
//# sourceMappingURL=impossible-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impossible-time.d.ts","sourceRoot":"","sources":["../../src/detectors/impossible-time.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,aAAa,EAAE,MAAM,cAAc,CAAC;AAQrE,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEtI,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAC;AA+GvH,wDAAwD;AACxD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,OAAO,UAAU,KAAG,cAAc,EAItB,CAAC;AAK3D,eAAO,MAAM,YAAY,GAAI,KAAK,aAAa,KAAG,UAIhD,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,QAW5B,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { escapeRegExp } from "../orthography.js";
|
|
2
|
+
import { quoteAround } from "./quote-around.js";
|
|
3
|
+
const DIGIT = "[0-90-9]";
|
|
4
|
+
const COLON = "[::]";
|
|
5
|
+
/** 数の前後に来ない字。英字の語や番号の中(abc10:75、v10:75)は時刻ではない。日本語の字のすぐ後ろ(会議は10:75)は読む。 */
|
|
6
|
+
const NOT_AFTER_CLOCK = "(?<![A-Za-z0-90-9_::.])";
|
|
7
|
+
const NOT_BEFORE_CLOCK = "(?![A-Za-z0-90-9_::])";
|
|
8
|
+
const HALF_DAY = 12;
|
|
9
|
+
const MINUTES_IN_HOUR = 60;
|
|
10
|
+
/** 午前・午後の付いた時で、時刻の書き損じと読む上限。50 pm(ピコメートル)のような量を時刻と読まない。 */
|
|
11
|
+
const HOURS_IN_DAY = 24;
|
|
12
|
+
const FULLWIDTH_OFFSET = 0xfee0;
|
|
13
|
+
const halfWidth = (text) => text.replace(/[0-9]/gu, (char) => String.fromCharCode(char.charCodeAt(0) - FULLWIDTH_OFFSET));
|
|
14
|
+
const numberIn = (groups, name) => {
|
|
15
|
+
const written = groups[name];
|
|
16
|
+
return written === undefined ? undefined : Number(halfWidth(written));
|
|
17
|
+
};
|
|
18
|
+
/** 分か秒が 59 を超えるか。 */
|
|
19
|
+
const isPastMinute = (groups) => ["m", "colonMinute", "s"].some((name) => {
|
|
20
|
+
const value = numberIn(groups, name);
|
|
21
|
+
return value !== undefined && value >= MINUTES_IN_HOUR;
|
|
22
|
+
});
|
|
23
|
+
/** 午前・午後の付いた時が 12 を超えるか(24 まで)。 */
|
|
24
|
+
const isPastHalfDay = (groups) => {
|
|
25
|
+
const hour = numberIn(groups, "h") ?? 0;
|
|
26
|
+
return hour > HALF_DAY && hour <= HOURS_IN_DAY;
|
|
27
|
+
};
|
|
28
|
+
const withMeridiem = (groups) => {
|
|
29
|
+
if (isPastHalfDay(groups))
|
|
30
|
+
return "hour";
|
|
31
|
+
return isPastMinute(groups) ? "minute" : undefined;
|
|
32
|
+
};
|
|
33
|
+
const minutesOnly = (groups) => (isPastMinute(groups) ? "minute" : undefined);
|
|
34
|
+
/** 「Genesis 24:67」「Science, 12:75」のような章と節、巻と頁は時刻ではない。頭が大文字の語や区切りの印のすぐ後ろは読まない。 */
|
|
35
|
+
const isCitationBefore = (before) => {
|
|
36
|
+
const trimmed = before.trimEnd();
|
|
37
|
+
if ([",", ";", "."].includes(trimmed.slice(-1)))
|
|
38
|
+
return true;
|
|
39
|
+
const lastWord = trimmed.split(/\s/u).at(-1) ?? "";
|
|
40
|
+
return /^\p{Lu}/u.test(lastWord);
|
|
41
|
+
};
|
|
42
|
+
/** 時を 2 以上か 0 埋め(09:75)で書いた、時と分だけの時刻。1:75 は縮尺や比。 */
|
|
43
|
+
const bareClock = (groups, text, at) => {
|
|
44
|
+
const hourText = groups["h"] ?? "";
|
|
45
|
+
const hour = Number(halfWidth(hourText));
|
|
46
|
+
const looksLikeClock = hour <= HOURS_IN_DAY && (hour >= 2 || /^[00]/u.test(hourText));
|
|
47
|
+
if (!looksLikeClock || isCitationBefore(text.slice(Math.max(0, at - HALF_DAY), at)))
|
|
48
|
+
return undefined;
|
|
49
|
+
return minutesOnly(groups);
|
|
50
|
+
};
|
|
51
|
+
const alternation = (words) => words.map(escapeRegExp).join("|");
|
|
52
|
+
const meridiemShapes = (words) => {
|
|
53
|
+
const [hourUnit, minuteUnit] = words.units.map(escapeRegExp);
|
|
54
|
+
const before = alternation(words.before);
|
|
55
|
+
const after = alternation(words.after);
|
|
56
|
+
const minuteTail = minuteUnit === undefined ? "" : `(?:\\s?(?<m>${DIGIT}{1,2})${minuteUnit})?`;
|
|
57
|
+
const unitTail = hourUnit === undefined ? "" : `${hourUnit}${minuteTail}|`;
|
|
58
|
+
return [
|
|
59
|
+
...(after === ""
|
|
60
|
+
? []
|
|
61
|
+
: [
|
|
62
|
+
{
|
|
63
|
+
pattern: new RegExp(`${NOT_AFTER_CLOCK}(?<![,])(?<h>${DIGIT}{1,2})(?:${COLON}(?<m>${DIGIT}{2}))?\\s?(?:${after})(?![\\p{L}\\p{N}])`, "gu"),
|
|
64
|
+
problem: withMeridiem,
|
|
65
|
+
},
|
|
66
|
+
]),
|
|
67
|
+
...(before === ""
|
|
68
|
+
? []
|
|
69
|
+
: [{ pattern: new RegExp(`(?:${before})\\s?(?<h>${DIGIT}{1,2})(?:${unitTail}[::](?<colonMinute>${DIGIT}{2}))`, "gu"), problem: withMeridiem }]),
|
|
70
|
+
];
|
|
71
|
+
};
|
|
72
|
+
const unitShapes = (words) => {
|
|
73
|
+
const [hourUnit, minuteUnit, secondUnit] = words.units.map(escapeRegExp);
|
|
74
|
+
if (hourUnit === undefined || minuteUnit === undefined)
|
|
75
|
+
return [];
|
|
76
|
+
const seconds = secondUnit === undefined ? "" : `(?:\\s?(?<s>${DIGIT}{1,2})${secondUnit})?`;
|
|
77
|
+
return [{ pattern: new RegExp(`(?<!${DIGIT})(?<h>${DIGIT}{1,2})${hourUnit}\\s?(?<m>${DIGIT}{1,2})${minuteUnit}${seconds}`, "gu"), problem: minutesOnly }];
|
|
78
|
+
};
|
|
79
|
+
const shapesOf = (words) => [
|
|
80
|
+
...meridiemShapes(words),
|
|
81
|
+
...unitShapes(words),
|
|
82
|
+
{
|
|
83
|
+
pattern: new RegExp(`${NOT_AFTER_CLOCK}(?<h>${DIGIT}{1,3})${COLON}(?<m>${DIGIT}{2})${COLON}(?<s>${DIGIT}{2})${NOT_BEFORE_CLOCK}`, "gu"),
|
|
84
|
+
problem: minutesOnly,
|
|
85
|
+
},
|
|
86
|
+
{ pattern: new RegExp(`${NOT_AFTER_CLOCK}(?<![,/])(?<h>${DIGIT}{1,2})${COLON}(?<m>${DIGIT}{2})${NOT_BEFORE_CLOCK}`, "gu"), problem: bareClock },
|
|
87
|
+
];
|
|
88
|
+
const impossibleIn = (text, shape) => [...text.matchAll(shape.pattern)].flatMap((match) => {
|
|
89
|
+
const reason = shape.problem(match.groups ?? {}, text, match.index);
|
|
90
|
+
return reason === undefined ? [] : [{ offset: match.index, written: match[0].trim(), reason }];
|
|
91
|
+
});
|
|
92
|
+
const overlaps = (left, right) => left.offset < right.offset + right.written.length && right.offset < left.offset + left.written.length;
|
|
93
|
+
/** 文字列の中の、時計に無い時刻。重なる所に二つの形が当たれば、先の形(午前・午後の付いたもの)だけ。 */
|
|
94
|
+
export const impossibleTimes = (text, words) => shapesOf(words)
|
|
95
|
+
.flatMap((shape) => impossibleIn(text, shape))
|
|
96
|
+
.reduce((kept, found) => (kept.some((earlier) => overlaps(earlier, found)) ? kept : [...kept, found]), [])
|
|
97
|
+
.toSorted((left, right) => left.offset - right.offset);
|
|
98
|
+
const meridiemOf = (doc, position) => (doc.lexicons["clock-meridiem"] ?? []).filter((entry) => entry.position === position).map((entry) => entry.pattern);
|
|
99
|
+
export const clockWordsOf = (doc) => ({
|
|
100
|
+
before: meridiemOf(doc, "before"),
|
|
101
|
+
after: meridiemOf(doc, "after"),
|
|
102
|
+
units: (doc.lexicons["date-time-unit"] ?? []).map((entry) => entry.pattern).slice(3),
|
|
103
|
+
});
|
|
104
|
+
export const impossibleTime = (doc) => {
|
|
105
|
+
const text = doc.prose ?? doc.source;
|
|
106
|
+
return impossibleTimes(text, clockWordsOf(doc)).map((found) => ({
|
|
107
|
+
rule: "",
|
|
108
|
+
severity: "warning",
|
|
109
|
+
line: 0,
|
|
110
|
+
column: 0,
|
|
111
|
+
quote: quoteAround(text, found.offset, found.offset + found.written.length),
|
|
112
|
+
values: { written: found.written, offset: found.offset },
|
|
113
|
+
variant: found.reason,
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=impossible-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impossible-time.js","sourceRoot":"","sources":["../../src/detectors/impossible-time.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhD,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC;AACrB,2EAA2E;AAC3E,MAAM,eAAe,GAAG,y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KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAC3E,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;QACxD,OAAO,EAAE,KAAK,CAAC,MAAM;KACtB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Detector } from "../plugin.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A URL written bare (`https://…`) in a document whose other links are words (`[the guide](https://…)`). Reported only when the
|
|
4
|
+
* document has at least `limit` worded links and the bare ones are the few; a document that writes its URLs bare throughout is not.
|
|
5
|
+
*/
|
|
6
|
+
export declare const bareUrlMix: Detector;
|
|
7
|
+
/** A link whose text is an address on one host and whose destination is on another (`[https://a.example](https://b.example)`). */
|
|
8
|
+
export declare const linkTextUrlMismatch: Detector;
|
|
9
|
+
/** An image whose alt text is its file's name (`IMG_1234.png`, `Screenshot 2026-04-01`). The name prefixes come from the lexicon. */
|
|
10
|
+
export declare const imageFileNameAlt: Detector;
|
|
11
|
+
//# sourceMappingURL=link-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-shape.d.ts","sourceRoot":"","sources":["../../src/detectors/link-shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwC,MAAM,cAAc,CAAC;AAwCnF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QASxB,CAAC;AAEF,kIAAkI;AAClI,eAAO,MAAM,mBAAmB,EAAE,QAK9B,CAAC;AAEL,qIAAqI;AACrI,eAAO,MAAM,gBAAgB,EAAE,QAK9B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { findingAt, markupOf, quoteOf } from "./markup-finding.js";
|
|
2
|
+
import { linkTextOf } from "../link-text.js";
|
|
3
|
+
import { bareUrls } from "../bare-url.js";
|
|
4
|
+
import { isFileNameAlt, isUrlText, mismatchedHost } from "../link-shape.js";
|
|
5
|
+
import { minorityWithin } from "../orthography.js";
|
|
6
|
+
import { readMarkdown, spansOfType } from "../markdown-read.js";
|
|
7
|
+
/** A bare URL is reported only while bare URLs are at most this share of the document's links; past it, bare is a style. */
|
|
8
|
+
const BARE_SHARE_PERCENT = 25;
|
|
9
|
+
/** The link text, or undefined for an autolink, a definition or a link whose text is itself an address. */
|
|
10
|
+
const wordedText = (source, link) => {
|
|
11
|
+
const text = linkTextOf(source.slice(link.start, link.end));
|
|
12
|
+
return text === undefined || text.trim() === "" || isUrlText(text) ? undefined : text;
|
|
13
|
+
};
|
|
14
|
+
/** An inline link the reader clicks on words (`[text](url)`). A reference definition's span does not show the words used with it, so it is not counted. */
|
|
15
|
+
const isWorded = (source, link) => wordedText(source, link) !== undefined;
|
|
16
|
+
/** A link destination the parser gave up on (`[a](https://…/{{ page }})`, a space in it): what is left is a link, not a bare URL. */
|
|
17
|
+
const FAILED_DESTINATION = "](";
|
|
18
|
+
const inside = (span, regions) => regions.some((region) => span.start >= region.start && span.start < region.end);
|
|
19
|
+
/**
|
|
20
|
+
* The bare URLs the reader sees as text (outside links, code and quotations). A URL in a table cell is a value the table lists
|
|
21
|
+
* (an example request, a field's content), not a link the prose points to, so tables are left out.
|
|
22
|
+
*/
|
|
23
|
+
const bareUrlSpans = (source, markup) => {
|
|
24
|
+
const tables = spansOfType(readMarkdown(source).root, "table");
|
|
25
|
+
return markup.texts.flatMap((text) => bareUrls(source.slice(text.start, text.end))
|
|
26
|
+
.map((url) => ({ start: text.start + url.start, end: text.start + url.end }))
|
|
27
|
+
.filter((url) => !source.startsWith(FAILED_DESTINATION, url.start - FAILED_DESTINATION.length) && !inside(url, tables)));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A URL written bare (`https://…`) in a document whose other links are words (`[the guide](https://…)`). Reported only when the
|
|
31
|
+
* document has at least `limit` worded links and the bare ones are the few; a document that writes its URLs bare throughout is not.
|
|
32
|
+
*/
|
|
33
|
+
export const bareUrlMix = (doc, options) => {
|
|
34
|
+
const markup = markupOf(doc);
|
|
35
|
+
if (markup === undefined)
|
|
36
|
+
return [];
|
|
37
|
+
const worded = markup.links.filter((link) => isWorded(doc.source, link)).map((link) => ({ ...link, bare: false }));
|
|
38
|
+
if (worded.length < options.limit)
|
|
39
|
+
return [];
|
|
40
|
+
const bare = bareUrlSpans(doc.source, markup).map((url) => ({ ...url, bare: true }));
|
|
41
|
+
return minorityWithin([...worded, ...bare], (address) => address.bare, BARE_SHARE_PERCENT)
|
|
42
|
+
.filter((address) => address.bare)
|
|
43
|
+
.map((address) => findingAt(doc, address, { url: quoteOf(doc.source, address), count: worded.length }));
|
|
44
|
+
};
|
|
45
|
+
/** A link whose text is an address on one host and whose destination is on another (`[https://a.example](https://b.example)`). */
|
|
46
|
+
export const linkTextUrlMismatch = (doc) => (markupOf(doc)?.links ?? []).flatMap((link) => {
|
|
47
|
+
const text = linkTextOf(doc.source.slice(link.start, link.end));
|
|
48
|
+
const hosts = text === undefined ? undefined : mismatchedHost(text, link.destination);
|
|
49
|
+
return hosts === undefined ? [] : [findingAt(doc, link, hosts)];
|
|
50
|
+
});
|
|
51
|
+
/** An image whose alt text is its file's name (`IMG_1234.png`, `Screenshot 2026-04-01`). The name prefixes come from the lexicon. */
|
|
52
|
+
export const imageFileNameAlt = (doc, options) => {
|
|
53
|
+
const prefixes = (options.lexicon ?? []).map((entry) => entry.pattern);
|
|
54
|
+
return (markupOf(doc)?.images ?? []).flatMap((image) => image.alt !== undefined && isFileNameAlt(image.alt, prefixes) ? [findingAt(doc, image, { alt: image.alt.trim() })] : []);
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=link-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-shape.js","sourceRoot":"","sources":["../../src/detectors/link-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM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C;AAClE,CAAC,CAAC,CAAC;AAEL,qIAAqI;AACrI,MAAM,CAAC,MAAM,gBAAgB,GAAa,CAAC,GAAG,EAAE,OAAO,EAAa,EAAE;IACpE,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACrD,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACxH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Detector } from "../plugin.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Bullets mixed in one list or one document: a list that changes bullet partway (`-` then `*`, which Markdown splits in two),
|
|
4
|
+
* a `・` line inside a list item (Markdown joins it to the item), and a list whose bullet differs from most lists at its depth.
|
|
5
|
+
*/
|
|
6
|
+
export declare const listMarkerMix: Detector;
|
|
7
|
+
//# sourceMappingURL=list-marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-marker.d.ts","sourceRoot":"","sources":["../../src/detectors/list-marker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA0B,MAAM,cAAc,CAAC;AAyCrE;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAc3B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { findingAt, markupOf } from "./markup-finding.js";
|
|
2
|
+
import { readMarkdown } from "../markdown-read.js";
|
|
3
|
+
import { readLists } from "../list-marks.js";
|
|
4
|
+
/** Fewer lists than this at one depth, and the majority bullet is not yet a habit. */
|
|
5
|
+
const MIN_LISTS = 3;
|
|
6
|
+
/** Past this share, the document uses both bullets on purpose. */
|
|
7
|
+
const MINORITY_PERCENT = 25;
|
|
8
|
+
const PERCENT = 100;
|
|
9
|
+
/** The length of the bullet quoted: the bullet itself. */
|
|
10
|
+
const BULLET_LENGTH = 1;
|
|
11
|
+
const at = (doc, start, values, variant) => findingAt(doc, { start, end: start + BULLET_LENGTH }, values, variant);
|
|
12
|
+
/** The bullet most lists use; undefined on a tie. */
|
|
13
|
+
const majorityOf = (lists) => {
|
|
14
|
+
const counts = [...lists.reduce((acc, list) => acc.set(list.mark, (acc.get(list.mark) ?? 0) + 1), new Map())].toSorted(([, left], [, right]) => right - left);
|
|
15
|
+
const [first, second] = counts;
|
|
16
|
+
return first === undefined || second?.[1] === first[1] ? undefined : { mark: first[0], count: first[1] };
|
|
17
|
+
};
|
|
18
|
+
/** Lists whose bullet differs from the one most lists of the same depth use, while those are the few. */
|
|
19
|
+
const minorityAt = (doc, lists) => {
|
|
20
|
+
const majority = lists.length < MIN_LISTS ? undefined : majorityOf(lists);
|
|
21
|
+
if (majority === undefined)
|
|
22
|
+
return [];
|
|
23
|
+
const odd = lists.filter((list) => list.mark !== majority.mark);
|
|
24
|
+
if (odd.length * PERCENT > MINORITY_PERCENT * lists.length)
|
|
25
|
+
return [];
|
|
26
|
+
return odd.map((list) => at(doc, list.start, { mark: list.mark, usual: majority.mark, count: majority.count }, "document"));
|
|
27
|
+
};
|
|
28
|
+
/** A list written right after another in the same place with another bullet: Markdown starts a new list where the bullet changes. */
|
|
29
|
+
const splitAt = (doc, list) => list.previous === undefined || list.previous === list.mark ? [] : [at(doc, list.start, { mark: list.mark, usual: list.previous }, "split")];
|
|
30
|
+
/**
|
|
31
|
+
* Bullets mixed in one list or one document: a list that changes bullet partway (`-` then `*`, which Markdown splits in two),
|
|
32
|
+
* a `・` line inside a list item (Markdown joins it to the item), and a list whose bullet differs from most lists at its depth.
|
|
33
|
+
*/
|
|
34
|
+
export const listMarkerMix = (doc) => {
|
|
35
|
+
if (markupOf(doc) === undefined)
|
|
36
|
+
return [];
|
|
37
|
+
const { lists, foldedTyped } = readLists(doc.source, readMarkdown(doc.source).root);
|
|
38
|
+
const split = lists.flatMap((list) => splitAt(doc, list));
|
|
39
|
+
const folded = foldedTyped.map((start) => at(doc, start, { mark: "・" }, "folded"));
|
|
40
|
+
const reported = new Set(split.map((finding) => finding.values["offset"]));
|
|
41
|
+
const byDepth = new Map();
|
|
42
|
+
lists.forEach((list) => {
|
|
43
|
+
const same = byDepth.get(list.depth) ?? [];
|
|
44
|
+
same.push(list);
|
|
45
|
+
byDepth.set(list.depth, same);
|
|
46
|
+
});
|
|
47
|
+
const minority = [...byDepth.values()].flatMap((same) => minorityAt(doc, same)).filter((finding) => !reported.has(finding.values["offset"]));
|
|
48
|
+
return [...split, ...folded, ...minority].toSorted((left, right) => Number(left.values["offset"]) - Number(right.values["offset"]));
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=list-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-marker.js","sourceRoot":"","sources":["../../src/detectors/list-marker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAC;AAE5D,sFAAsF;AACtF,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,kEAAkE;AAClE,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,0DAA0D;AAC1D,MAAM,aAAa,GAAG,CAAC,CAAC;AAEx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AAQ,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtI,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Detector, Lexicon, ProseDocument, Sentence } from "../plugin.ts";
|
|
2
|
+
/** One way of writing a mark: its kind, which of the two ways it is (side), and how the other way writes it. */
|
|
3
|
+
type Form = {
|
|
4
|
+
readonly kind: string;
|
|
5
|
+
readonly side: boolean;
|
|
6
|
+
readonly other: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The two ways of writing each kind of mark, from the lexicon: pattern is one way, instead_of the other, group the kind.
|
|
10
|
+
* Two patterns may share one instead_of (“ and ” both against "), so the other way of a shared mark is both patterns.
|
|
11
|
+
*/
|
|
12
|
+
export declare const formsOf: (lexicon: Lexicon) => ReadonlyMap<string, Form>;
|
|
13
|
+
export type Mark = {
|
|
14
|
+
readonly sentence: Sentence;
|
|
15
|
+
readonly char: string;
|
|
16
|
+
readonly form: Form;
|
|
17
|
+
readonly offset: number;
|
|
18
|
+
readonly spaced: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** The marks in a sentence that touch a letter of the document's script, outside 「」『』 quotations. spaced is the lexicon's pattern side. */
|
|
21
|
+
export declare const marksIn: (sentence: Sentence, forms: ReadonlyMap<string, Form>, script: RegExp) => Mark[];
|
|
22
|
+
/** Something written one of two ways (spaced is which), at a place in a sentence. */
|
|
23
|
+
type Sided = {
|
|
24
|
+
readonly sentence: Sentence;
|
|
25
|
+
readonly offset: number;
|
|
26
|
+
readonly spaced: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A mark written two ways in one document (( and (, “ and "), the less common way reported. The two ways come from the
|
|
30
|
+
* lexicon; neither is called right. Only marks next to a letter of the document's script count, so a bracket in code-like
|
|
31
|
+
* text (f(x)) or an English aside in a Japanese document does not.
|
|
32
|
+
*/
|
|
33
|
+
export declare const markConsistency: Detector;
|
|
34
|
+
/** The space between two sentences on one line, when the first ends with a period, question or exclamation mark. spaced is two spaces. */
|
|
35
|
+
export declare const sentenceGaps: (doc: ProseDocument) => Sided[];
|
|
36
|
+
/** One space between sentences and two, mixed in one document: the less common is reported. */
|
|
37
|
+
export declare const sentenceSpacing: Detector;
|
|
38
|
+
export declare const hyphenDash: Detector;
|
|
39
|
+
/** Every way of writing an abbreviation with some of its periods dropped but not all (e.g. → e.g, eg.). */
|
|
40
|
+
export declare const partialForms: (abbreviation: string) => string[];
|
|
41
|
+
/** Latin abbreviations from the lexicon (e.g., i.e.) written with only some of their periods (e.g, eg.). */
|
|
42
|
+
export declare const latinAbbreviation: Detector;
|
|
43
|
+
/** The words a source writes at least once not wholly in capitals (do, Do), in lower case: words, not acronyms. */
|
|
44
|
+
export declare const lowerCaseWords: (source: string) => ReadonlySet<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Whether more than half the words of a capital run are also written elsewhere in lower case. Words the lexicon lists as
|
|
47
|
+
* written in capitals by convention (MUST NOT in a specification) count like acronyms.
|
|
48
|
+
*/
|
|
49
|
+
export declare const isShouting: (run: string, known: ReadonlySet<string>, conventional: ReadonlySet<string>) => boolean;
|
|
50
|
+
/** Runs of three or more all-capital words that are ordinary words, not acronyms ("DO NOT DELETE THIS"). */
|
|
51
|
+
export declare const capsShouting: Detector;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=mark-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-shape.d.ts","sourceRoot":"","sources":["../../src/detectors/mark-shape.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAWxF,gHAAgH;AAChH,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;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CACyD,CAAC;AAE5H;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,WAAW,CAAC,MAAM,CAAC,EAAE,cAAc,WAAW,CAAC,MAAM,CAAC,KAAG,OAKvG,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,YAAY,EAAE,QAK1B,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { escapeRegExp } from "../orthography.js";
|
|
2
|
+
import { minorityReport } from "../spacing-minority.js";
|
|
3
|
+
import { isWithinAny, quotedSpans } from "../quoted-span.js";
|
|
4
|
+
/** The letters a mark must touch to count as part of the document's text, by language. */
|
|
5
|
+
const SCRIPT = {
|
|
6
|
+
ja: /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}ー々]/u,
|
|
7
|
+
en: /\p{Script=Latin}/u,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The two ways of writing each kind of mark, from the lexicon: pattern is one way, instead_of the other, group the kind.
|
|
11
|
+
* Two patterns may share one instead_of (“ and ” both against "), so the other way of a shared mark is both patterns.
|
|
12
|
+
*/
|
|
13
|
+
export const formsOf = (lexicon) => {
|
|
14
|
+
const forms = new Map();
|
|
15
|
+
lexicon.forEach((entry) => {
|
|
16
|
+
const kind = entry.group ?? entry.pattern;
|
|
17
|
+
const shared = entry.instead_of ?? "";
|
|
18
|
+
forms.set(entry.pattern, { kind, side: true, other: shared });
|
|
19
|
+
const known = forms.get(shared);
|
|
20
|
+
forms.set(shared, { kind, side: false, other: `${known?.side === false ? known.other : ""}${entry.pattern}` });
|
|
21
|
+
});
|
|
22
|
+
return forms;
|
|
23
|
+
};
|
|
24
|
+
/** Punctuation that may stand between a closing or opening mark and the word it belongs to ("draft." and “draft”.). */
|
|
25
|
+
const BETWEEN = /[.,;:!?。、]/u;
|
|
26
|
+
/** The letter beside a mark on one side (step -1 or 1), past one punctuation mark. */
|
|
27
|
+
const besideLetter = (text, at, step, script) => {
|
|
28
|
+
const next = text.charAt(at + step);
|
|
29
|
+
return script.test(next) || (BETWEEN.test(next) && script.test(text.charAt(at + step * 2)));
|
|
30
|
+
};
|
|
31
|
+
const touchesScript = (text, at, script) => besideLetter(text, at, -1, script) || besideLetter(text, at, 1, script);
|
|
32
|
+
/** The marks in a sentence that touch a letter of the document's script, outside 「」『』 quotations. spaced is the lexicon's pattern side. */
|
|
33
|
+
export const marksIn = (sentence, forms, script) => {
|
|
34
|
+
const quoted = quotedSpans(sentence.text);
|
|
35
|
+
return sentence.text.split("").flatMap((char, at) => {
|
|
36
|
+
const form = forms.get(char);
|
|
37
|
+
if (form === undefined || !touchesScript(sentence.text, at, script))
|
|
38
|
+
return [];
|
|
39
|
+
if (isWithinAny(quoted, { start: at, end: at }))
|
|
40
|
+
return [];
|
|
41
|
+
return [{ sentence, char, form, offset: sentence.span.start + at, spaced: form.side }];
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const sidedFinding = (item, values, variant) => ({
|
|
45
|
+
rule: "",
|
|
46
|
+
severity: "info",
|
|
47
|
+
line: 0,
|
|
48
|
+
column: 0,
|
|
49
|
+
quote: item.sentence.text.trim(),
|
|
50
|
+
...(variant === undefined ? {} : { variant }),
|
|
51
|
+
values: { ...values, offset: item.offset },
|
|
52
|
+
});
|
|
53
|
+
/** The less common way, one finding each, or one finding for a document written both ways (spacing-minority.ts). */
|
|
54
|
+
const minorityFindings = (items, limit, valuesOf) => {
|
|
55
|
+
const report = minorityReport(items, limit);
|
|
56
|
+
if (report === undefined)
|
|
57
|
+
return [];
|
|
58
|
+
if (report.mode === "mixed") {
|
|
59
|
+
const { first, odd, spaced, touching } = report;
|
|
60
|
+
return [sidedFinding(first, { ...valuesOf(first), spaced, touching, count: odd, of: items.length, limit }, "mixed")];
|
|
61
|
+
}
|
|
62
|
+
return report.odd.map((item) => sidedFinding(item, { ...valuesOf(item), count: report.odd.length, of: items.length, limit }));
|
|
63
|
+
};
|
|
64
|
+
/** Sentences written in the document's own language; a quoted sentence in another language follows its own marks. */
|
|
65
|
+
const ownSentences = (doc) => doc.sentences.filter((sentence) => sentence.embeddedLanguage === undefined);
|
|
66
|
+
/**
|
|
67
|
+
* A mark written two ways in one document (( and (, “ and "), the less common way reported. The two ways come from the
|
|
68
|
+
* lexicon; neither is called right. Only marks next to a letter of the document's script count, so a bracket in code-like
|
|
69
|
+
* text (f(x)) or an English aside in a Japanese document does not.
|
|
70
|
+
*/
|
|
71
|
+
export const markConsistency = (doc, options) => {
|
|
72
|
+
const script = SCRIPT[doc.language];
|
|
73
|
+
if (script === undefined)
|
|
74
|
+
return [];
|
|
75
|
+
const forms = formsOf(options.lexicon ?? []);
|
|
76
|
+
const marks = ownSentences(doc).flatMap((sentence) => marksIn(sentence, forms, script));
|
|
77
|
+
const kinds = [...new Set(marks.map((mark) => mark.form.kind))];
|
|
78
|
+
return kinds.flatMap((kind) => minorityFindings(marks.filter((mark) => mark.form.kind === kind), options.limit, (mark) => ({ mark: mark.char, usual: mark.form.other })));
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A sentence that surely ends: a lower-case word of two letters or more, then the mark. A number ("11.1."), an abbreviation
|
|
82
|
+
* ("Req.", "e.g.") or a capital ("U.S.") may be a split the adapter made inside a sentence, where one space is usual.
|
|
83
|
+
*/
|
|
84
|
+
const SENTENCE_END = /(?<![\p{L}\d.])\p{Ll}{2,}[.!?]["'”’)\]]?$/u;
|
|
85
|
+
/** The next sentence starts with a capital, past an opening quote: not a citation ("[ISO99]") or an aside in brackets. */
|
|
86
|
+
const SENTENCE_START = /^["'“‘]?\p{Lu}/u;
|
|
87
|
+
const ONE_SPACE = " ";
|
|
88
|
+
const TWO_SPACES = " ";
|
|
89
|
+
/** The space between two sentences on one line, when the first ends with a period, question or exclamation mark. spaced is two spaces. */
|
|
90
|
+
export const sentenceGaps = (doc) => ownSentences(doc).flatMap((sentence, at, sentences) => {
|
|
91
|
+
const next = sentences[at + 1];
|
|
92
|
+
if (next === undefined || !SENTENCE_END.test(sentence.text) || !SENTENCE_START.test(next.text))
|
|
93
|
+
return [];
|
|
94
|
+
const gap = doc.source.slice(sentence.span.end, next.span.start);
|
|
95
|
+
if (gap !== ONE_SPACE && gap !== TWO_SPACES)
|
|
96
|
+
return [];
|
|
97
|
+
return [{ sentence: next, spaced: gap === TWO_SPACES, offset: sentence.span.end }];
|
|
98
|
+
});
|
|
99
|
+
/** One space between sentences and two, mixed in one document: the less common is reported. */
|
|
100
|
+
export const sentenceSpacing = (doc, options) => minorityFindings(sentenceGaps(doc), options.limit, (gap) => ({
|
|
101
|
+
spaces: gap.spaced ? TWO_SPACES.length : ONE_SPACE.length,
|
|
102
|
+
usual: gap.spaced ? ONE_SPACE.length : TWO_SPACES.length,
|
|
103
|
+
}));
|
|
104
|
+
const hitFinding = (hit, count, limit) => ({
|
|
105
|
+
rule: "",
|
|
106
|
+
severity: "info",
|
|
107
|
+
line: 0,
|
|
108
|
+
column: 0,
|
|
109
|
+
quote: hit.sentence.text.trim(),
|
|
110
|
+
values: { matched: hit.matched, count, limit, offset: hit.offset },
|
|
111
|
+
});
|
|
112
|
+
const hitsOf = (sentences, pattern) => sentences.flatMap((sentence) => [...sentence.text.matchAll(pattern)].map((match) => ({ sentence, matched: match[0].trim(), offset: sentence.span.start + match.index })));
|
|
113
|
+
const reportFrom = (hits, limit) => (hits.length < limit ? [] : hits.map((hit) => hitFinding(hit, hits.length, limit)));
|
|
114
|
+
/** A spaced hyphen or a double hyphen between words, standing for a dash ("late - very late", "late--very late"). */
|
|
115
|
+
const HYPHEN_DASH = /(?<=[\p{L},;)]) -{1,2} (?=[\p{L}(])|(?<=\p{L})--(?=\p{L})/gu;
|
|
116
|
+
export const hyphenDash = (doc, options) => reportFrom(hitsOf(ownSentences(doc), HYPHEN_DASH), options.limit);
|
|
117
|
+
/** Every way of writing an abbreviation with some of its periods dropped but not all (e.g. → e.g, eg.). */
|
|
118
|
+
export const partialForms = (abbreviation) => {
|
|
119
|
+
const dots = [...abbreviation].flatMap((char, at) => (char === "." ? [at] : []));
|
|
120
|
+
const subsets = Array.from({ length: 2 ** dots.length }, (_unused, mask) => dots.filter((_dot, bit) => (mask >> bit) % 2 === 1));
|
|
121
|
+
return subsets
|
|
122
|
+
.filter((dropped) => dropped.length > 0 && dropped.length < dots.length)
|
|
123
|
+
.map((dropped) => [...abbreviation].filter((_char, at) => !dropped.includes(at)).join(""));
|
|
124
|
+
};
|
|
125
|
+
/** One partial form as a pattern: its first letter in either case, not inside a word, not followed by a period or letter. */
|
|
126
|
+
const partialPattern = (form) => `(?<![\\p{L}.])[${form.charAt(0).toLowerCase()}${form.charAt(0).toUpperCase()}]${escapeRegExp(form.slice(1))}(?![\\p{L}.])`;
|
|
127
|
+
/** Latin abbreviations from the lexicon (e.g., i.e.) written with only some of their periods (e.g, eg.). */
|
|
128
|
+
export const latinAbbreviation = (doc, options) => {
|
|
129
|
+
const forms = (options.lexicon ?? []).flatMap((entry) => partialForms(entry.pattern));
|
|
130
|
+
if (forms.length === 0)
|
|
131
|
+
return [];
|
|
132
|
+
const pattern = new RegExp(forms.map(partialPattern).join("|"), "gu");
|
|
133
|
+
return reportFrom(hitsOf(ownSentences(doc), pattern), options.limit);
|
|
134
|
+
};
|
|
135
|
+
/** How many all-capital words in a row read as shouting rather than a run of acronyms. */
|
|
136
|
+
const SHOUT_WORDS = 3;
|
|
137
|
+
const CAPS_RUN = new RegExp(`\\b[A-Z][A-Z']*(?:,? [A-Z][A-Z']*){${String(SHOUT_WORDS - 1)},}\\b`, "gu");
|
|
138
|
+
/** One-letter words (I, A) may sit in a run, but a run of them alone ("A B C") is a list of labels. */
|
|
139
|
+
const MIN_LONG_WORDS = 2;
|
|
140
|
+
const LATIN_WORD = /[A-Za-z][A-Za-z']*/gu;
|
|
141
|
+
/** The words a source writes at least once not wholly in capitals (do, Do), in lower case: words, not acronyms. */
|
|
142
|
+
export const lowerCaseWords = (source) => new Set((source.match(LATIN_WORD) ?? []).filter((word) => word !== word.toUpperCase()).map((word) => word.toLowerCase()));
|
|
143
|
+
/**
|
|
144
|
+
* Whether more than half the words of a capital run are also written elsewhere in lower case. Words the lexicon lists as
|
|
145
|
+
* written in capitals by convention (MUST NOT in a specification) count like acronyms.
|
|
146
|
+
*/
|
|
147
|
+
export const isShouting = (run, known, conventional) => {
|
|
148
|
+
const words = run.split(/,? /u);
|
|
149
|
+
const ordinary = words.filter((word) => !conventional.has(word) && known.has(word.toLowerCase()));
|
|
150
|
+
const long = words.filter((word) => word.length > 1);
|
|
151
|
+
return long.length >= MIN_LONG_WORDS && ordinary.length * 2 > words.length;
|
|
152
|
+
};
|
|
153
|
+
/** Runs of three or more all-capital words that are ordinary words, not acronyms ("DO NOT DELETE THIS"). */
|
|
154
|
+
export const capsShouting = (doc, options) => {
|
|
155
|
+
const known = lowerCaseWords(doc.prose ?? doc.source);
|
|
156
|
+
const conventional = new Set((options.lexicon ?? []).map((entry) => entry.pattern));
|
|
157
|
+
const hits = hitsOf(ownSentences(doc), CAPS_RUN).filter((hit) => isShouting(hit.matched, known, conventional));
|
|
158
|
+
return reportFrom(hits, options.limit);
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=mark-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-shape.js","sourceRoot":"","sources":["../../src/detectors/mark-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D,0FAA0F;AAC1F,MAAM,MAAM,GAAqC;IAC/C,EAAE,EAAE,2DAA2D;IAC/D,EAAE,EAAE,mBAAmB;CACxB,CAAC;AAKF;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAgB,EAA6B,EAAE;IACrE,MAAM,KAAK,GAAG,IAAI,GAAG,EA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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Detector, Span } from "../plugin.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A body row with more cells than the header: GFM shows only as many cells as the header has, and drops the rest. Extra cells
|
|
4
|
+
* that are empty or hold only a comment lose nothing and are not reported.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tableRowOverflow: Detector;
|
|
7
|
+
/**
|
|
8
|
+
* A fenced code block with no closing fence. Markdown runs it to the end of the document (or of the list item it is in), so
|
|
9
|
+
* everything after the opening fence shows as code. Reported at the opening fence.
|
|
10
|
+
*/
|
|
11
|
+
export declare const unclosedCodeFence: Detector;
|
|
12
|
+
/** The strong-emphasis runs in one text node that Markdown left as text. */
|
|
13
|
+
export declare const strayStrongRuns: (text: string) => Span[];
|
|
14
|
+
/**
|
|
15
|
+
* `**` or `__` that Markdown shows as it is: strong emphasis left open (`**bold`), or one CommonMark cannot close because a
|
|
16
|
+
* bracket or a quotation mark touches the mark from inside while a letter touches it from outside (`**「重要」**です`).
|
|
17
|
+
*/
|
|
18
|
+
export declare const unrenderedEmphasis: Detector;
|
|
19
|
+
//# sourceMappingURL=markdown-slip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-slip.d.ts","sourceRoot":"","sources":["../../src/detectors/markdown-slip.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAA0B,IAAI,EAAE,MAAM,cAAc,CAAC;AA+B3E;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAa9B,CAAC;AA+BF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAQ/B,CAAC;AAmBF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,IAAI,EAQ/C,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAWhC,CAAC"}
|