@driftsys/markspec 0.4.0 → 0.6.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 +74 -20
- package/esm/ast/build.d.ts +60 -0
- package/esm/ast/build.d.ts.map +1 -0
- package/esm/ast/build.js +516 -0
- package/esm/ast/equivalence.d.ts +18 -0
- package/esm/ast/equivalence.d.ts.map +1 -0
- package/esm/ast/equivalence.js +56 -0
- package/esm/ast/nodes.d.ts +189 -0
- package/esm/ast/nodes.d.ts.map +1 -0
- package/esm/ast/nodes.js +17 -0
- package/esm/ast/normalize.d.ts +58 -0
- package/esm/ast/normalize.d.ts.map +1 -0
- package/esm/ast/normalize.js +197 -0
- package/esm/ast/render.d.ts +34 -0
- package/esm/ast/render.d.ts.map +1 -0
- package/esm/ast/render.js +215 -0
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +2 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +33 -14
- package/esm/compiler/manifest.d.ts +59 -0
- package/esm/compiler/manifest.d.ts.map +1 -0
- package/esm/compiler/manifest.js +48 -0
- package/esm/compiler/mod.d.ts +38 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +202 -50
- package/esm/compiler/ndjson_writer.d.ts +50 -0
- package/esm/compiler/ndjson_writer.d.ts.map +1 -0
- package/esm/compiler/ndjson_writer.js +73 -0
- package/esm/compiler/schema.d.ts +33 -1
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +30 -9
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +54 -0
- package/esm/formatter/mod.d.ts +55 -4
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +423 -46
- package/esm/formatter/synth_ulid.d.ts +21 -0
- package/esm/formatter/synth_ulid.d.ts.map +1 -0
- package/esm/formatter/synth_ulid.js +64 -0
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +14 -0
- package/esm/lint/mod.d.ts.map +1 -0
- package/esm/lint/mod.js +9 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/lexicon.d.ts +24 -0
- package/esm/lint/rules/lexicon.d.ts.map +1 -0
- package/esm/lint/rules/lexicon.js +236 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/struct.d.ts +17 -0
- package/esm/lint/rules/struct.d.ts.map +1 -0
- package/esm/lint/rules/struct.js +55 -0
- package/esm/lint/rules/suppression.d.ts +54 -0
- package/esm/lint/rules/suppression.d.ts.map +1 -0
- package/esm/lint/rules/suppression.js +129 -0
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +59 -0
- package/esm/lint/runner.d.ts.map +1 -0
- package/esm/lint/runner.js +153 -0
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +31 -0
- package/esm/lint/types.d.ts.map +1 -0
- package/esm/lint/types.js +9 -0
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +28 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +23 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +200 -2
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/discriminating_attr.d.ts +33 -0
- package/esm/model/discriminating_attr.d.ts.map +1 -0
- package/esm/model/discriminating_attr.js +74 -0
- package/esm/model/mod.d.ts +267 -14
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +99 -3
- package/esm/model/profile.d.ts +102 -27
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/model/source_introspection.d.ts +26 -0
- package/esm/model/source_introspection.d.ts.map +1 -0
- package/esm/model/source_introspection.js +77 -0
- package/esm/model/type_hierarchy.d.ts +51 -0
- package/esm/model/type_hierarchy.d.ts.map +1 -0
- package/esm/model/type_hierarchy.js +126 -0
- package/esm/model/uri_scheme_map.d.ts +21 -0
- package/esm/model/uri_scheme_map.d.ts.map +1 -0
- package/esm/model/uri_scheme_map.js +66 -0
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +10 -16
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +51 -0
- package/esm/parser/glossary.d.ts.map +1 -0
- package/esm/parser/glossary.js +219 -0
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +317 -25
- package/esm/parser/mod.d.ts +5 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +31 -8
- package/esm/parser/source.d.ts +53 -2
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +158 -68
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +32 -14
- package/esm/profile/colors.js +1 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/introspect.d.ts +135 -0
- package/esm/profile/introspect.d.ts.map +1 -0
- package/esm/profile/introspect.js +378 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +91 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +512 -90
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +251 -39
- package/esm/profile/mod.d.ts +4 -4
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +7 -2
- package/esm/reporter/mod.js +4 -4
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/fence.d.ts +30 -0
- package/esm/util/fence.d.ts.map +1 -0
- package/esm/util/fence.js +40 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/attributes.d.ts +3 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +1 -18
- package/esm/validator/body_blocks.d.ts +38 -0
- package/esm/validator/body_blocks.d.ts.map +1 -0
- package/esm/validator/body_blocks.js +218 -0
- package/esm/validator/caption_convention.d.ts +29 -0
- package/esm/validator/caption_convention.d.ts.map +1 -0
- package/esm/validator/caption_convention.js +58 -0
- package/esm/validator/captions.d.ts +22 -0
- package/esm/validator/captions.d.ts.map +1 -0
- package/esm/validator/captions.js +137 -0
- package/esm/validator/component_schemes.d.ts +73 -0
- package/esm/validator/component_schemes.d.ts.map +1 -0
- package/esm/validator/component_schemes.js +375 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/feature_ac.d.ts +28 -0
- package/esm/validator/feature_ac.d.ts.map +1 -0
- package/esm/validator/feature_ac.js +102 -0
- package/esm/validator/listing.d.ts +42 -0
- package/esm/validator/listing.d.ts.map +1 -0
- package/esm/validator/listing.js +295 -0
- package/esm/validator/mod.d.ts +3 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +275 -13
- package/esm/validator/modal_keywords.d.ts +25 -0
- package/esm/validator/modal_keywords.d.ts.map +1 -0
- package/esm/validator/modal_keywords.js +54 -0
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +29 -0
- package/esm/validator/per_type_attrs.d.ts.map +1 -0
- package/esm/validator/per_type_attrs.js +75 -0
- package/esm/validator/pipeline.d.ts +18 -2
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -21
- package/esm/validator/trace_types.d.ts +26 -0
- package/esm/validator/trace_types.d.ts.map +1 -0
- package/esm/validator/trace_types.js +232 -0
- package/esm/validator/traceability.d.ts +3 -4
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +5 -10
- package/esm/validator/type_resolution.d.ts +67 -0
- package/esm/validator/type_resolution.d.ts.map +1 -0
- package/esm/validator/type_resolution.js +162 -0
- package/esm/validator/types.d.ts +45 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +128 -16
- package/esm/validator/value_types.d.ts +8 -0
- package/esm/validator/value_types.d.ts.map +1 -1
- package/esm/validator/value_types.js +8 -1
- package/package.json +2 -2
- package/script/ast/build.d.ts +60 -0
- package/script/ast/build.d.ts.map +1 -0
- package/script/ast/build.js +521 -0
- package/script/ast/equivalence.d.ts +18 -0
- package/script/ast/equivalence.d.ts.map +1 -0
- package/script/ast/equivalence.js +59 -0
- package/script/ast/nodes.d.ts +189 -0
- package/script/ast/nodes.d.ts.map +1 -0
- package/script/ast/nodes.js +18 -0
- package/script/ast/normalize.d.ts +58 -0
- package/script/ast/normalize.d.ts.map +1 -0
- package/script/ast/normalize.js +200 -0
- package/script/ast/render.d.ts +34 -0
- package/script/ast/render.d.ts.map +1 -0
- package/script/ast/render.js +218 -0
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +2 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +33 -14
- package/script/compiler/manifest.d.ts +59 -0
- package/script/compiler/manifest.d.ts.map +1 -0
- package/script/compiler/manifest.js +51 -0
- package/script/compiler/mod.d.ts +38 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +206 -54
- package/script/compiler/ndjson_writer.d.ts +50 -0
- package/script/compiler/ndjson_writer.d.ts.map +1 -0
- package/script/compiler/ndjson_writer.js +78 -0
- package/script/compiler/schema.d.ts +33 -1
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +30 -8
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +54 -0
- package/script/formatter/mod.d.ts +55 -4
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +426 -46
- package/script/formatter/synth_ulid.d.ts +21 -0
- package/script/formatter/synth_ulid.d.ts.map +1 -0
- package/script/formatter/synth_ulid.js +67 -0
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +14 -0
- package/script/lint/mod.d.ts.map +1 -0
- package/script/lint/mod.js +17 -0
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/lexicon.d.ts +24 -0
- package/script/lint/rules/lexicon.d.ts.map +1 -0
- package/script/lint/rules/lexicon.js +240 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/struct.d.ts +17 -0
- package/script/lint/rules/struct.d.ts.map +1 -0
- package/script/lint/rules/struct.js +59 -0
- package/script/lint/rules/suppression.d.ts +54 -0
- package/script/lint/rules/suppression.d.ts.map +1 -0
- package/script/lint/rules/suppression.js +136 -0
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +59 -0
- package/script/lint/runner.d.ts.map +1 -0
- package/script/lint/runner.js +157 -0
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +31 -0
- package/script/lint/types.d.ts.map +1 -0
- package/script/lint/types.js +10 -0
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +28 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +129 -32
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +201 -3
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/discriminating_attr.d.ts +33 -0
- package/script/model/discriminating_attr.d.ts.map +1 -0
- package/script/model/discriminating_attr.js +77 -0
- package/script/model/mod.d.ts +267 -14
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +111 -3
- package/script/model/profile.d.ts +102 -27
- package/script/model/profile.d.ts.map +1 -1
- package/script/model/source_introspection.d.ts +26 -0
- package/script/model/source_introspection.d.ts.map +1 -0
- package/script/model/source_introspection.js +80 -0
- package/script/model/type_hierarchy.d.ts +51 -0
- package/script/model/type_hierarchy.d.ts.map +1 -0
- package/script/model/type_hierarchy.js +130 -0
- package/script/model/uri_scheme_map.d.ts +21 -0
- package/script/model/uri_scheme_map.d.ts.map +1 -0
- package/script/model/uri_scheme_map.js +69 -0
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +10 -16
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +51 -0
- package/script/parser/glossary.d.ts.map +1 -0
- package/script/parser/glossary.js +224 -0
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +315 -23
- package/script/parser/mod.d.ts +5 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +36 -7
- package/script/parser/source.d.ts +53 -2
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +159 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +32 -14
- package/script/profile/colors.js +1 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/introspect.d.ts +135 -0
- package/script/profile/introspect.d.ts.map +1 -0
- package/script/profile/introspect.js +381 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +91 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +511 -89
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +251 -39
- package/script/profile/mod.d.ts +4 -4
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +12 -6
- package/script/reporter/mod.js +4 -4
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/fence.d.ts +30 -0
- package/script/util/fence.d.ts.map +1 -0
- package/script/util/fence.js +44 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/attributes.d.ts +3 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +1 -18
- package/script/validator/body_blocks.d.ts +38 -0
- package/script/validator/body_blocks.d.ts.map +1 -0
- package/script/validator/body_blocks.js +221 -0
- package/script/validator/caption_convention.d.ts +29 -0
- package/script/validator/caption_convention.d.ts.map +1 -0
- package/script/validator/caption_convention.js +61 -0
- package/script/validator/captions.d.ts +22 -0
- package/script/validator/captions.d.ts.map +1 -0
- package/script/validator/captions.js +140 -0
- package/script/validator/component_schemes.d.ts +73 -0
- package/script/validator/component_schemes.d.ts.map +1 -0
- package/script/validator/component_schemes.js +384 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/feature_ac.d.ts +28 -0
- package/script/validator/feature_ac.d.ts.map +1 -0
- package/script/validator/feature_ac.js +105 -0
- package/script/validator/listing.d.ts +42 -0
- package/script/validator/listing.d.ts.map +1 -0
- package/script/validator/listing.js +298 -0
- package/script/validator/mod.d.ts +3 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +278 -14
- package/script/validator/modal_keywords.d.ts +25 -0
- package/script/validator/modal_keywords.d.ts.map +1 -0
- package/script/validator/modal_keywords.js +57 -0
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +29 -0
- package/script/validator/per_type_attrs.d.ts.map +1 -0
- package/script/validator/per_type_attrs.js +78 -0
- package/script/validator/pipeline.d.ts +18 -2
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +78 -22
- package/script/validator/trace_types.d.ts +26 -0
- package/script/validator/trace_types.d.ts.map +1 -0
- package/script/validator/trace_types.js +235 -0
- package/script/validator/traceability.d.ts +3 -4
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +5 -10
- package/script/validator/type_resolution.d.ts +67 -0
- package/script/validator/type_resolution.d.ts.map +1 -0
- package/script/validator/type_resolution.js +168 -0
- package/script/validator/types.d.ts +45 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +131 -16
- package/script/validator/value_types.d.ts +8 -0
- package/script/validator/value_types.d.ts.map +1 -1
- package/script/validator/value_types.js +10 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/fence
|
|
3
|
+
*
|
|
4
|
+
* Prose-line walker that skips lines inside fenced code blocks.
|
|
5
|
+
* Several validator and formatter passes (body-block exclusions,
|
|
6
|
+
* caption adjacency, `$Identifier` extraction, modal-keyword
|
|
7
|
+
* normalisation) all needed to walk an entry body line-by-line while
|
|
8
|
+
* treating fenced code as verbatim. This helper centralises that
|
|
9
|
+
* pattern so the fence-toggle semantics stay consistent.
|
|
10
|
+
*
|
|
11
|
+
* Fence detection follows CommonMark §4.5 — a line whose first
|
|
12
|
+
* non-whitespace content is three or more backticks or tildes opens
|
|
13
|
+
* (or closes) a fenced block. The language tag that may follow the
|
|
14
|
+
* opening fence does not affect detection: we toggle on every fence
|
|
15
|
+
* marker regardless. (Mismatched marker types — ``` opener / ~~~
|
|
16
|
+
* closer — are accepted by the walker because real Markdown parsers
|
|
17
|
+
* already reject those upstream.)
|
|
18
|
+
*/
|
|
19
|
+
/** Three or more backticks or tildes at the start of a line. */
|
|
20
|
+
export const FENCE_RE = /^\s*(```|~~~)/;
|
|
21
|
+
/**
|
|
22
|
+
* Walk `body` line by line, invoking `cb` for every line that's NOT
|
|
23
|
+
* inside a fenced code block. The first fence marker opens the block;
|
|
24
|
+
* the next closes it. The fence-marker lines themselves are also
|
|
25
|
+
* skipped (they're structural, not prose).
|
|
26
|
+
*/
|
|
27
|
+
export function walkProseLines(body, cb) {
|
|
28
|
+
const lines = body.split("\n");
|
|
29
|
+
let inFence = false;
|
|
30
|
+
for (let i = 0; i < lines.length; i++) {
|
|
31
|
+
const line = lines[i];
|
|
32
|
+
if (FENCE_RE.test(line)) {
|
|
33
|
+
inFence = !inFence;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (inFence)
|
|
37
|
+
continue;
|
|
38
|
+
cb(line, i);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/line_endings
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform line-ending helpers. MarkSpec normalises every input to
|
|
5
|
+
* `\n` at the parse and format boundaries so the rest of the toolchain
|
|
6
|
+
* never sees stray `\r` characters. The formatter detects the original
|
|
7
|
+
* file's convention and restores it on write-back, so a CRLF file stays
|
|
8
|
+
* CRLF after `markspec format` round-trips through the AST.
|
|
9
|
+
*/
|
|
10
|
+
/** Line-ending convention. `cr` covers legacy Mac files. */
|
|
11
|
+
export type LineEnding = "crlf" | "lf" | "cr";
|
|
12
|
+
/**
|
|
13
|
+
* Detect the dominant line-ending convention of a text. Inspects the
|
|
14
|
+
* first newline-bearing region and falls back to `"lf"` for inputs with
|
|
15
|
+
* no line breaks at all.
|
|
16
|
+
*
|
|
17
|
+
* Returns `"crlf"` if a `\r\n` pair is found before any lone `\n` or
|
|
18
|
+
* `\r`; `"cr"` for legacy Mac files using bare `\r`; `"lf"` otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectLineEnding(text: string): LineEnding;
|
|
21
|
+
/**
|
|
22
|
+
* Normalise every line ending in `text` to a single `\n`. Accepts CRLF,
|
|
23
|
+
* lone CR, and lone LF inputs and returns a string with only `\n`
|
|
24
|
+
* separators — safe to pass into parsers and formatters that assume LF.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeLineEndings(text: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Convert every `\n` in `text` to the requested line ending. Used by the
|
|
29
|
+
* formatter to restore the source file's convention on write-back so
|
|
30
|
+
* round-trips are byte-stable.
|
|
31
|
+
*/
|
|
32
|
+
export declare function applyLineEnding(text: string, ending: LineEnding): string;
|
|
33
|
+
//# sourceMappingURL=line_endings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line_endings.d.ts","sourceRoot":"","sources":["../../src/util/line_endings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,4DAA4D;AAC5D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CASzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CASxE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/line_endings
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform line-ending helpers. MarkSpec normalises every input to
|
|
5
|
+
* `\n` at the parse and format boundaries so the rest of the toolchain
|
|
6
|
+
* never sees stray `\r` characters. The formatter detects the original
|
|
7
|
+
* file's convention and restores it on write-back, so a CRLF file stays
|
|
8
|
+
* CRLF after `markspec format` round-trips through the AST.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Detect the dominant line-ending convention of a text. Inspects the
|
|
12
|
+
* first newline-bearing region and falls back to `"lf"` for inputs with
|
|
13
|
+
* no line breaks at all.
|
|
14
|
+
*
|
|
15
|
+
* Returns `"crlf"` if a `\r\n` pair is found before any lone `\n` or
|
|
16
|
+
* `\r`; `"cr"` for legacy Mac files using bare `\r`; `"lf"` otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export function detectLineEnding(text) {
|
|
19
|
+
for (let i = 0; i < text.length; i++) {
|
|
20
|
+
const c = text.charCodeAt(i);
|
|
21
|
+
if (c === 0x0a)
|
|
22
|
+
return "lf"; // \n without preceding \r
|
|
23
|
+
if (c === 0x0d) {
|
|
24
|
+
return text.charCodeAt(i + 1) === 0x0a ? "crlf" : "cr";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return "lf";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Normalise every line ending in `text` to a single `\n`. Accepts CRLF,
|
|
31
|
+
* lone CR, and lone LF inputs and returns a string with only `\n`
|
|
32
|
+
* separators — safe to pass into parsers and formatters that assume LF.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizeLineEndings(text) {
|
|
35
|
+
if (text.indexOf("\r") < 0)
|
|
36
|
+
return text;
|
|
37
|
+
return text.replace(/\r\n?/g, "\n");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Convert every `\n` in `text` to the requested line ending. Used by the
|
|
41
|
+
* formatter to restore the source file's convention on write-back so
|
|
42
|
+
* round-trips are byte-stable.
|
|
43
|
+
*/
|
|
44
|
+
export function applyLineEnding(text, ending) {
|
|
45
|
+
switch (ending) {
|
|
46
|
+
case "lf":
|
|
47
|
+
return text;
|
|
48
|
+
case "crlf":
|
|
49
|
+
return text.replace(/\n/g, "\r\n");
|
|
50
|
+
case "cr":
|
|
51
|
+
return text.replace(/\n/g, "\r");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/modals
|
|
3
|
+
*
|
|
4
|
+
* RFC 2119 and EARS modal-keyword helpers shared by `formatter/mod.ts`
|
|
5
|
+
* and `ast/normalize.ts`. Extracted to `core/util/` to avoid a dep cycle:
|
|
6
|
+
* `ast/` is a dependency of `formatter/`, so `formatter → ast` is OK but
|
|
7
|
+
* `ast → formatter` is not.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* RFC 2119 modal keywords in uppercase form, with optional ` NOT` suffix.
|
|
11
|
+
* Captured for canonical-form normalisation per spec §3.4.1: uppercase
|
|
12
|
+
* input is accepted but emitted lowercase, unconditionally.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RFC2119_MODAL_RE: RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* EARS keywords subject to the sentence-initial rule of spec §3.4.1:
|
|
17
|
+
* lowercased when mid-sentence, preserved when starting a sentence.
|
|
18
|
+
* `If…then` is deferred to a later slice because its multi-token form
|
|
19
|
+
* needs separate handling.
|
|
20
|
+
*/
|
|
21
|
+
export declare const EARS_KEYWORD_RE: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* Decide whether the EARS keyword at `offset` in `line` is at sentence
|
|
24
|
+
* start (return value true). Walks left over whitespace and reports true
|
|
25
|
+
* when it hits the beginning of the line or a sentence-terminating
|
|
26
|
+
* punctuation character (`.`, `!`, `?`).
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSentenceInitial(line: string, offset: number): boolean;
|
|
29
|
+
//# sourceMappingURL=modals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modals.d.ts","sourceRoot":"","sources":["../../src/util/modals.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAA0C,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAmC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/modals
|
|
3
|
+
*
|
|
4
|
+
* RFC 2119 and EARS modal-keyword helpers shared by `formatter/mod.ts`
|
|
5
|
+
* and `ast/normalize.ts`. Extracted to `core/util/` to avoid a dep cycle:
|
|
6
|
+
* `ast/` is a dependency of `formatter/`, so `formatter → ast` is OK but
|
|
7
|
+
* `ast → formatter` is not.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* RFC 2119 modal keywords in uppercase form, with optional ` NOT` suffix.
|
|
11
|
+
* Captured for canonical-form normalisation per spec §3.4.1: uppercase
|
|
12
|
+
* input is accepted but emitted lowercase, unconditionally.
|
|
13
|
+
*/
|
|
14
|
+
export const RFC2119_MODAL_RE = /\b(SHALL|SHOULD|MAY|MUST)(\s+NOT)?\b/g;
|
|
15
|
+
/**
|
|
16
|
+
* EARS keywords subject to the sentence-initial rule of spec §3.4.1:
|
|
17
|
+
* lowercased when mid-sentence, preserved when starting a sentence.
|
|
18
|
+
* `If…then` is deferred to a later slice because its multi-token form
|
|
19
|
+
* needs separate handling.
|
|
20
|
+
*/
|
|
21
|
+
export const EARS_KEYWORD_RE = /\b(When|While|Where|Unless)\b/g;
|
|
22
|
+
/**
|
|
23
|
+
* Decide whether the EARS keyword at `offset` in `line` is at sentence
|
|
24
|
+
* start (return value true). Walks left over whitespace and reports true
|
|
25
|
+
* when it hits the beginning of the line or a sentence-terminating
|
|
26
|
+
* punctuation character (`.`, `!`, `?`).
|
|
27
|
+
*/
|
|
28
|
+
export function isSentenceInitial(line, offset) {
|
|
29
|
+
if (offset === 0)
|
|
30
|
+
return true;
|
|
31
|
+
let i = offset - 1;
|
|
32
|
+
while (i >= 0 && (line[i] === " " || line[i] === "\t"))
|
|
33
|
+
i--;
|
|
34
|
+
if (i < 0)
|
|
35
|
+
return true;
|
|
36
|
+
const prev = line[i];
|
|
37
|
+
return prev === "." || prev === "!" || prev === "?";
|
|
38
|
+
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import type { AttrDecl, Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
14
|
/**
|
|
15
15
|
* Effective attribute declarations and required list for an entry, derived
|
|
16
|
-
* from the profile's universal
|
|
16
|
+
* from the profile's universal and (when classified) type scopes.
|
|
17
17
|
*
|
|
18
18
|
* Scope layering (outer → inner):
|
|
19
|
-
* universal →
|
|
19
|
+
* universal → types.<T>
|
|
20
20
|
*
|
|
21
21
|
* Name collisions: inner scope wins. Required lists are concatenated in
|
|
22
22
|
* scope order (universal first, type last) preserving duplicates across
|
|
@@ -28,7 +28,7 @@ export interface EffectiveAttrScope {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Compute the effective attribute scope for a given entry against the
|
|
31
|
-
* profile. Uses universal
|
|
31
|
+
* profile. Uses universal scope always; adds type scope only when
|
|
32
32
|
* `entry.type` is set and the type is declared in the profile.
|
|
33
33
|
*/
|
|
34
34
|
export declare function effectiveScope(entry: Entry, profile: EffectiveProfile): EffectiveAttrScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,kBAAkB,CAoCpB;AAqBD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,UAAU,EAAE,CA4Ed"}
|
|
@@ -20,25 +20,16 @@ const CORE_RESERVED_KEYS = new Set([
|
|
|
20
20
|
]);
|
|
21
21
|
/**
|
|
22
22
|
* Compute the effective attribute scope for a given entry against the
|
|
23
|
-
* profile. Uses universal
|
|
23
|
+
* profile. Uses universal scope always; adds type scope only when
|
|
24
24
|
* `entry.type` is set and the type is declared in the profile.
|
|
25
25
|
*/
|
|
26
26
|
export function effectiveScope(entry, profile) {
|
|
27
27
|
const required = [];
|
|
28
28
|
const attributes = new Map();
|
|
29
29
|
// Universal scope.
|
|
30
|
-
required.push(...profile.required.value);
|
|
31
30
|
for (const [name, attrEntry] of profile.attributes) {
|
|
32
31
|
attributes.set(name, attrEntry.value);
|
|
33
32
|
}
|
|
34
|
-
// Shape scope.
|
|
35
|
-
const shapeScope = entry.shape === "identified"
|
|
36
|
-
? profile.identified
|
|
37
|
-
: profile.referenced;
|
|
38
|
-
required.push(...shapeScope.required.value);
|
|
39
|
-
for (const [name, e] of shapeScope.attributes) {
|
|
40
|
-
attributes.set(name, e.value);
|
|
41
|
-
}
|
|
42
33
|
// Type scope (only when classified).
|
|
43
34
|
if (entry.type !== undefined) {
|
|
44
35
|
const typeEntry = profile.types.get(entry.type);
|
|
@@ -53,14 +44,6 @@ export function effectiveScope(entry, profile) {
|
|
|
53
44
|
// names that aren't explicitly declared as attributes. A trace rule IS an
|
|
54
45
|
// id-list attribute by definition — profile authors shouldn't have to
|
|
55
46
|
// declare it in both places.
|
|
56
|
-
const shapeTrace = entry.shape === "identified"
|
|
57
|
-
? profile.identified.traceability
|
|
58
|
-
: profile.referenced.traceability;
|
|
59
|
-
for (const [name] of shapeTrace) {
|
|
60
|
-
if (!attributes.has(name)) {
|
|
61
|
-
attributes.set(name, synthesizedLinkAttr(name));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
47
|
if (entry.type !== undefined) {
|
|
65
48
|
const typeEntry = profile.types.get(entry.type);
|
|
66
49
|
if (typeEntry !== undefined) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/body_blocks
|
|
3
|
+
*
|
|
4
|
+
* Body-block exclusion validator (spec §2.4.1). Detects constructs
|
|
5
|
+
* forbidden inside entry bodies:
|
|
6
|
+
*
|
|
7
|
+
* - MSL-B040 — headings
|
|
8
|
+
* - MSL-B041 — horizontal rules
|
|
9
|
+
* - MSL-B042 — task lists
|
|
10
|
+
* - MSL-B043 — raw HTML other than `<!-- markspec:* -->` directive
|
|
11
|
+
* comments
|
|
12
|
+
*
|
|
13
|
+
* Each excluded construct maps to a distinct AST node kind or property:
|
|
14
|
+
*
|
|
15
|
+
* - Headings → `UnknownNode` with `subkind: "heading"`
|
|
16
|
+
* - HR → `UnknownNode` with `subkind: "thematic-break"`
|
|
17
|
+
* - Task list → `ListNode` with `hasTaskItems: true`
|
|
18
|
+
* - Block HTML → `UnknownNode` with `subkind: "html"` (raw checked for
|
|
19
|
+
* the markspec-directive carve-out)
|
|
20
|
+
* - Inline HTML — remains inside `ParagraphNode.content.text` (remark
|
|
21
|
+
* does not extract inline HTML nodes into block-level nodes); each
|
|
22
|
+
* paragraph's text is scanned line-by-line using the same regex
|
|
23
|
+
* approach as the old walkProseLines path, but bounded to prose-only
|
|
24
|
+
* nodes (code/feature/math blocks are automatically excluded because
|
|
25
|
+
* the builder does not emit prose-bearing nodes for verbatim content).
|
|
26
|
+
*
|
|
27
|
+
* Code, Feature, and Math blocks are automatically excluded because the
|
|
28
|
+
* builder emits opaque nodes for verbatim content — no prose text to scan.
|
|
29
|
+
*/
|
|
30
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
31
|
+
/**
|
|
32
|
+
* Validate that an entry's body contains none of the excluded body
|
|
33
|
+
* constructs. Emits at most one diagnostic per excluded construct per
|
|
34
|
+
* line (so a paragraph with `<div>foo</div><span>bar</span>` still
|
|
35
|
+
* fires MSL-B043 once for that line).
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateBodyBlocks(entry: Entry): readonly Diagnostic[];
|
|
38
|
+
//# sourceMappingURL=body_blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body_blocks.d.ts","sourceRoot":"","sources":["../../src/validator/body_blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAkMzD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAsBtE"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/body_blocks
|
|
3
|
+
*
|
|
4
|
+
* Body-block exclusion validator (spec §2.4.1). Detects constructs
|
|
5
|
+
* forbidden inside entry bodies:
|
|
6
|
+
*
|
|
7
|
+
* - MSL-B040 — headings
|
|
8
|
+
* - MSL-B041 — horizontal rules
|
|
9
|
+
* - MSL-B042 — task lists
|
|
10
|
+
* - MSL-B043 — raw HTML other than `<!-- markspec:* -->` directive
|
|
11
|
+
* comments
|
|
12
|
+
*
|
|
13
|
+
* Each excluded construct maps to a distinct AST node kind or property:
|
|
14
|
+
*
|
|
15
|
+
* - Headings → `UnknownNode` with `subkind: "heading"`
|
|
16
|
+
* - HR → `UnknownNode` with `subkind: "thematic-break"`
|
|
17
|
+
* - Task list → `ListNode` with `hasTaskItems: true`
|
|
18
|
+
* - Block HTML → `UnknownNode` with `subkind: "html"` (raw checked for
|
|
19
|
+
* the markspec-directive carve-out)
|
|
20
|
+
* - Inline HTML — remains inside `ParagraphNode.content.text` (remark
|
|
21
|
+
* does not extract inline HTML nodes into block-level nodes); each
|
|
22
|
+
* paragraph's text is scanned line-by-line using the same regex
|
|
23
|
+
* approach as the old walkProseLines path, but bounded to prose-only
|
|
24
|
+
* nodes (code/feature/math blocks are automatically excluded because
|
|
25
|
+
* the builder does not emit prose-bearing nodes for verbatim content).
|
|
26
|
+
*
|
|
27
|
+
* Code, Feature, and Math blocks are automatically excluded because the
|
|
28
|
+
* builder emits opaque nodes for verbatim content — no prose text to scan.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* HTML tag detection. Matches an opening, closing, or self-closing tag
|
|
32
|
+
* (`<tag>`, `</tag>`, `<tag/>`). Doesn't match HTML comments — those
|
|
33
|
+
* are handled by {@linkcode HTML_COMMENT_RE} below so we can allow
|
|
34
|
+
* markspec directive comments while still flagging arbitrary HTML
|
|
35
|
+
* comments (which spec §2.4.1 forbids).
|
|
36
|
+
*/
|
|
37
|
+
const HTML_TAG_RE = /<\/?[A-Za-z][A-Za-z0-9]*(\s[^>]*)?\/?>/;
|
|
38
|
+
/** Any HTML comment, `<!--…-->`. */
|
|
39
|
+
const HTML_COMMENT_RE = /<!--[\s\S]*?-->/;
|
|
40
|
+
/**
|
|
41
|
+
* A whole-line markspec directive comment: `<!-- markspec:<rest> -->`
|
|
42
|
+
* occupying the line on its own (optional leading/trailing
|
|
43
|
+
* whitespace). The directive form is the one exception spec §2.4.1
|
|
44
|
+
* carves out from the "no raw HTML" rule.
|
|
45
|
+
*/
|
|
46
|
+
const MARKSPEC_DIRECTIVE_LINE_RE = /^\s*<!--\s*markspec:[\s\S]*?-->\s*$/;
|
|
47
|
+
/**
|
|
48
|
+
* Return `true` when `line` contains raw HTML the body model forbids:
|
|
49
|
+
* any tag, or any comment that isn't a standalone markspec directive.
|
|
50
|
+
*/
|
|
51
|
+
function hasForbiddenHtml(line) {
|
|
52
|
+
if (HTML_TAG_RE.test(line))
|
|
53
|
+
return true;
|
|
54
|
+
if (HTML_COMMENT_RE.test(line) && !MARKSPEC_DIRECTIVE_LINE_RE.test(line)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const HEADING_DIAG = {
|
|
60
|
+
code: "MSL-B040",
|
|
61
|
+
severity: "error",
|
|
62
|
+
summary: "heading inside entry body — entries are flat (spec §2.4.1)",
|
|
63
|
+
};
|
|
64
|
+
const HR_DIAG = {
|
|
65
|
+
code: "MSL-B041",
|
|
66
|
+
severity: "error",
|
|
67
|
+
summary: "horizontal rule inside entry body — entry boundaries already separate content (spec §2.4.1)",
|
|
68
|
+
};
|
|
69
|
+
const TASK_LIST_DIAG = {
|
|
70
|
+
code: "MSL-B042",
|
|
71
|
+
severity: "error",
|
|
72
|
+
summary: "task list inside entry body — semantics conflict with traceability state (spec §2.4.1)",
|
|
73
|
+
};
|
|
74
|
+
const RAW_HTML_DIAG = {
|
|
75
|
+
code: "MSL-B043",
|
|
76
|
+
severity: "error",
|
|
77
|
+
summary: "raw HTML inside entry body — only `<!-- markspec:* -->` directive comments are permitted (spec §2.4.1)",
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Scan `text` line-by-line for forbidden inline HTML, starting at
|
|
81
|
+
* `startLine` (1-based body-relative). Returns one `{ diag, bodyLine }`
|
|
82
|
+
* pair per violating line — the same shape returned by
|
|
83
|
+
* {@linkcode violationsFromBlock}.
|
|
84
|
+
*
|
|
85
|
+
* Each branch in `violationsFromBlock` that checks for inline HTML
|
|
86
|
+
* supplies its own `text` source (prose text for paragraph/note/blockquote,
|
|
87
|
+
* verbatim raw source for table) and its own `startLine` anchor; this
|
|
88
|
+
* helper factors the shared scan loop while preserving per-branch inputs.
|
|
89
|
+
*/
|
|
90
|
+
function htmlViolations(text, startLine) {
|
|
91
|
+
const out = [];
|
|
92
|
+
const lines = text.split("\n");
|
|
93
|
+
for (let li = 0; li < lines.length; li++) {
|
|
94
|
+
const line = lines[li];
|
|
95
|
+
if (line.trim() === "")
|
|
96
|
+
continue;
|
|
97
|
+
if (hasForbiddenHtml(line)) {
|
|
98
|
+
out.push({ diag: RAW_HTML_DIAG, bodyLine: startLine + li });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// AST-based exclusion walker
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
/**
|
|
107
|
+
* Collect body-block exclusion violations from a single BodyBlock.
|
|
108
|
+
* Returns an array of `{ diag, bodyLine }` pairs where `bodyLine` is the
|
|
109
|
+
* 1-based body-relative line number of the violation (maps to file line via
|
|
110
|
+
* `entry.location.line + bodyLine`).
|
|
111
|
+
*/
|
|
112
|
+
function violationsFromBlock(block) {
|
|
113
|
+
const out = [];
|
|
114
|
+
switch (block.kind) {
|
|
115
|
+
case "unknown": {
|
|
116
|
+
const bodyLine = block.range.start.line;
|
|
117
|
+
if (block.subkind === "heading") {
|
|
118
|
+
out.push({ diag: HEADING_DIAG, bodyLine });
|
|
119
|
+
}
|
|
120
|
+
else if (block.subkind === "thematic-break") {
|
|
121
|
+
out.push({ diag: HR_DIAG, bodyLine });
|
|
122
|
+
}
|
|
123
|
+
else if (block.subkind === "html") {
|
|
124
|
+
// Block-level HTML: check if it is a markspec directive (exempt)
|
|
125
|
+
// or forbidden HTML. The `raw` field carries the verbatim source.
|
|
126
|
+
if (!MARKSPEC_DIRECTIVE_LINE_RE.test(block.raw)) {
|
|
127
|
+
out.push({ diag: RAW_HTML_DIAG, bodyLine });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "list": {
|
|
133
|
+
if (block.hasTaskItems) {
|
|
134
|
+
out.push({ diag: TASK_LIST_DIAG, bodyLine: block.range.start.line });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// Non-task list: recurse into items to catch nested excluded blocks.
|
|
138
|
+
for (const item of block.items) {
|
|
139
|
+
for (const sub of item.blocks) {
|
|
140
|
+
out.push(...violationsFromBlock(sub));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "paragraph": {
|
|
147
|
+
// Inline HTML remains inside paragraph text (remark does not
|
|
148
|
+
// surface it as a separate block node). Scan each line of the
|
|
149
|
+
// paragraph's prose text for forbidden HTML.
|
|
150
|
+
out.push(...htmlViolations(block.content.text, block.range.start.line));
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
// Prose-bearing nodes that are not forbidden — scan for inline HTML.
|
|
154
|
+
case "note":
|
|
155
|
+
case "blockquote": {
|
|
156
|
+
out.push(...htmlViolations(block.content.text, block.range.start.line));
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
// Table cells may contain inline HTML.
|
|
160
|
+
case "table": {
|
|
161
|
+
// Tables are in-scope for HTML scanning but their cell text is
|
|
162
|
+
// structured. Scan the raw table source line-by-line instead,
|
|
163
|
+
// since the `raw` field contains the verbatim source and avoids
|
|
164
|
+
// needing to reconstruct cell content per-line. The raw field's
|
|
165
|
+
// line offsets start at `range.start.line`.
|
|
166
|
+
out.push(...htmlViolations(block.raw, block.range.start.line));
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "definition-list": {
|
|
170
|
+
// Definition list items may contain inline HTML in term/definition.
|
|
171
|
+
for (const item of block.items) {
|
|
172
|
+
out.push(...htmlViolations(item.term.text, block.range.start.line));
|
|
173
|
+
out.push(...htmlViolations(item.definition.text, block.range.start.line));
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
// Verbatim / structural nodes: no prose to scan.
|
|
178
|
+
case "code":
|
|
179
|
+
case "feature":
|
|
180
|
+
case "math":
|
|
181
|
+
case "figure":
|
|
182
|
+
case "caption":
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// Public API
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
/**
|
|
193
|
+
* Validate that an entry's body contains none of the excluded body
|
|
194
|
+
* constructs. Emits at most one diagnostic per excluded construct per
|
|
195
|
+
* line (so a paragraph with `<div>foo</div><span>bar</span>` still
|
|
196
|
+
* fires MSL-B043 once for that line).
|
|
197
|
+
*/
|
|
198
|
+
export function validateBodyBlocks(entry) {
|
|
199
|
+
const diagnostics = [];
|
|
200
|
+
const blocks = entry.bodyAst ?? [];
|
|
201
|
+
for (const block of blocks) {
|
|
202
|
+
for (const { diag, bodyLine } of violationsFromBlock(block)) {
|
|
203
|
+
diagnostics.push({
|
|
204
|
+
code: diag.code,
|
|
205
|
+
severity: diag.severity,
|
|
206
|
+
message: `${entry.displayId}: ${diag.summary}`,
|
|
207
|
+
location: {
|
|
208
|
+
file: entry.location.file,
|
|
209
|
+
// bodyLine is 1-based body-relative. Body line 1 = file line
|
|
210
|
+
// entry.location.line + 1 (the line after the title).
|
|
211
|
+
line: entry.location.line + bodyLine,
|
|
212
|
+
column: 1,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return diagnostics;
|
|
218
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/caption_convention
|
|
3
|
+
*
|
|
4
|
+
* MSL-C072 validator — caption position violates project-configured
|
|
5
|
+
* convention (docs/specs/markspec-core-data-model.md §4.7).
|
|
6
|
+
*
|
|
7
|
+
* When `project.yaml` carries a `caption-conventions` map, each caption
|
|
8
|
+
* whose `position` disagrees with the configured position for its keyword
|
|
9
|
+
* fires MSL-C072 (warning). Keywords not present in the map are
|
|
10
|
+
* unconstrained and this validator is silent for them.
|
|
11
|
+
*
|
|
12
|
+
* If no conventions are configured (the map is empty or absent) the
|
|
13
|
+
* validator emits no diagnostics — the rule is inactive.
|
|
14
|
+
*
|
|
15
|
+
* This is an AST-only check: `CaptionNode.position` is set by the builder
|
|
16
|
+
* (`core/ast/build.ts`) from the source order of the caption relative to
|
|
17
|
+
* its captionable block.
|
|
18
|
+
*/
|
|
19
|
+
import type { CaptionConventions, Diagnostic, Entry } from "../model/mod.js";
|
|
20
|
+
/**
|
|
21
|
+
* Validate caption positions against the project-configured conventions.
|
|
22
|
+
*
|
|
23
|
+
* @param entry - The entry whose body AST is scanned for captions.
|
|
24
|
+
* @param conventions - The configured position conventions from
|
|
25
|
+
* `ProjectConfig.captionConventions`. An empty record means no
|
|
26
|
+
* conventions are set and the function returns immediately.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateCaptionConvention(entry: Entry, conventions: CaptionConventions): readonly Diagnostic[];
|
|
29
|
+
//# sourceMappingURL=caption_convention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caption_convention.d.ts","sourceRoot":"","sources":["../../src/validator/caption_convention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,kBAAkB,GAC9B,SAAS,UAAU,EAAE,CAmCvB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/caption_convention
|
|
3
|
+
*
|
|
4
|
+
* MSL-C072 validator — caption position violates project-configured
|
|
5
|
+
* convention (docs/specs/markspec-core-data-model.md §4.7).
|
|
6
|
+
*
|
|
7
|
+
* When `project.yaml` carries a `caption-conventions` map, each caption
|
|
8
|
+
* whose `position` disagrees with the configured position for its keyword
|
|
9
|
+
* fires MSL-C072 (warning). Keywords not present in the map are
|
|
10
|
+
* unconstrained and this validator is silent for them.
|
|
11
|
+
*
|
|
12
|
+
* If no conventions are configured (the map is empty or absent) the
|
|
13
|
+
* validator emits no diagnostics — the rule is inactive.
|
|
14
|
+
*
|
|
15
|
+
* This is an AST-only check: `CaptionNode.position` is set by the builder
|
|
16
|
+
* (`core/ast/build.ts`) from the source order of the caption relative to
|
|
17
|
+
* its captionable block.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Validate caption positions against the project-configured conventions.
|
|
21
|
+
*
|
|
22
|
+
* @param entry - The entry whose body AST is scanned for captions.
|
|
23
|
+
* @param conventions - The configured position conventions from
|
|
24
|
+
* `ProjectConfig.captionConventions`. An empty record means no
|
|
25
|
+
* conventions are set and the function returns immediately.
|
|
26
|
+
*/
|
|
27
|
+
export function validateCaptionConvention(entry, conventions) {
|
|
28
|
+
// Fast-path: no conventions configured → rule inactive.
|
|
29
|
+
if (Object.keys(conventions).length === 0)
|
|
30
|
+
return [];
|
|
31
|
+
const blocks = entry.bodyAst ?? [];
|
|
32
|
+
const diagnostics = [];
|
|
33
|
+
for (const block of blocks) {
|
|
34
|
+
if (block.kind !== "caption")
|
|
35
|
+
continue;
|
|
36
|
+
const expected = conventions[block.keyword];
|
|
37
|
+
// No convention configured for this keyword → skip.
|
|
38
|
+
if (expected === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
// Convention is satisfied → no diagnostic.
|
|
41
|
+
if (block.position === expected)
|
|
42
|
+
continue;
|
|
43
|
+
const fileLine = entry.location.line + block.range.start.line;
|
|
44
|
+
diagnostics.push({
|
|
45
|
+
code: "MSL-C072",
|
|
46
|
+
severity: "warning",
|
|
47
|
+
message: `${entry.displayId}: ${block.keyword}: caption appears ${block.position} ` +
|
|
48
|
+
`its block but the project convention requires it to be ${expected} ` +
|
|
49
|
+
`(spec §4.7; configure under 'caption-conventions' in project.yaml)`,
|
|
50
|
+
location: {
|
|
51
|
+
file: entry.location.file,
|
|
52
|
+
line: fileLine,
|
|
53
|
+
column: 1,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return diagnostics;
|
|
58
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/captions
|
|
3
|
+
*
|
|
4
|
+
* Caption-adjacency validation per spec §2.6. Emits `MSL-C070` for
|
|
5
|
+
* orphaned captions (no captionable neighbour) and `MSL-C071` for
|
|
6
|
+
* wrong-type adjacency. The builder emits `CaptionNode` blocks with a
|
|
7
|
+
* `keyword` field (Figure, Table, etc.) and a `position` hint
|
|
8
|
+
* ("above"/"below"); the validator checks each caption against its
|
|
9
|
+
* nearest non-blank neighbour. Captions inside verbatim blocks are
|
|
10
|
+
* automatically excluded — the builder does not emit `CaptionNode`s for
|
|
11
|
+
* verbatim content. The "Listing or Feature" ambiguity (a fenced block
|
|
12
|
+
* without a lang tag is ambiguous) is preserved in the mismatch message.
|
|
13
|
+
*/
|
|
14
|
+
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
15
|
+
/**
|
|
16
|
+
* Validate caption adjacency for one entry. Emits `MSL-C070` for any
|
|
17
|
+
* caption whose nearest non-blank neighbour (above or below) is not a
|
|
18
|
+
* captionable block of the matching type, and `MSL-C071` when there is
|
|
19
|
+
* a captionable block of the *wrong* type adjacent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateCaptions(entry: Entry): readonly Diagnostic[];
|
|
22
|
+
//# sourceMappingURL=captions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captions.d.ts","sourceRoot":"","sources":["../../src/validator/captions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAoDzD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAsFpE"}
|