@alisio/plugin-thesis 0.1.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/.agents/agents/thesis-architect.md +38 -0
- package/.agents/agents/thesis-coordinator.md +39 -0
- package/.agents/agents/thesis-editor.md +35 -0
- package/.agents/agents/thesis-evidence-auditor.md +37 -0
- package/.agents/agents/thesis-librarian.md +38 -0
- package/.agents/agents/thesis-methodologist.md +39 -0
- package/.agents/agents/thesis-reviewer.md +36 -0
- package/.agents/agents/thesis-writer.md +38 -0
- package/.agents/skills/thesis-build/SKILL.md +48 -0
- package/.agents/skills/thesis-citations/SKILL.md +49 -0
- package/.agents/skills/thesis-csl-authoring/SKILL.md +48 -0
- package/.agents/skills/thesis-editing/SKILL.md +49 -0
- package/.agents/skills/thesis-evidence/SKILL.md +48 -0
- package/.agents/skills/thesis-figures/SKILL.md +50 -0
- package/.agents/skills/thesis-institution-norms/SKILL.md +50 -0
- package/.agents/skills/thesis-intake/SKILL.md +48 -0
- package/.agents/skills/thesis-math/SKILL.md +48 -0
- package/.agents/skills/thesis-methodology/SKILL.md +49 -0
- package/.agents/skills/thesis-outline/SKILL.md +48 -0
- package/.agents/skills/thesis-policy/SKILL.md +48 -0
- package/.agents/skills/thesis-review/SKILL.md +49 -0
- package/.agents/skills/thesis-search/SKILL.md +47 -0
- package/.agents/skills/thesis-writing/SKILL.md +52 -0
- package/LICENSE +21 -0
- package/README.es.md +242 -0
- package/README.md +235 -0
- package/THIRD_PARTY_NOTICES.md +94 -0
- package/assets/architecture.svg +1 -0
- package/assets/evidence-pipeline.svg +1 -0
- package/assets/lifecycle.svg +1 -0
- package/assets/policy-resolution.svg +1 -0
- package/cover.webp +0 -0
- package/dist/authoring.d.ts +30 -0
- package/dist/authoring.d.ts.map +1 -0
- package/dist/authoring.js +681 -0
- package/dist/authoring.js.map +1 -0
- package/dist/brief.d.ts +40 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +566 -0
- package/dist/brief.js.map +1 -0
- package/dist/cache.d.ts +8 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +20 -0
- package/dist/cache.js.map +1 -0
- package/dist/checks/brief.d.ts +5 -0
- package/dist/checks/brief.d.ts.map +1 -0
- package/dist/checks/brief.js +38 -0
- package/dist/checks/brief.js.map +1 -0
- package/dist/checks/citations.d.ts +14 -0
- package/dist/checks/citations.d.ts.map +1 -0
- package/dist/checks/citations.js +87 -0
- package/dist/checks/citations.js.map +1 -0
- package/dist/checks/claims.d.ts +16 -0
- package/dist/checks/claims.d.ts.map +1 -0
- package/dist/checks/claims.js +147 -0
- package/dist/checks/claims.js.map +1 -0
- package/dist/checks/closing.d.ts +20 -0
- package/dist/checks/closing.d.ts.map +1 -0
- package/dist/checks/closing.js +168 -0
- package/dist/checks/closing.js.map +1 -0
- package/dist/checks/design.d.ts +5 -0
- package/dist/checks/design.d.ts.map +1 -0
- package/dist/checks/design.js +107 -0
- package/dist/checks/design.js.map +1 -0
- package/dist/checks/document.d.ts +17 -0
- package/dist/checks/document.d.ts.map +1 -0
- package/dist/checks/document.js +213 -0
- package/dist/checks/document.js.map +1 -0
- package/dist/checks/evidence.d.ts +7 -0
- package/dist/checks/evidence.d.ts.map +1 -0
- package/dist/checks/evidence.js +133 -0
- package/dist/checks/evidence.js.map +1 -0
- package/dist/checks/hygiene.d.ts +5 -0
- package/dist/checks/hygiene.d.ts.map +1 -0
- package/dist/checks/hygiene.js +37 -0
- package/dist/checks/hygiene.js.map +1 -0
- package/dist/checks/index.d.ts +21 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +98 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/checks/language.d.ts +14 -0
- package/dist/checks/language.d.ts.map +1 -0
- package/dist/checks/language.js +73 -0
- package/dist/checks/language.js.map +1 -0
- package/dist/checks/outline.d.ts +25 -0
- package/dist/checks/outline.d.ts.map +1 -0
- package/dist/checks/outline.js +214 -0
- package/dist/checks/outline.js.map +1 -0
- package/dist/checks/policy.d.ts +5 -0
- package/dist/checks/policy.d.ts.map +1 -0
- package/dist/checks/policy.js +129 -0
- package/dist/checks/policy.js.map +1 -0
- package/dist/checks/project.d.ts +65 -0
- package/dist/checks/project.d.ts.map +1 -0
- package/dist/checks/project.js +203 -0
- package/dist/checks/project.js.map +1 -0
- package/dist/checks/styles.d.ts +12 -0
- package/dist/checks/styles.d.ts.map +1 -0
- package/dist/checks/styles.js +67 -0
- package/dist/checks/styles.js.map +1 -0
- package/dist/checks/writing.d.ts +6 -0
- package/dist/checks/writing.d.ts.map +1 -0
- package/dist/checks/writing.js +115 -0
- package/dist/checks/writing.js.map +1 -0
- package/dist/chrome/detect.d.ts +19 -0
- package/dist/chrome/detect.d.ts.map +1 -0
- package/dist/chrome/detect.js +116 -0
- package/dist/chrome/detect.js.map +1 -0
- package/dist/claims.d.ts +19 -0
- package/dist/claims.d.ts.map +1 -0
- package/dist/claims.js +99 -0
- package/dist/claims.js.map +1 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +262 -0
- package/dist/cli.js.map +1 -0
- package/dist/context.d.ts +55 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +62 -0
- package/dist/context.js.map +1 -0
- package/dist/coordinator.d.ts +139 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +710 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/delegate.d.ts +34 -0
- package/dist/delegate.d.ts.map +1 -0
- package/dist/delegate.js +105 -0
- package/dist/delegate.js.map +1 -0
- package/dist/diffguard.d.ts +24 -0
- package/dist/diffguard.d.ts.map +1 -0
- package/dist/diffguard.js +92 -0
- package/dist/diffguard.js.map +1 -0
- package/dist/doctor.d.ts +34 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +155 -0
- package/dist/doctor.js.map +1 -0
- package/dist/draft.d.ts +64 -0
- package/dist/draft.d.ts.map +1 -0
- package/dist/draft.js +801 -0
- package/dist/draft.js.map +1 -0
- package/dist/figure.d.ts +13 -0
- package/dist/figure.d.ts.map +1 -0
- package/dist/figure.js +143 -0
- package/dist/figure.js.map +1 -0
- package/dist/finalize.d.ts +29 -0
- package/dist/finalize.d.ts.map +1 -0
- package/dist/finalize.js +230 -0
- package/dist/finalize.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -0
- package/dist/intake.d.ts +57 -0
- package/dist/intake.d.ts.map +1 -0
- package/dist/intake.js +772 -0
- package/dist/intake.js.map +1 -0
- package/dist/labels.d.ts +50 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +98 -0
- package/dist/labels.js.map +1 -0
- package/dist/outline.d.ts +45 -0
- package/dist/outline.d.ts.map +1 -0
- package/dist/outline.js +148 -0
- package/dist/outline.js.map +1 -0
- package/dist/pack-commands.d.ts +18 -0
- package/dist/pack-commands.d.ts.map +1 -0
- package/dist/pack-commands.js +397 -0
- package/dist/pack-commands.js.map +1 -0
- package/dist/package-paths.d.ts +8 -0
- package/dist/package-paths.d.ts.map +1 -0
- package/dist/package-paths.js +13 -0
- package/dist/package-paths.js.map +1 -0
- package/dist/policy/context.d.ts +19 -0
- package/dist/policy/context.d.ts.map +1 -0
- package/dist/policy/context.js +62 -0
- package/dist/policy/context.js.map +1 -0
- package/dist/policy/ethics.d.ts +59 -0
- package/dist/policy/ethics.d.ts.map +1 -0
- package/dist/policy/ethics.js +106 -0
- package/dist/policy/ethics.js.map +1 -0
- package/dist/policy/kinds.d.ts +9 -0
- package/dist/policy/kinds.d.ts.map +1 -0
- package/dist/policy/kinds.js +68 -0
- package/dist/policy/kinds.js.map +1 -0
- package/dist/policy/packs.d.ts +53 -0
- package/dist/policy/packs.d.ts.map +1 -0
- package/dist/policy/packs.js +336 -0
- package/dist/policy/packs.js.map +1 -0
- package/dist/policy/resolver.d.ts +87 -0
- package/dist/policy/resolver.d.ts.map +1 -0
- package/dist/policy/resolver.js +337 -0
- package/dist/policy/resolver.js.map +1 -0
- package/dist/policy/rules.d.ts +65 -0
- package/dist/policy/rules.d.ts.map +1 -0
- package/dist/policy/rules.js +194 -0
- package/dist/policy/rules.js.map +1 -0
- package/dist/protocol.d.ts +46 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +86 -0
- package/dist/protocol.js.map +1 -0
- package/dist/render/adapters/chrome-pdf/cdp.d.ts +36 -0
- package/dist/render/adapters/chrome-pdf/cdp.d.ts.map +1 -0
- package/dist/render/adapters/chrome-pdf/cdp.js +291 -0
- package/dist/render/adapters/chrome-pdf/cdp.js.map +1 -0
- package/dist/render/adapters/chrome-pdf/index.d.ts +10 -0
- package/dist/render/adapters/chrome-pdf/index.d.ts.map +1 -0
- package/dist/render/adapters/chrome-pdf/index.js +139 -0
- package/dist/render/adapters/chrome-pdf/index.js.map +1 -0
- package/dist/render/adapters/chrome-pdf/network.d.ts +7 -0
- package/dist/render/adapters/chrome-pdf/network.d.ts.map +1 -0
- package/dist/render/adapters/chrome-pdf/network.js +33 -0
- package/dist/render/adapters/chrome-pdf/network.js.map +1 -0
- package/dist/render/adapters/html-preview/index.d.ts +8 -0
- package/dist/render/adapters/html-preview/index.d.ts.map +1 -0
- package/dist/render/adapters/html-preview/index.js +62 -0
- package/dist/render/adapters/html-preview/index.js.map +1 -0
- package/dist/render/adapters/test-json/index.d.ts +8 -0
- package/dist/render/adapters/test-json/index.d.ts.map +1 -0
- package/dist/render/adapters/test-json/index.js +62 -0
- package/dist/render/adapters/test-json/index.js.map +1 -0
- package/dist/render/adapters/typst-pdf/emitter.d.ts +21 -0
- package/dist/render/adapters/typst-pdf/emitter.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/emitter.js +259 -0
- package/dist/render/adapters/typst-pdf/emitter.js.map +1 -0
- package/dist/render/adapters/typst-pdf/escape.d.ts +14 -0
- package/dist/render/adapters/typst-pdf/escape.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/escape.js +56 -0
- package/dist/render/adapters/typst-pdf/escape.js.map +1 -0
- package/dist/render/adapters/typst-pdf/index.d.ts +9 -0
- package/dist/render/adapters/typst-pdf/index.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/index.js +154 -0
- package/dist/render/adapters/typst-pdf/index.js.map +1 -0
- package/dist/render/adapters/typst-pdf/profile.d.ts +3 -0
- package/dist/render/adapters/typst-pdf/profile.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/profile.js +55 -0
- package/dist/render/adapters/typst-pdf/profile.js.map +1 -0
- package/dist/render/adapters/typst-pdf/runner.d.ts +52 -0
- package/dist/render/adapters/typst-pdf/runner.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/runner.js +209 -0
- package/dist/render/adapters/typst-pdf/runner.js.map +1 -0
- package/dist/render/adapters/typst-pdf/setup.d.ts +30 -0
- package/dist/render/adapters/typst-pdf/setup.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/setup.js +183 -0
- package/dist/render/adapters/typst-pdf/setup.js.map +1 -0
- package/dist/render/adapters/typst-pdf/version.d.ts +8 -0
- package/dist/render/adapters/typst-pdf/version.d.ts.map +1 -0
- package/dist/render/adapters/typst-pdf/version.js +14 -0
- package/dist/render/adapters/typst-pdf/version.js.map +1 -0
- package/dist/render/assemble.d.ts +28 -0
- package/dist/render/assemble.d.ts.map +1 -0
- package/dist/render/assemble.js +309 -0
- package/dist/render/assemble.js.map +1 -0
- package/dist/render/assets.d.ts +27 -0
- package/dist/render/assets.d.ts.map +1 -0
- package/dist/render/assets.js +232 -0
- package/dist/render/assets.js.map +1 -0
- package/dist/render/build.d.ts +43 -0
- package/dist/render/build.d.ts.map +1 -0
- package/dist/render/build.js +187 -0
- package/dist/render/build.js.map +1 -0
- package/dist/render/charts.d.ts +83 -0
- package/dist/render/charts.d.ts.map +1 -0
- package/dist/render/charts.js +633 -0
- package/dist/render/charts.js.map +1 -0
- package/dist/render/default-registry.d.ts +7 -0
- package/dist/render/default-registry.d.ts.map +1 -0
- package/dist/render/default-registry.js +15 -0
- package/dist/render/default-registry.js.map +1 -0
- package/dist/render/diagram-theme.d.ts +7 -0
- package/dist/render/diagram-theme.d.ts.map +1 -0
- package/dist/render/diagram-theme.js +50 -0
- package/dist/render/diagram-theme.js.map +1 -0
- package/dist/render/dialect.d.ts +23 -0
- package/dist/render/dialect.d.ts.map +1 -0
- package/dist/render/dialect.js +188 -0
- package/dist/render/dialect.js.map +1 -0
- package/dist/render/html/citations.d.ts +70 -0
- package/dist/render/html/citations.d.ts.map +1 -0
- package/dist/render/html/citations.js +371 -0
- package/dist/render/html/citations.js.map +1 -0
- package/dist/render/html/css.d.ts +14 -0
- package/dist/render/html/css.d.ts.map +1 -0
- package/dist/render/html/css.js +113 -0
- package/dist/render/html/css.js.map +1 -0
- package/dist/render/html/emitter.d.ts +20 -0
- package/dist/render/html/emitter.d.ts.map +1 -0
- package/dist/render/html/emitter.js +652 -0
- package/dist/render/html/emitter.js.map +1 -0
- package/dist/render/html/escape.d.ts +11 -0
- package/dist/render/html/escape.d.ts.map +1 -0
- package/dist/render/html/escape.js +32 -0
- package/dist/render/html/escape.js.map +1 -0
- package/dist/render/html/katex.d.ts +9 -0
- package/dist/render/html/katex.d.ts.map +1 -0
- package/dist/render/html/katex.js +39 -0
- package/dist/render/html/katex.js.map +1 -0
- package/dist/render/html/stage.d.ts +12 -0
- package/dist/render/html/stage.d.ts.map +1 -0
- package/dist/render/html/stage.js +30 -0
- package/dist/render/html/stage.js.map +1 -0
- package/dist/render/index.d.ts +5 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +5 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/math.d.ts +9 -0
- package/dist/render/math.d.ts.map +1 -0
- package/dist/render/math.js +60 -0
- package/dist/render/math.js.map +1 -0
- package/dist/render/model.d.ts +233 -0
- package/dist/render/model.d.ts.map +1 -0
- package/dist/render/model.js +2 -0
- package/dist/render/model.js.map +1 -0
- package/dist/render/numbering.d.ts +51 -0
- package/dist/render/numbering.d.ts.map +1 -0
- package/dist/render/numbering.js +155 -0
- package/dist/render/numbering.js.map +1 -0
- package/dist/render/output-name.d.ts +4 -0
- package/dist/render/output-name.d.ts.map +1 -0
- package/dist/render/output-name.js +11 -0
- package/dist/render/output-name.js.map +1 -0
- package/dist/render/palettes.d.ts +22 -0
- package/dist/render/palettes.d.ts.map +1 -0
- package/dist/render/palettes.js +46 -0
- package/dist/render/palettes.js.map +1 -0
- package/dist/render/parse.d.ts +15 -0
- package/dist/render/parse.d.ts.map +1 -0
- package/dist/render/parse.js +637 -0
- package/dist/render/parse.js.map +1 -0
- package/dist/render/port.d.ts +79 -0
- package/dist/render/port.d.ts.map +1 -0
- package/dist/render/port.js +2 -0
- package/dist/render/port.js.map +1 -0
- package/dist/render/registry.d.ts +11 -0
- package/dist/render/registry.d.ts.map +1 -0
- package/dist/render/registry.js +21 -0
- package/dist/render/registry.js.map +1 -0
- package/dist/render/text.d.ts +13 -0
- package/dist/render/text.d.ts.map +1 -0
- package/dist/render/text.js +65 -0
- package/dist/render/text.js.map +1 -0
- package/dist/render/walk.d.ts +13 -0
- package/dist/render/walk.d.ts.map +1 -0
- package/dist/render/walk.js +69 -0
- package/dist/render/walk.js.map +1 -0
- package/dist/research/bibtex.d.ts +12 -0
- package/dist/research/bibtex.d.ts.map +1 -0
- package/dist/research/bibtex.js +99 -0
- package/dist/research/bibtex.js.map +1 -0
- package/dist/research/client.d.ts +112 -0
- package/dist/research/client.d.ts.map +1 -0
- package/dist/research/client.js +661 -0
- package/dist/research/client.js.map +1 -0
- package/dist/research/dossier.d.ts +31 -0
- package/dist/research/dossier.d.ts.map +1 -0
- package/dist/research/dossier.js +54 -0
- package/dist/research/dossier.js.map +1 -0
- package/dist/research/flow.d.ts +31 -0
- package/dist/research/flow.d.ts.map +1 -0
- package/dist/research/flow.js +635 -0
- package/dist/research/flow.js.map +1 -0
- package/dist/research/library.d.ts +79 -0
- package/dist/research/library.d.ts.map +1 -0
- package/dist/research/library.js +319 -0
- package/dist/research/library.js.map +1 -0
- package/dist/research/verify.d.ts +80 -0
- package/dist/research/verify.d.ts.map +1 -0
- package/dist/research/verify.js +307 -0
- package/dist/research/verify.js.map +1 -0
- package/dist/resources.d.ts +15 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +148 -0
- package/dist/resources.js.map +1 -0
- package/dist/review.d.ts +22 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +355 -0
- package/dist/review.js.map +1 -0
- package/dist/schemas.d.ts +252 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +1020 -0
- package/dist/schemas.js.map +1 -0
- package/dist/sections.d.ts +30 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.js +62 -0
- package/dist/sections.js.map +1 -0
- package/dist/storage.d.ts +21 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +296 -0
- package/dist/storage.js.map +1 -0
- package/dist/style-commands.d.ts +15 -0
- package/dist/style-commands.d.ts.map +1 -0
- package/dist/style-commands.js +54 -0
- package/dist/style-commands.js.map +1 -0
- package/dist/styles/csl.d.ts +58 -0
- package/dist/styles/csl.d.ts.map +1 -0
- package/dist/styles/csl.js +112 -0
- package/dist/styles/csl.js.map +1 -0
- package/dist/styles/discovery.d.ts +45 -0
- package/dist/styles/discovery.d.ts.map +1 -0
- package/dist/styles/discovery.js +99 -0
- package/dist/styles/discovery.js.map +1 -0
- package/dist/styles/golden.d.ts +52 -0
- package/dist/styles/golden.d.ts.map +1 -0
- package/dist/styles/golden.js +216 -0
- package/dist/styles/golden.js.map +1 -0
- package/dist/styles/profile.d.ts +126 -0
- package/dist/styles/profile.d.ts.map +1 -0
- package/dist/styles/profile.js +582 -0
- package/dist/styles/profile.js.map +1 -0
- package/dist/styles/xml.d.ts +22 -0
- package/dist/styles/xml.d.ts.map +1 -0
- package/dist/styles/xml.js +179 -0
- package/dist/styles/xml.js.map +1 -0
- package/dist/types.d.ts +285 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +155 -0
- package/dist/types.js.map +1 -0
- package/dist/typst-pins.d.ts +16 -0
- package/dist/typst-pins.d.ts.map +1 -0
- package/dist/typst-pins.js +39 -0
- package/dist/typst-pins.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/workflow.d.ts +49 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +722 -0
- package/dist/workflow.js.map +1 -0
- package/dist/workspace.d.ts +12 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +71 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +70 -0
- package/policy-packs/countries/CO/academic-standards/ntc-1486-2022.yaml +188 -0
- package/policy-packs/countries/CO/copyright/decision-andina-351.yaml +61 -0
- package/policy-packs/countries/CO/copyright/ley-1915-2018.yaml +25 -0
- package/policy-packs/countries/CO/copyright/ley-23-1982.yaml +64 -0
- package/policy-packs/countries/CO/domains/health/resolucion-8430-1993.yaml +219 -0
- package/policy-packs/countries/CO/higher-education/ley-30-1992.yaml +61 -0
- package/policy-packs/countries/CO/manifest.yaml +42 -0
- package/policy-packs/countries/CO/official-domains.yaml +90 -0
- package/policy-packs/countries/CO/privacy/ley-1581-2012.yaml +197 -0
- package/policy-packs/countries/CO/research-integrity/minciencias-res-0314-2018.yaml +64 -0
- package/policy-packs/global/academic-integrity.yaml +45 -0
- package/policy-packs/global/academic-writing.yaml +70 -0
- package/policy-packs/global/evidence-quality.yaml +81 -0
- package/policy-packs/global/manifest.yaml +54 -0
- package/policy-packs/global/objective-verbs.yaml +245 -0
- package/policy-packs/global/reporting-guidelines.yaml +392 -0
- package/policy-packs/global/work-types.yaml +195 -0
- package/styles/LICENSE-CSL +375 -0
- package/styles/apa.csl +2283 -0
- package/styles/catalog.json +43 -0
- package/styles/fixtures/apa-7.expected.json +25 -0
- package/styles/fixtures/icontec-ntc1486-2022.expected.json +25 -0
- package/styles/fixtures/ieee.expected.json +25 -0
- package/styles/fixtures/references.jsonl +8 -0
- package/styles/icontec-ntc1486-2022.csl +388 -0
- package/styles/ieee.csl +519 -0
- package/templates/html/runtime.js +159 -0
- package/templates/html/thesis.css +98 -0
- package/templates/html/vendor/katex/LICENSE +21 -0
- package/templates/html/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/templates/html/vendor/katex/katex.min.css +1 -0
- package/templates/html/vendor/katex/katex.min.js +1 -0
- package/templates/html/vendor/mermaid/LICENSE +21 -0
- package/templates/html/vendor/mermaid/mermaid.min.js +3587 -0
- package/templates/html/vendor/pagedjs/LICENSE +21 -0
- package/templates/html/vendor/pagedjs/paged.polyfill.min.js +4 -0
- package/templates/palettes.json +57 -0
- package/templates/profiles/apa-7.profile.yaml +15 -0
- package/templates/profiles/generic.profile.yaml +20 -0
- package/templates/profiles/icontec-ntc1486-2022.profile.yaml +36 -0
- package/templates/profiles/ieee.profile.yaml +14 -0
- package/templates/typst/i18n/en.yaml +31 -0
- package/templates/typst/i18n/es.yaml +31 -0
- package/templates/typst/i18n/pt.yaml +31 -0
- package/templates/typst/thesis.typ +276 -0
- package/typst-packages/preview/merman/0.3.0/LICENSE +231 -0
- package/typst-packages/preview/merman/0.3.0/README.md +388 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/cose-base-v1/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/cose-base-v2/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/cytoscape/LICENSE +19 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/cytoscape-cose-bilkent/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/cytoscape-fcose/LICENSE +19 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/d3-shape/LICENSE +13 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/dagre/LICENSE +19 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/dompurify/LICENSE +202 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md +264 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/elkjs/LICENSE.md +264 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/fmin/LICENSE +27 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/graphlib/LICENSE +19 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/layout-base-v1/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/layout-base-v2/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/mermaid/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/rough-rs/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/roughjs/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/sanitize-url/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/venn-js/LICENSE +22 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/wasm-minimal-protocol/LICENSE +24 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_LICENSES/zenuml-core/LICENSE +21 -0
- package/typst-packages/preview/merman/0.3.0/THIRD_PARTY_NOTICES.md +265 -0
- package/typst-packages/preview/merman/0.3.0/lib.typ +1 -0
- package/typst-packages/preview/merman/0.3.0/merman_typst_plugin.wasm +0 -0
- package/typst-packages/preview/merman/0.3.0/src/capabilities.typ +5 -0
- package/typst-packages/preview/merman/0.3.0/src/context.typ +1 -0
- package/typst-packages/preview/merman/0.3.0/src/errors.typ +33 -0
- package/typst-packages/preview/merman/0.3.0/src/exports.typ +5 -0
- package/typst-packages/preview/merman/0.3.0/src/figure.typ +143 -0
- package/typst-packages/preview/merman/0.3.0/src/image.typ +50 -0
- package/typst-packages/preview/merman/0.3.0/src/options.typ +566 -0
- package/typst-packages/preview/merman/0.3.0/src/plugin.typ +1 -0
- package/typst-packages/preview/merman/0.3.0/src/raw.typ +22 -0
- package/typst-packages/preview/merman/0.3.0/src/render.typ +137 -0
- package/typst-packages/preview/merman/0.3.0/src/source.typ +7 -0
- package/typst-packages/preview/merman/0.3.0/src/units.typ +51 -0
- package/typst-packages/preview/merman/0.3.0/typst.toml +12 -0
- package/typst-packages/preview/mitex/0.2.7/CHANGELOG.md +69 -0
- package/typst-packages/preview/mitex/0.2.7/LICENSE +176 -0
- package/typst-packages/preview/mitex/0.2.7/README.md +154 -0
- package/typst-packages/preview/mitex/0.2.7/lib.typ +1 -0
- package/typst-packages/preview/mitex/0.2.7/mitex.typ +45 -0
- package/typst-packages/preview/mitex/0.2.7/mitex.wasm +0 -0
- package/typst-packages/preview/mitex/0.2.7/specs/README.md +250 -0
- package/typst-packages/preview/mitex/0.2.7/specs/latex/standard.typ +1187 -0
- package/typst-packages/preview/mitex/0.2.7/specs/mod.typ +12 -0
- package/typst-packages/preview/mitex/0.2.7/specs/prelude.typ +230 -0
- package/typst-packages/preview/mitex/0.2.7/typst.toml +12 -0
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import MarkdownIt, {} from "markdown-it";
|
|
2
|
+
import footnote from "markdown-it-footnote";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
4
|
+
import { labelKind, labelPattern, parseAttrs, thesisDialect } from "./dialect.js";
|
|
5
|
+
const sectionRoles = [
|
|
6
|
+
"body",
|
|
7
|
+
"annex",
|
|
8
|
+
"abstract",
|
|
9
|
+
"abstract-secondary",
|
|
10
|
+
"dedication",
|
|
11
|
+
"acknowledgments",
|
|
12
|
+
"ai-declaration",
|
|
13
|
+
];
|
|
14
|
+
const frontKeys = ["role", "section", "lang", "keywords"];
|
|
15
|
+
const md = new MarkdownIt("commonmark", { html: true, linkify: false, typographer: false })
|
|
16
|
+
.enable("table")
|
|
17
|
+
.use(footnote)
|
|
18
|
+
.use(thesisDialect);
|
|
19
|
+
const placeholderPattern = /\b(?:TODO|TBD|XXX|FIXME)\b|\[citation needed\]|\{\{[^}]*\}\}/;
|
|
20
|
+
const rawTypstPattern = /(?:^|\s)#(?:set|show|import|include|let|eval|read|context|page|pagebreak|box|block|raw|image|figure|table|grid|place|text|par|align|heading|bibliography|cite|ref|label|metadata|counter|state|query|script|plugin|json|yaml|csv|toml|xml)\b/;
|
|
21
|
+
const pageBreakPattern = /\\(?:newpage|pagebreak|clearpage)(?![A-Za-z])/;
|
|
22
|
+
const claimPattern = /^<!--\s*claim:([A-Za-z0-9_-]{1,40})\s*-->(.*)$/s;
|
|
23
|
+
const trailingAttrs = /\s*\{\s*((?:#|width=)[^{}]*)\}\s*$/;
|
|
24
|
+
const sourceMarker = /(^|(?<=[.!?])\s+)(Source|Fuente|Fonte):\s*/;
|
|
25
|
+
const imageKinds = [
|
|
26
|
+
[/\.vl\.json$/i, "chart"],
|
|
27
|
+
[/\.mmd$/i, "mermaid"],
|
|
28
|
+
[/\.svg$/i, "svg"],
|
|
29
|
+
[/\.(?:png|jpe?g)$/i, "raster"],
|
|
30
|
+
];
|
|
31
|
+
const attr = (token, name) => String(token.attrGet(name) ?? "");
|
|
32
|
+
// biome-ignore lint/suspicious/noExplicitAny: markdown-it token meta is an untyped bag set by our own rules
|
|
33
|
+
const meta = (token) => (token.meta ?? {});
|
|
34
|
+
class Converter {
|
|
35
|
+
path;
|
|
36
|
+
lineOffset;
|
|
37
|
+
footnotePrefix;
|
|
38
|
+
findings = [];
|
|
39
|
+
footnotes = {};
|
|
40
|
+
constructor(path, lineOffset, footnotePrefix) {
|
|
41
|
+
this.path = path;
|
|
42
|
+
this.lineOffset = lineOffset;
|
|
43
|
+
this.footnotePrefix = footnotePrefix;
|
|
44
|
+
}
|
|
45
|
+
add(line, message, hint) {
|
|
46
|
+
this.findings.push({
|
|
47
|
+
code: "HYG-001",
|
|
48
|
+
gate: "G7",
|
|
49
|
+
severity: "error",
|
|
50
|
+
file: this.path,
|
|
51
|
+
...(line === undefined ? {} : { line }),
|
|
52
|
+
message,
|
|
53
|
+
...(hint ? { hint } : {}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
lineOf(token) {
|
|
57
|
+
const start = token?.map?.[0];
|
|
58
|
+
return start === undefined ? undefined : start + 1 + this.lineOffset;
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------------------
|
|
61
|
+
// Inline
|
|
62
|
+
// ---------------------------------------------------------------------------------------
|
|
63
|
+
inline(children, line) {
|
|
64
|
+
const stack = [
|
|
65
|
+
{ kind: "root", nodes: [] },
|
|
66
|
+
];
|
|
67
|
+
const top = () => stack[stack.length - 1];
|
|
68
|
+
const pushText = (text) => {
|
|
69
|
+
if (text === "")
|
|
70
|
+
return;
|
|
71
|
+
const nodes = top().nodes;
|
|
72
|
+
const last = nodes[nodes.length - 1];
|
|
73
|
+
if (last?.kind === "text")
|
|
74
|
+
last.text += text;
|
|
75
|
+
else
|
|
76
|
+
nodes.push({ kind: "text", text });
|
|
77
|
+
};
|
|
78
|
+
for (const token of children) {
|
|
79
|
+
switch (token.type) {
|
|
80
|
+
case "text":
|
|
81
|
+
case "text_special":
|
|
82
|
+
pushText(token.content);
|
|
83
|
+
break;
|
|
84
|
+
case "softbreak":
|
|
85
|
+
pushText(" ");
|
|
86
|
+
break;
|
|
87
|
+
case "hardbreak":
|
|
88
|
+
top().nodes.push({ kind: "break" });
|
|
89
|
+
break;
|
|
90
|
+
case "code_inline":
|
|
91
|
+
top().nodes.push({ kind: "code", text: token.content });
|
|
92
|
+
break;
|
|
93
|
+
case "em_open":
|
|
94
|
+
stack.push({ kind: "emph", nodes: [] });
|
|
95
|
+
break;
|
|
96
|
+
case "strong_open":
|
|
97
|
+
stack.push({ kind: "strong", nodes: [] });
|
|
98
|
+
break;
|
|
99
|
+
case "em_close":
|
|
100
|
+
case "strong_close": {
|
|
101
|
+
const done = stack.pop();
|
|
102
|
+
if (done && done.kind !== "root" && done.kind !== "link") {
|
|
103
|
+
top().nodes.push({ kind: done.kind, children: done.nodes });
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case "link_open": {
|
|
108
|
+
const href = attr(token, "href");
|
|
109
|
+
if (!/^(?:https?:\/\/|mailto:)[^\s]+$/i.test(href)) {
|
|
110
|
+
this.add(line, `Unsupported link target "${href.slice(0, 60)}"`, "Use an absolute http(s) or mailto link; cross-references use @fig-x, @tbl-x, @eq-x and @sec-x.");
|
|
111
|
+
stack.push({ kind: "link", nodes: [] });
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
stack.push({ kind: "link", href, nodes: [] });
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case "link_close": {
|
|
118
|
+
const done = stack.pop();
|
|
119
|
+
if (done?.kind === "link") {
|
|
120
|
+
if (done.href)
|
|
121
|
+
top().nodes.push({ kind: "link", href: done.href, children: done.nodes });
|
|
122
|
+
else
|
|
123
|
+
top().nodes.push(...done.nodes);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "math_inline":
|
|
128
|
+
top().nodes.push({ kind: "math", latex: token.content });
|
|
129
|
+
break;
|
|
130
|
+
case "thesis_cite":
|
|
131
|
+
top().nodes.push({
|
|
132
|
+
kind: "citation",
|
|
133
|
+
items: meta(token).items,
|
|
134
|
+
narrative: meta(token).narrative,
|
|
135
|
+
});
|
|
136
|
+
break;
|
|
137
|
+
case "thesis_ref":
|
|
138
|
+
top().nodes.push({
|
|
139
|
+
kind: "crossref",
|
|
140
|
+
label: meta(token).label,
|
|
141
|
+
refKind: meta(token).refKind,
|
|
142
|
+
});
|
|
143
|
+
break;
|
|
144
|
+
case "thesis_badref":
|
|
145
|
+
this.add(line, `Unrecognized reference ${token.content}`, "Citation keys are lowercase author + year (for example @perez2021); cross-references start with fig-, tbl-, eq- or sec-.");
|
|
146
|
+
pushText(token.content);
|
|
147
|
+
break;
|
|
148
|
+
case "footnote_ref":
|
|
149
|
+
top().nodes.push({
|
|
150
|
+
kind: "footnote",
|
|
151
|
+
id: `${this.footnotePrefix}${String(meta(token).id)}`,
|
|
152
|
+
});
|
|
153
|
+
break;
|
|
154
|
+
case "footnote_anchor":
|
|
155
|
+
break;
|
|
156
|
+
case "image":
|
|
157
|
+
this.add(line, "Images must stand alone in their own paragraph as a figure", "Write {#fig-x} on a line of its own.");
|
|
158
|
+
break;
|
|
159
|
+
case "html_inline":
|
|
160
|
+
this.add(line, "Raw HTML is not allowed", "Use Markdown or the thesis dialect instead.");
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
this.add(line, `Unsupported inline construct (${token.type})`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
while (stack.length > 1) {
|
|
167
|
+
const done = stack.pop();
|
|
168
|
+
if (done && done.kind !== "root")
|
|
169
|
+
top().nodes.push(...done.nodes);
|
|
170
|
+
}
|
|
171
|
+
const nodes = stack[0].nodes;
|
|
172
|
+
this.scanText(nodes, line);
|
|
173
|
+
return nodes;
|
|
174
|
+
}
|
|
175
|
+
scanText(nodes, line) {
|
|
176
|
+
for (const node of nodes) {
|
|
177
|
+
if (node.kind === "text") {
|
|
178
|
+
if (placeholderPattern.test(node.text)) {
|
|
179
|
+
this.add(line, "Placeholder text found (TODO, TBD, XXX, [citation needed] or {{...}})");
|
|
180
|
+
}
|
|
181
|
+
if (rawTypstPattern.test(node.text)) {
|
|
182
|
+
this.add(line, "Raw Typst markup is not allowed in Markdown sources");
|
|
183
|
+
}
|
|
184
|
+
if (pageBreakPattern.test(node.text)) {
|
|
185
|
+
this.add(line, "Page breaks cannot be requested from Markdown", "The template decides page breaks.");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (node.kind === "emph" || node.kind === "strong" || node.kind === "link") {
|
|
189
|
+
this.scanText(node.children, line);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** Remove a trailing `{#label width=..}` group from the last text node. */
|
|
194
|
+
takeAttrs(nodes) {
|
|
195
|
+
const last = nodes[nodes.length - 1];
|
|
196
|
+
if (last?.kind !== "text")
|
|
197
|
+
return undefined;
|
|
198
|
+
const match = trailingAttrs.exec(last.text);
|
|
199
|
+
if (!match)
|
|
200
|
+
return undefined;
|
|
201
|
+
last.text = last.text.slice(0, match.index);
|
|
202
|
+
if (last.text === "")
|
|
203
|
+
nodes.pop();
|
|
204
|
+
return match[1];
|
|
205
|
+
}
|
|
206
|
+
labelFrom(attrText, expected, line, allowWidth = false) {
|
|
207
|
+
if (attrText === undefined)
|
|
208
|
+
return {};
|
|
209
|
+
const attrs = parseAttrs(attrText);
|
|
210
|
+
for (const part of attrs.unknown) {
|
|
211
|
+
this.add(line, `Unknown attribute "${part.slice(0, 40)}"`, "Allowed: {#label} and, on figures, width=80%.");
|
|
212
|
+
}
|
|
213
|
+
const result = {};
|
|
214
|
+
if (attrs.label !== undefined) {
|
|
215
|
+
if (labelKind(attrs.label) === expected)
|
|
216
|
+
result.label = attrs.label;
|
|
217
|
+
else
|
|
218
|
+
this.add(line, `Label ${attrs.label} must start with ${expected}- here`);
|
|
219
|
+
}
|
|
220
|
+
if (attrs.width !== undefined) {
|
|
221
|
+
if (allowWidth)
|
|
222
|
+
result.width = attrs.width;
|
|
223
|
+
else
|
|
224
|
+
this.add(line, "width= is only valid on figures");
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
// ---------------------------------------------------------------------------------------
|
|
229
|
+
// Blocks
|
|
230
|
+
// ---------------------------------------------------------------------------------------
|
|
231
|
+
matching(tokens, open) {
|
|
232
|
+
let depth = 0;
|
|
233
|
+
for (let index = open; index < tokens.length; index += 1) {
|
|
234
|
+
depth += tokens[index].nesting;
|
|
235
|
+
if (depth === 0)
|
|
236
|
+
return index;
|
|
237
|
+
}
|
|
238
|
+
return tokens.length - 1;
|
|
239
|
+
}
|
|
240
|
+
blocks(tokens) {
|
|
241
|
+
const out = [];
|
|
242
|
+
let pendingClaim;
|
|
243
|
+
const settleClaim = (line) => {
|
|
244
|
+
if (pendingClaim !== undefined) {
|
|
245
|
+
this.add(line, `Claim anchor "${pendingClaim}" is not followed by a paragraph`);
|
|
246
|
+
pendingClaim = undefined;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
let index = 0;
|
|
250
|
+
while (index < tokens.length) {
|
|
251
|
+
const token = tokens[index];
|
|
252
|
+
const line = this.lineOf(token);
|
|
253
|
+
switch (token.type) {
|
|
254
|
+
case "heading_open": {
|
|
255
|
+
settleClaim(line);
|
|
256
|
+
const level = Number(token.tag.slice(1));
|
|
257
|
+
const inlineToken = tokens[index + 1];
|
|
258
|
+
const children = this.inline(inlineToken.children ?? [], line);
|
|
259
|
+
const attrText = this.takeAttrs(children);
|
|
260
|
+
const { label } = this.labelFrom(attrText, "sec", line);
|
|
261
|
+
if (level > 4)
|
|
262
|
+
this.add(line, "Headings deeper than level 4 are not supported");
|
|
263
|
+
out.push({
|
|
264
|
+
kind: "heading",
|
|
265
|
+
level: Math.min(level, 4),
|
|
266
|
+
children,
|
|
267
|
+
...(label ? { label } : {}),
|
|
268
|
+
...(line === undefined ? {} : { line }),
|
|
269
|
+
});
|
|
270
|
+
index = this.matching(tokens, index) + 1;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
case "paragraph_open": {
|
|
274
|
+
const inlineToken = tokens[index + 1];
|
|
275
|
+
const produced = this.paragraph(inlineToken, line, out, pendingClaim);
|
|
276
|
+
pendingClaim = undefined;
|
|
277
|
+
if (produced)
|
|
278
|
+
out.push(produced);
|
|
279
|
+
index = this.matching(tokens, index) + 1;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case "html_block": {
|
|
283
|
+
const claim = claimPattern.exec(token.content.trim());
|
|
284
|
+
if (claim && !(claim[2] ?? "").includes("\n")) {
|
|
285
|
+
settleClaim(line);
|
|
286
|
+
const rest = (claim[2] ?? "").trim();
|
|
287
|
+
if (rest === "")
|
|
288
|
+
pendingClaim = claim[1];
|
|
289
|
+
else {
|
|
290
|
+
const [inlineToken] = md.parseInline(rest, {});
|
|
291
|
+
const paragraph = this.paragraph(inlineToken, line, out, claim[1]);
|
|
292
|
+
if (paragraph)
|
|
293
|
+
out.push(paragraph);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
settleClaim(line);
|
|
298
|
+
this.add(line, "Raw HTML is not allowed", "Only <!-- claim:id --> comments are accepted.");
|
|
299
|
+
}
|
|
300
|
+
index += 1;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
case "bullet_list_open":
|
|
304
|
+
case "ordered_list_open": {
|
|
305
|
+
settleClaim(line);
|
|
306
|
+
const end = this.matching(tokens, index);
|
|
307
|
+
const items = [];
|
|
308
|
+
let cursor = index + 1;
|
|
309
|
+
while (cursor < end) {
|
|
310
|
+
const itemEnd = this.matching(tokens, cursor);
|
|
311
|
+
items.push(this.blocks(tokens.slice(cursor + 1, itemEnd)));
|
|
312
|
+
cursor = itemEnd + 1;
|
|
313
|
+
}
|
|
314
|
+
out.push({
|
|
315
|
+
kind: "list",
|
|
316
|
+
ordered: token.type === "ordered_list_open",
|
|
317
|
+
items,
|
|
318
|
+
...(line === undefined ? {} : { line }),
|
|
319
|
+
});
|
|
320
|
+
index = end + 1;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
case "blockquote_open": {
|
|
324
|
+
settleClaim(line);
|
|
325
|
+
const end = this.matching(tokens, index);
|
|
326
|
+
out.push({
|
|
327
|
+
kind: "quote",
|
|
328
|
+
children: this.blocks(tokens.slice(index + 1, end)),
|
|
329
|
+
...(line === undefined ? {} : { line }),
|
|
330
|
+
});
|
|
331
|
+
index = end + 1;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case "fence":
|
|
335
|
+
case "code_block": {
|
|
336
|
+
settleClaim(line);
|
|
337
|
+
const lang = token.info.trim().split(/\s+/)[0] ?? "";
|
|
338
|
+
out.push({
|
|
339
|
+
kind: "codeblock",
|
|
340
|
+
text: token.content.replace(/\n$/, ""),
|
|
341
|
+
...(/^[A-Za-z0-9_+#-]{1,20}$/.test(lang) ? { lang } : {}),
|
|
342
|
+
...(line === undefined ? {} : { line }),
|
|
343
|
+
});
|
|
344
|
+
index += 1;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case "math_block": {
|
|
348
|
+
settleClaim(line);
|
|
349
|
+
const attrText = meta(token).attr;
|
|
350
|
+
const { label } = this.labelFrom(attrText?.trim(), "eq", line);
|
|
351
|
+
out.push({
|
|
352
|
+
kind: "equation",
|
|
353
|
+
latex: token.content,
|
|
354
|
+
...(label ? { label } : {}),
|
|
355
|
+
...(line === undefined ? {} : { line }),
|
|
356
|
+
});
|
|
357
|
+
index += 1;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
case "table_open": {
|
|
361
|
+
settleClaim(line);
|
|
362
|
+
const end = this.matching(tokens, index);
|
|
363
|
+
out.push(this.table(tokens.slice(index, end + 1), line));
|
|
364
|
+
index = end + 1;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
case "footnote_block_open": {
|
|
368
|
+
const end = this.matching(tokens, index);
|
|
369
|
+
let cursor = index + 1;
|
|
370
|
+
while (cursor < end) {
|
|
371
|
+
const open = tokens[cursor];
|
|
372
|
+
if (open.type === "footnote_open") {
|
|
373
|
+
const itemEnd = this.matching(tokens, cursor);
|
|
374
|
+
this.footnotes[`${this.footnotePrefix}${String(meta(open).id)}`] = this.blocks(tokens.slice(cursor + 1, itemEnd));
|
|
375
|
+
cursor = itemEnd + 1;
|
|
376
|
+
}
|
|
377
|
+
else
|
|
378
|
+
cursor += 1;
|
|
379
|
+
}
|
|
380
|
+
index = end + 1;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
case "footnote_anchor":
|
|
384
|
+
index += 1;
|
|
385
|
+
break;
|
|
386
|
+
case "hr":
|
|
387
|
+
settleClaim(line);
|
|
388
|
+
this.add(line, "Thematic breaks (---) are not supported");
|
|
389
|
+
index += 1;
|
|
390
|
+
break;
|
|
391
|
+
default:
|
|
392
|
+
settleClaim(line);
|
|
393
|
+
this.add(line, `Unsupported construct (${token.type})`);
|
|
394
|
+
index = token.nesting === 1 ? this.matching(tokens, index) + 1 : index + 1;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
settleClaim(undefined);
|
|
398
|
+
return out;
|
|
399
|
+
}
|
|
400
|
+
paragraph(inlineToken, line, out, claim) {
|
|
401
|
+
const children = inlineToken.children ?? [];
|
|
402
|
+
const meaningful = children.filter((child) => !(child.type === "softbreak" || (child.type === "text" && child.content.trim() === "")));
|
|
403
|
+
const imageAt = meaningful.findIndex((child) => child.type === "image");
|
|
404
|
+
if (imageAt >= 0) {
|
|
405
|
+
const figure = this.figure(meaningful, line);
|
|
406
|
+
if (claim !== undefined)
|
|
407
|
+
this.add(line, "A claim anchor cannot precede a figure");
|
|
408
|
+
return figure;
|
|
409
|
+
}
|
|
410
|
+
const nodes = this.inline(children, line);
|
|
411
|
+
// `Table: Caption {#tbl-x}` attaches to the table just before it.
|
|
412
|
+
const first = nodes[0];
|
|
413
|
+
const previous = out[out.length - 1];
|
|
414
|
+
if (first?.kind === "text" && /^Table:\s/.test(first.text)) {
|
|
415
|
+
if (previous?.kind === "table" && previous.caption === undefined) {
|
|
416
|
+
first.text = first.text.replace(/^Table:\s+/, "");
|
|
417
|
+
const attrText = this.takeAttrs(nodes);
|
|
418
|
+
const { label } = this.labelFrom(attrText, "tbl", line);
|
|
419
|
+
const { caption, source } = splitSource(nodes);
|
|
420
|
+
previous.caption = caption;
|
|
421
|
+
if (source)
|
|
422
|
+
previous.source = source;
|
|
423
|
+
if (label)
|
|
424
|
+
previous.label = label;
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
this.add(line, "A Table: caption must directly follow a table");
|
|
428
|
+
}
|
|
429
|
+
if (nodes.length === 0)
|
|
430
|
+
return undefined;
|
|
431
|
+
return {
|
|
432
|
+
kind: "paragraph",
|
|
433
|
+
children: nodes,
|
|
434
|
+
...(claim === undefined ? {} : { claim }),
|
|
435
|
+
...(line === undefined ? {} : { line }),
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
figure(meaningful, line) {
|
|
439
|
+
const image = meaningful[0];
|
|
440
|
+
if (image.type !== "image") {
|
|
441
|
+
this.add(line, "Images must stand alone in their own paragraph as a figure");
|
|
442
|
+
return undefined;
|
|
443
|
+
}
|
|
444
|
+
let attrText;
|
|
445
|
+
for (const extra of meaningful.slice(1)) {
|
|
446
|
+
const match = extra.type === "text" ? /^\s*\{\s*([^{}]*)\}\s*$/.exec(extra.content) : null;
|
|
447
|
+
if (match && attrText === undefined && /^(?:#|width=)/.test((match[1] ?? "").trim())) {
|
|
448
|
+
attrText = (match[1] ?? "").trim();
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
this.add(line, "Unexpected text next to a figure; only {#fig-x width=80%} may follow it");
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const { label, width } = this.labelFrom(attrText, "fig", line, true);
|
|
456
|
+
const src = attr(image, "src");
|
|
457
|
+
const kindEntry = imageKinds.find(([pattern]) => pattern.test(src));
|
|
458
|
+
const safe = src.startsWith("figures/") &&
|
|
459
|
+
!src.includes("\\") &&
|
|
460
|
+
!src.includes("\0") &&
|
|
461
|
+
src.split("/").every((part) => part !== "" && part !== "." && part !== "..");
|
|
462
|
+
if (!safe) {
|
|
463
|
+
this.add(line, `Unsafe or unsupported figure path "${src.slice(0, 80)}"`, "Figures are workspace-relative paths under figures/, for example figures/diagrams/flow.mmd.");
|
|
464
|
+
return undefined;
|
|
465
|
+
}
|
|
466
|
+
if (!kindEntry) {
|
|
467
|
+
this.add(line, `Unsupported figure type "${src.slice(0, 80)}"`, "Use .mmd, .svg, .png, .jpg or .vl.json.");
|
|
468
|
+
return undefined;
|
|
469
|
+
}
|
|
470
|
+
const asset = { kind: kindEntry[1], path: src };
|
|
471
|
+
const { caption, source } = splitSource(this.inline(image.children ?? [], line));
|
|
472
|
+
return {
|
|
473
|
+
kind: "figure",
|
|
474
|
+
asset,
|
|
475
|
+
caption,
|
|
476
|
+
...(source ? { source } : {}),
|
|
477
|
+
...(label ? { label } : {}),
|
|
478
|
+
...(width ? { width } : {}),
|
|
479
|
+
...(line === undefined ? {} : { line }),
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
table(tokens, line) {
|
|
483
|
+
const align = [];
|
|
484
|
+
const header = [];
|
|
485
|
+
const rows = [];
|
|
486
|
+
let current;
|
|
487
|
+
let inHead = false;
|
|
488
|
+
for (const token of tokens) {
|
|
489
|
+
if (token.type === "thead_open")
|
|
490
|
+
inHead = true;
|
|
491
|
+
else if (token.type === "thead_close")
|
|
492
|
+
inHead = false;
|
|
493
|
+
else if (token.type === "tr_open")
|
|
494
|
+
current = [];
|
|
495
|
+
else if (token.type === "tr_close" && current) {
|
|
496
|
+
if (inHead)
|
|
497
|
+
header.splice(0, header.length, ...current);
|
|
498
|
+
else
|
|
499
|
+
rows.push(current);
|
|
500
|
+
current = undefined;
|
|
501
|
+
}
|
|
502
|
+
else if (token.type === "th_open" || token.type === "td_open") {
|
|
503
|
+
if (inHead) {
|
|
504
|
+
const style = attr(token, "style");
|
|
505
|
+
const found = /text-align:(left|center|right)/.exec(style)?.[1];
|
|
506
|
+
align.push(found ?? null);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else if (token.type === "inline" && current) {
|
|
510
|
+
current.push(this.inline(token.children ?? [], line));
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return {
|
|
514
|
+
kind: "table",
|
|
515
|
+
align,
|
|
516
|
+
header,
|
|
517
|
+
rows,
|
|
518
|
+
...(line === undefined ? {} : { line }),
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
/** Split a caption at its "Source: ..." sentence (also Fuente:, Fonte:). */
|
|
523
|
+
export function splitSource(nodes) {
|
|
524
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
525
|
+
const node = nodes[index];
|
|
526
|
+
if (node.kind !== "text")
|
|
527
|
+
continue;
|
|
528
|
+
const match = sourceMarker.exec(node.text);
|
|
529
|
+
if (!match)
|
|
530
|
+
continue;
|
|
531
|
+
const before = node.text.slice(0, match.index);
|
|
532
|
+
const sourceText = node.text.slice(match.index + (match[1]?.length ?? 0));
|
|
533
|
+
const caption = [...nodes.slice(0, index)];
|
|
534
|
+
if (before !== "")
|
|
535
|
+
caption.push({ kind: "text", text: before });
|
|
536
|
+
return {
|
|
537
|
+
caption,
|
|
538
|
+
source: [{ kind: "text", text: sourceText }, ...nodes.slice(index + 1)],
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
return { caption: nodes };
|
|
542
|
+
}
|
|
543
|
+
function splitFrontMatter(path, source, findings) {
|
|
544
|
+
const base = {
|
|
545
|
+
role: path.includes("/annexes/") ? "annex" : "body",
|
|
546
|
+
body: source,
|
|
547
|
+
lineOffset: 0,
|
|
548
|
+
};
|
|
549
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(source);
|
|
550
|
+
if (!match)
|
|
551
|
+
return base;
|
|
552
|
+
const fail = (message) => findings.push({ code: "HYG-001", gate: "G7", severity: "error", file: path, line: 1, message });
|
|
553
|
+
let data;
|
|
554
|
+
try {
|
|
555
|
+
data = parseYaml(match[1]);
|
|
556
|
+
}
|
|
557
|
+
catch {
|
|
558
|
+
fail("The YAML front matter of this chapter is not valid YAML");
|
|
559
|
+
return {
|
|
560
|
+
...base,
|
|
561
|
+
body: source.slice(match[0].length),
|
|
562
|
+
lineOffset: match[0].split("\n").length - 1,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
const result = {
|
|
566
|
+
...base,
|
|
567
|
+
body: source.slice(match[0].length),
|
|
568
|
+
lineOffset: match[0].split("\n").length - 1,
|
|
569
|
+
};
|
|
570
|
+
if (data === null || data === undefined)
|
|
571
|
+
return result;
|
|
572
|
+
if (typeof data !== "object" || Array.isArray(data)) {
|
|
573
|
+
fail("The YAML front matter must be a mapping");
|
|
574
|
+
return result;
|
|
575
|
+
}
|
|
576
|
+
const record = data;
|
|
577
|
+
for (const key of Object.keys(record)) {
|
|
578
|
+
if (!frontKeys.includes(key))
|
|
579
|
+
fail(`Unknown front matter key "${key}"`);
|
|
580
|
+
}
|
|
581
|
+
if (record.role !== undefined) {
|
|
582
|
+
if (typeof record.role === "string" &&
|
|
583
|
+
sectionRoles.includes(record.role)) {
|
|
584
|
+
result.role = record.role;
|
|
585
|
+
}
|
|
586
|
+
else
|
|
587
|
+
fail(`role must be one of ${sectionRoles.join(", ")}`);
|
|
588
|
+
}
|
|
589
|
+
if (record.section !== undefined) {
|
|
590
|
+
if (typeof record.section === "string" && /^SEC-\d{2}(\.\d{2}){0,2}$/.test(record.section)) {
|
|
591
|
+
result.section = record.section;
|
|
592
|
+
}
|
|
593
|
+
else
|
|
594
|
+
fail("section must be an outline id such as SEC-03");
|
|
595
|
+
}
|
|
596
|
+
if (record.lang !== undefined) {
|
|
597
|
+
if (typeof record.lang === "string" &&
|
|
598
|
+
/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(record.lang)) {
|
|
599
|
+
result.lang = record.lang;
|
|
600
|
+
}
|
|
601
|
+
else
|
|
602
|
+
fail("lang must be a BCP-47 tag");
|
|
603
|
+
}
|
|
604
|
+
if (record.keywords !== undefined) {
|
|
605
|
+
if (Array.isArray(record.keywords) &&
|
|
606
|
+
record.keywords.length <= 12 &&
|
|
607
|
+
record.keywords.every((item) => typeof item === "string" && item.length > 0 && item.length <= 80)) {
|
|
608
|
+
result.keywords = record.keywords;
|
|
609
|
+
}
|
|
610
|
+
else
|
|
611
|
+
fail("keywords must be a list of at most 12 short strings");
|
|
612
|
+
}
|
|
613
|
+
return result;
|
|
614
|
+
}
|
|
615
|
+
/** Parse one Markdown chapter into the neutral model. Pure: no file access. */
|
|
616
|
+
export function parseChapter(path, source, options = {}) {
|
|
617
|
+
const findings = [];
|
|
618
|
+
const front = splitFrontMatter(path, source, findings);
|
|
619
|
+
const converter = new Converter(path, front.lineOffset, options.footnotePrefix ?? `${path}#`);
|
|
620
|
+
const tokens = md.parse(front.body, {});
|
|
621
|
+
const blocks = converter.blocks(tokens);
|
|
622
|
+
const section = {
|
|
623
|
+
path,
|
|
624
|
+
role: front.role,
|
|
625
|
+
blocks,
|
|
626
|
+
...(front.section ? { section: front.section } : {}),
|
|
627
|
+
...(front.lang ? { lang: front.lang } : {}),
|
|
628
|
+
...(front.keywords ? { keywords: front.keywords } : {}),
|
|
629
|
+
};
|
|
630
|
+
return {
|
|
631
|
+
section,
|
|
632
|
+
footnotes: converter.footnotes,
|
|
633
|
+
findings: [...findings, ...converter.findings],
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
export { labelPattern };
|
|
637
|
+
//# sourceMappingURL=parse.js.map
|