metanorma-document 0.2.9 → 0.2.12
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +164 -66
- data/CLAUDE.md +26 -0
- data/README.adoc +144 -0
- data/Rakefile +14 -2
- data/TODO.finalize/01-split-multi-class-files.md +8 -0
- data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +6 -0
- data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +11 -0
- data/TODO.finalize/04-theme-per-flavor-config-driven.md +9 -0
- data/TODO.finalize/05-migrate-all-html-to-liquid.md +16 -0
- data/TODO.finalize/06-integrate-pubid-library.md +16 -0
- data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +39 -0
- data/TODO.finalize/08-refactor-renderer-architecture.md +25 -0
- data/TODO.finalize/09-eliminate-code-smells.md +14 -0
- data/TODO.finalize/10-comprehensive-spec-coverage.md +24 -0
- data/TODO.finalize/11-config-driven-flavor-metadata.md +20 -0
- data/TODO.finalize/12-add-frozen-string-literal.md +6 -0
- data/TODO.finalize/13-extract-composition-from-god-class.md +96 -0
- data/TODO.finalize/14-config-driven-section-ordering.md +31 -0
- data/TODO.finalize/15-theme-directories-per-flavor.md +46 -0
- data/TODO.finalize/16-theme-lutaml-model-schema.md +44 -0
- data/data/javascripts/components/mn-footnotes.js +68 -0
- data/data/javascripts/components/mn-lightbox.js +18 -2
- data/data/javascripts/components/mn-shortcuts.js +2 -0
- data/data/javascripts/core/mn-navigation.js +8 -0
- data/data/javascripts/core/mn-theme.js +9 -9
- data/data/logos/oiml-logo-full-dark.svg +1 -0
- data/data/logos/oiml-logo-full-light.svg +1 -0
- data/data/logos/oiml-logo-icon-dark.svg +1 -0
- data/data/logos/oiml-logo-icon-light.svg +1 -0
- data/data/logos/oiml-logo.svg +1 -0
- data/data/logos/pdfa-logo.svg +31 -94
- data/data/stylesheets/base/_layout.css +3 -0
- data/data/stylesheets/base/_reset.css +3 -3
- data/data/stylesheets/base/_typography.css +0 -5
- data/data/stylesheets/components/bibliography.css +3 -3
- data/data/stylesheets/components/cover.css +3 -1
- data/data/stylesheets/components/figure.css +13 -1
- data/data/stylesheets/components/footnote.css +65 -5
- data/data/stylesheets/components/formula.css +44 -0
- data/data/stylesheets/components/header.css +17 -2
- data/data/stylesheets/components/inline.css +1 -1
- data/data/stylesheets/components/table.css +15 -2
- data/data/stylesheets/components/term.css +0 -1
- data/data/themes/bipm.yaml +60 -0
- data/data/themes/cc.yaml +43 -0
- data/data/themes/icc.yaml +39 -0
- data/data/themes/iec.yaml +44 -0
- data/data/themes/ieee.yaml +43 -0
- data/data/themes/ietf.yaml +45 -0
- data/data/themes/iho.yaml +46 -0
- data/data/themes/iso.yaml +40 -0
- data/data/themes/itu.yaml +45 -0
- data/data/themes/ogc.yaml +51 -0
- data/data/themes/oiml.yaml +56 -0
- data/data/themes/pdfa.yaml +44 -0
- data/data/themes/ribose.yaml +43 -0
- data/exe/metanorma-document +11 -0
- data/frontend/e2e/sample-html.test.ts +256 -0
- data/frontend/index.html +12 -0
- data/frontend/package-lock.json +4725 -0
- data/frontend/package.json +32 -0
- data/frontend/postcss.config.js +6 -0
- data/frontend/src/App.vue +79 -0
- data/frontend/src/app.ts +21 -0
- data/frontend/src/components/AppSidebar.vue +77 -0
- data/frontend/src/components/DocumentReader.vue +180 -0
- data/frontend/src/components/MirrorRenderer.vue +23 -0
- data/frontend/src/components/ReadingProgressBar.vue +29 -0
- data/frontend/src/components/TextRenderer.vue +131 -0
- data/frontend/src/components/TocItem.vue +57 -0
- data/frontend/src/components/TopBar.vue +49 -0
- data/frontend/src/components/__tests__/MirrorRenderer.test.ts +178 -0
- data/frontend/src/components/blocks/AdmonitionBlock.vue +74 -0
- data/frontend/src/components/blocks/ClauseBlock.vue +53 -0
- data/frontend/src/components/blocks/ExampleBlock.vue +21 -0
- data/frontend/src/components/blocks/FallbackBlock.vue +18 -0
- data/frontend/src/components/blocks/FigureBlock.vue +26 -0
- data/frontend/src/components/blocks/FootnotesBlock.vue +25 -0
- data/frontend/src/components/blocks/ListBlocks.vue +62 -0
- data/frontend/src/components/blocks/NoteBlock.vue +21 -0
- data/frontend/src/components/blocks/ParagraphBlock.vue +25 -0
- data/frontend/src/components/blocks/QuoteBlock.vue +25 -0
- data/frontend/src/components/blocks/ReviewBlock.vue +39 -0
- data/frontend/src/components/blocks/SourcecodeBlock.vue +52 -0
- data/frontend/src/components/blocks/TableBlock.vue +48 -0
- data/frontend/src/components/blocks/index.ts +36 -0
- data/frontend/src/stores/__tests__/documentStore.fixture.test.ts +272 -0
- data/frontend/src/stores/__tests__/documentStore.test.ts +143 -0
- data/frontend/src/stores/__tests__/ebookStore.test.ts +145 -0
- data/frontend/src/stores/__tests__/uiStore.test.ts +42 -0
- data/frontend/src/stores/documentStore.ts +153 -0
- data/frontend/src/stores/ebookStore.ts +179 -0
- data/frontend/src/stores/uiStore.ts +32 -0
- data/frontend/src/styles.css +156 -0
- data/frontend/src/types/__tests__/rendering-contract.test.ts +172 -0
- data/frontend/src/types/rendering-contract.ts +209 -0
- data/frontend/src/utils/__tests__/typeMetadata.test.ts +102 -0
- data/frontend/src/utils/typeMetadata.ts +121 -0
- data/frontend/tailwind.config.js +18 -0
- data/frontend/test/fixtures/iso-document.json +271 -0
- data/frontend/tmp/debug_e2e.cjs +46 -0
- data/frontend/tsconfig.json +25 -0
- data/frontend/tsconfig.node.json +11 -0
- data/frontend/vite.config.ts +37 -0
- data/frontend/vitest.e2e.config.ts +9 -0
- data/lib/metanorma/bipm_document/metadata/bipm_bibliographic_item.rb +0 -14
- data/lib/metanorma/bipm_document/metadata/depiction_element.rb +18 -0
- data/lib/metanorma/bipm_document/metadata.rb +1 -1
- data/lib/metanorma/document/cli.rb +116 -0
- data/lib/metanorma/document/components/ancillary_blocks/callout_annotation.rb +27 -0
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +0 -65
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +18 -0
- data/lib/metanorma/document/components/ancillary_blocks.rb +4 -0
- data/lib/metanorma/document/components/bib_data/bib_data.rb +7 -0
- data/lib/metanorma/document/components/blocks/classification_value.rb +21 -0
- data/lib/metanorma/document/components/blocks/permission_model.rb +28 -0
- data/lib/metanorma/document/components/blocks/recommendation_model.rb +28 -0
- data/lib/metanorma/document/components/blocks/requirement_base.rb +30 -0
- data/lib/metanorma/document/components/blocks/requirement_classification.rb +20 -0
- data/lib/metanorma/document/components/blocks/requirement_description.rb +43 -0
- data/lib/metanorma/document/components/blocks/requirement_inherit.rb +24 -0
- data/lib/metanorma/document/components/blocks/requirement_model.rb +0 -131
- data/lib/metanorma/document/components/blocks.rb +8 -7
- data/lib/metanorma/document/components/id_elements/image.rb +2 -0
- data/lib/metanorma/document/components/inline/asciimath_element.rb +2 -0
- data/lib/metanorma/document/components/inline/attribution_element.rb +2 -0
- data/lib/metanorma/document/components/inline/bcp14_element.rb +2 -0
- data/lib/metanorma/document/components/inline/biblio_tag_element.rb +2 -0
- data/lib/metanorma/document/components/inline/br_element.rb +2 -0
- data/lib/metanorma/document/components/inline/comma_element.rb +2 -0
- data/lib/metanorma/document/components/inline/concept_element.rb +2 -0
- data/lib/metanorma/document/components/inline/display_text_element.rb +2 -0
- data/lib/metanorma/document/components/inline/em_raw_element.rb +2 -0
- data/lib/metanorma/document/components/inline/enum_comma_element.rb +2 -0
- data/lib/metanorma/document/components/inline/eref_element.rb +2 -0
- data/lib/metanorma/document/components/inline/fmt_admitted_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_annotation_body_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_annotation_end_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_annotation_start_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_concept_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_definition_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_fn_body_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_fn_label_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_footnote_container_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_identifier_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_name_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_preferred_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_sourcecode_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_stem_element.rb +10 -0
- data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_title_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_xref_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fmt_xref_label_element.rb +4 -0
- data/lib/metanorma/document/components/inline/fn_element.rb +2 -0
- data/lib/metanorma/document/components/inline/link_element.rb +2 -0
- data/lib/metanorma/document/components/inline/localized_string_element.rb +2 -0
- data/lib/metanorma/document/components/inline/localized_strings_element.rb +2 -0
- data/lib/metanorma/document/components/inline/location_element.rb +24 -0
- data/lib/metanorma/document/components/inline/math_element.rb +2 -0
- data/lib/metanorma/document/components/inline/name_with_id_element.rb +4 -0
- data/lib/metanorma/document/components/inline/rendered_display.rb +23 -0
- data/lib/metanorma/document/components/inline/rendered_math_element.rb +21 -0
- data/lib/metanorma/document/components/inline/semantic_content.rb +51 -0
- data/lib/metanorma/document/components/inline/semantic_math_element.rb +20 -0
- data/lib/metanorma/document/components/inline/semx_child_element.rb +2 -0
- data/lib/metanorma/document/components/inline/semx_element.rb +13 -1
- data/lib/metanorma/document/components/inline/small_cap_element.rb +2 -0
- data/lib/metanorma/document/components/inline/span_element.rb +10 -15
- data/lib/metanorma/document/components/inline/stem_inline_element.rb +7 -1
- data/lib/metanorma/document/components/inline/strong_raw_element.rb +2 -0
- data/lib/metanorma/document/components/inline/sub_element.rb +2 -0
- data/lib/metanorma/document/components/inline/sup_element.rb +2 -0
- data/lib/metanorma/document/components/inline/tab_element.rb +2 -0
- data/lib/metanorma/document/components/inline/title_with_annotation_element.rb +4 -0
- data/lib/metanorma/document/components/inline/tt_element.rb +2 -0
- data/lib/metanorma/document/components/inline/variant_title_element.rb +2 -0
- data/lib/metanorma/document/components/inline/vocabulary.rb +184 -0
- data/lib/metanorma/document/components/inline/xref_element.rb +10 -0
- data/lib/metanorma/document/components/inline.rb +12 -0
- data/lib/metanorma/document/components/multi_paragraph/quote_author_element.rb +20 -0
- data/lib/metanorma/document/components/multi_paragraph/quote_block.rb +0 -29
- data/lib/metanorma/document/components/multi_paragraph.rb +2 -0
- data/lib/metanorma/document/components/reference_elements/source_element.rb +0 -31
- data/lib/metanorma/document/components/reference_elements/source_modification.rb +21 -0
- data/lib/metanorma/document/components/reference_elements/source_origin.rb +28 -0
- data/lib/metanorma/document/components/reference_elements.rb +2 -2
- data/lib/metanorma/document/components/tables/col_element.rb +18 -0
- data/lib/metanorma/document/components/tables/col_group_element.rb +18 -0
- data/lib/metanorma/document/components/tables/table_block.rb +0 -22
- data/lib/metanorma/document/components/tables/table_body_section.rb +16 -0
- data/lib/metanorma/document/components/tables/table_foot_section.rb +16 -0
- data/lib/metanorma/document/components/tables/table_head_section.rb +16 -0
- data/lib/metanorma/document/components/tables/table_section.rb +0 -25
- data/lib/metanorma/document/components/tables.rb +5 -3
- data/lib/metanorma/document/relaton/address.rb +0 -27
- data/lib/metanorma/document/relaton/bib_item_locality.rb +3 -12
- data/lib/metanorma/document/relaton/copyright_association.rb +0 -10
- data/lib/metanorma/document/relaton/copyright_owner.rb +16 -0
- data/lib/metanorma/document/relaton/edition.rb +4 -7
- data/lib/metanorma/document/relaton/formatted_address.rb +29 -0
- data/lib/metanorma/document/relaton/logo_element.rb +18 -0
- data/lib/metanorma/document/relaton/organization.rb +0 -14
- data/lib/metanorma/document/relaton/phone.rb +3 -9
- data/lib/metanorma/document/relaton/place_type.rb +0 -13
- data/lib/metanorma/document/relaton/price_type.rb +3 -9
- data/lib/metanorma/document/relaton/region_element.rb +18 -0
- data/lib/metanorma/document/relaton.rb +6 -1
- data/lib/metanorma/document/version.rb +1 -1
- data/lib/metanorma/document.rb +2 -0
- data/lib/metanorma/html/asset_pipeline.rb +1 -0
- data/lib/metanorma/html/base_renderer.rb +261 -1008
- data/lib/metanorma/html/bipm_renderer.rb +15 -144
- data/lib/metanorma/html/cc_renderer.rb +1 -45
- data/lib/metanorma/html/component/base.rb +2 -7
- data/lib/metanorma/html/component/index_section.rb +41 -43
- data/lib/metanorma/html/drops/admonition_drop.rb +1 -4
- data/lib/metanorma/html/drops/biblio_entry_drop.rb +50 -0
- data/lib/metanorma/html/drops/block_element_drop.rb +7 -2
- data/lib/metanorma/html/drops/example_drop.rb +1 -4
- data/lib/metanorma/html/drops/figure_drop.rb +31 -22
- data/lib/metanorma/html/drops/footnote_drop.rb +1 -1
- data/lib/metanorma/html/drops/formula_drop.rb +45 -16
- data/lib/metanorma/html/drops/note_drop.rb +9 -7
- data/lib/metanorma/html/drops/sourcecode_drop.rb +12 -5
- data/lib/metanorma/html/drops.rb +2 -0
- data/lib/metanorma/html/generator.rb +2 -2
- data/lib/metanorma/html/icc_renderer.rb +0 -39
- data/lib/metanorma/html/iec_renderer.rb +1 -44
- data/lib/metanorma/html/ieee_renderer.rb +1 -45
- data/lib/metanorma/html/ietf_renderer.rb +1 -48
- data/lib/metanorma/html/iho_renderer.rb +1 -46
- data/lib/metanorma/html/iso_renderer.rb +290 -343
- data/lib/metanorma/html/itu_renderer.rb +1 -45
- data/lib/metanorma/html/ogc_renderer.rb +15 -76
- data/lib/metanorma/html/oiml_renderer.rb +18 -38
- data/lib/metanorma/html/pdfa_renderer.rb +0 -39
- data/lib/metanorma/html/renderers/block_renderer.rb +372 -0
- data/lib/metanorma/html/renderers/inline_renderer.rb +655 -0
- data/lib/metanorma/html/renderers/pubid_renderer.rb +69 -0
- data/lib/metanorma/html/renderers/section_renderer.rb +193 -0
- data/lib/metanorma/html/renderers.rb +8 -0
- data/lib/metanorma/html/ribose_renderer.rb +1 -45
- data/lib/metanorma/html/standard_renderer.rb +341 -229
- data/lib/metanorma/html/templates/_audio.html.liquid +1 -0
- data/lib/metanorma/html/templates/_biblio_entry.html.liquid +1 -0
- data/lib/metanorma/html/templates/_bipm_cover.html.liquid +27 -0
- data/lib/metanorma/html/templates/_boilerplate.html.liquid +1 -0
- data/lib/metanorma/html/templates/_bookmark.html.liquid +1 -0
- data/lib/metanorma/html/templates/_br.html.liquid +1 -0
- data/lib/metanorma/html/templates/_definition_list.html.liquid +6 -0
- data/lib/metanorma/html/templates/_element.html.liquid +1 -0
- data/lib/metanorma/html/templates/_fn_marker.html.liquid +1 -0
- data/lib/metanorma/html/templates/_footnotes.html.liquid +6 -6
- data/lib/metanorma/html/templates/_formula.html.liquid +1 -1
- data/lib/metanorma/html/templates/_header.html.liquid +1 -1
- data/lib/metanorma/html/templates/_heading.html.liquid +1 -0
- data/lib/metanorma/html/templates/_image.html.liquid +1 -0
- data/lib/metanorma/html/templates/_inline_span.html.liquid +1 -0
- data/lib/metanorma/html/templates/_iso_cover.html.liquid +1 -1
- data/lib/metanorma/html/templates/_link.html.liquid +1 -0
- data/lib/metanorma/html/templates/_list.html.liquid +3 -0
- data/lib/metanorma/html/templates/_list_item.html.liquid +1 -0
- data/lib/metanorma/html/templates/_main_content.html.liquid +1 -0
- data/lib/metanorma/html/templates/_math_container.html.liquid +1 -0
- data/lib/metanorma/html/templates/_paragraph.html.liquid +1 -0
- data/lib/metanorma/html/templates/_prefatory_section.html.liquid +1 -0
- data/lib/metanorma/html/templates/_pubid_identifier.html.liquid +1 -0
- data/lib/metanorma/html/templates/_quote.html.liquid +4 -0
- data/lib/metanorma/html/templates/_ref_date.html.liquid +1 -0
- data/lib/metanorma/html/templates/_ref_title.html.liquid +1 -0
- data/lib/metanorma/html/templates/_section.html.liquid +5 -0
- data/lib/metanorma/html/templates/_standard_cover.html.liquid +31 -0
- data/lib/metanorma/html/templates/_standard_doc_title.html.liquid +3 -0
- data/lib/metanorma/html/templates/_stem_span.html.liquid +1 -0
- data/lib/metanorma/html/templates/_table.html.liquid +9 -0
- data/lib/metanorma/html/templates/_term_domain.html.liquid +1 -0
- data/lib/metanorma/html/templates/_term_example.html.liquid +1 -0
- data/lib/metanorma/html/templates/_term_note.html.liquid +1 -0
- data/lib/metanorma/html/templates/_term_number.html.liquid +1 -0
- data/lib/metanorma/html/templates/_term_source.html.liquid +1 -0
- data/lib/metanorma/html/templates/_term_text_note.html.liquid +1 -0
- data/lib/metanorma/html/templates/_video.html.liquid +1 -0
- data/lib/metanorma/html/templates/_wrapped_preface.html.liquid +1 -0
- data/lib/metanorma/html/templates/document.html.liquid +4 -0
- data/lib/metanorma/html/theme.rb +180 -107
- data/lib/metanorma/html.rb +13 -0
- data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +0 -25
- data/lib/metanorma/ietf_document/metadata/pi_settings.rb +32 -0
- data/lib/metanorma/ietf_document/metadata.rb +2 -0
- data/lib/metanorma/iso_document/metadata/doctype_element.rb +20 -0
- data/lib/metanorma/iso_document/metadata/iso_bib_data_extension_type.rb +0 -48
- data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +0 -72
- data/lib/metanorma/iso_document/metadata/iso_document_status.rb +0 -30
- data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +4 -1
- data/lib/metanorma/iso_document/metadata/language_element.rb +18 -0
- data/lib/metanorma/iso_document/metadata/project_number.rb +22 -0
- data/lib/metanorma/iso_document/metadata/script_element.rb +18 -0
- data/lib/metanorma/iso_document/metadata/stage_element.rb +26 -0
- data/lib/metanorma/iso_document/metadata/stagename_element.rb +18 -0
- data/lib/metanorma/iso_document/metadata/structured_identifier.rb +0 -17
- data/lib/metanorma/iso_document/metadata/title_collection.rb +1 -0
- data/lib/metanorma/iso_document/metadata.rb +9 -4
- data/lib/metanorma/iso_document/terms/iso_term.rb +0 -13
- data/lib/metanorma/iso_document/terms/term_domain_element.rb +18 -0
- data/lib/metanorma/iso_document/terms.rb +1 -0
- data/lib/metanorma/itu_document/metadata/itu_bib_data_extension_type.rb +0 -37
- data/lib/metanorma/itu_document/metadata/meeting_date.rb +18 -0
- data/lib/metanorma/itu_document/metadata/meeting_element.rb +18 -0
- data/lib/metanorma/itu_document/metadata/study_period.rb +18 -0
- data/lib/metanorma/itu_document/metadata.rb +3 -4
- data/lib/metanorma/mirror/default_registry.rb +170 -0
- data/lib/metanorma/mirror/handler_registry.rb +60 -0
- data/lib/metanorma/mirror/handler_result.rb +37 -0
- data/lib/metanorma/mirror/handlers/admonition.rb +18 -0
- data/lib/metanorma/mirror/handlers/example.rb +21 -0
- data/lib/metanorma/mirror/handlers/figure.rb +53 -0
- data/lib/metanorma/mirror/handlers/formula.rb +35 -0
- data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +159 -0
- data/lib/metanorma/mirror/handlers/inline/text_extractor.rb +116 -0
- data/lib/metanorma/mirror/handlers/inline.rb +225 -0
- data/lib/metanorma/mirror/handlers/list.rb +110 -0
- data/lib/metanorma/mirror/handlers/note.rb +26 -0
- data/lib/metanorma/mirror/handlers/paragraph.rb +19 -0
- data/lib/metanorma/mirror/handlers/quote.rb +16 -0
- data/lib/metanorma/mirror/handlers/review.rb +19 -0
- data/lib/metanorma/mirror/handlers/section.rb +149 -0
- data/lib/metanorma/mirror/handlers/sourcecode.rb +27 -0
- data/lib/metanorma/mirror/handlers/structural.rb +68 -0
- data/lib/metanorma/mirror/handlers/table.rb +81 -0
- data/lib/metanorma/mirror/handlers/term.rb +100 -0
- data/lib/metanorma/mirror/handlers.rb +60 -0
- data/lib/metanorma/mirror/id_strategy/positional.rb +166 -0
- data/lib/metanorma/mirror/id_strategy/preserve.rb +12 -0
- data/lib/metanorma/mirror/id_strategy.rb +34 -0
- data/lib/metanorma/mirror/math_util.rb +53 -0
- data/lib/metanorma/mirror/metadata.rb +37 -0
- data/lib/metanorma/mirror/metanorma_to_mirror.rb +101 -0
- data/lib/metanorma/mirror/model/container.rb +47 -0
- data/lib/metanorma/mirror/model/factory.rb +52 -0
- data/lib/metanorma/mirror/model/guide.rb +25 -0
- data/lib/metanorma/mirror/model/leaf.rb +17 -0
- data/lib/metanorma/mirror/model/mark.rb +53 -0
- data/lib/metanorma/mirror/model/node.rb +47 -0
- data/lib/metanorma/mirror/model/soft_break.rb +33 -0
- data/lib/metanorma/mirror/model/text.rb +34 -0
- data/lib/metanorma/mirror/model.rb +16 -0
- data/lib/metanorma/mirror/output/builder.rb +39 -0
- data/lib/metanorma/mirror/output/formats/base_format.rb +90 -0
- data/lib/metanorma/mirror/output/formats/inline_format.rb +81 -0
- data/lib/metanorma/mirror/output/formats.rb +53 -0
- data/lib/metanorma/mirror/output/html_renderer.rb +95 -0
- data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +178 -0
- data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +61 -0
- data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +96 -0
- data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +64 -0
- data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +129 -0
- data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +80 -0
- data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +87 -0
- data/lib/metanorma/mirror/output/html_renderers.rb +76 -0
- data/lib/metanorma/mirror/output/pipeline.rb +92 -0
- data/lib/metanorma/mirror/output/pipeline_context.rb +22 -0
- data/lib/metanorma/mirror/output.rb +14 -0
- data/lib/metanorma/mirror/rewriter.rb +121 -0
- data/lib/metanorma/mirror/safe_attr.rb +16 -0
- data/lib/metanorma/mirror/serialization/json_serializer.rb +25 -0
- data/lib/metanorma/mirror/serialization/yaml_serializer.rb +20 -0
- data/lib/metanorma/mirror/serialization.rb +10 -0
- data/lib/metanorma/mirror/transformer.rb +22 -0
- data/lib/metanorma/mirror.rb +32 -0
- data/lib/metanorma/standard_document/annotation.rb +37 -0
- data/lib/metanorma/standard_document/block_attributes.rb +15 -2
- data/lib/metanorma/standard_document/blocks/block_source.rb +0 -23
- data/lib/metanorma/standard_document/blocks/source_origin_element.rb +23 -0
- data/lib/metanorma/standard_document/blocks.rb +1 -1
- data/lib/metanorma/standard_document/terms/term_expression.rb +0 -31
- data/lib/metanorma/standard_document/terms/term_name_element.rb +29 -0
- data/lib/metanorma/standard_document/terms.rb +1 -0
- data/script/render_both.rb +18 -0
- metadata +262 -13
- data/.github/workflows/rake.yml +0 -21
- data/.github/workflows/release.yml +0 -25
- data/.github/workflows/roundtrip-samples.yml +0 -132
- data/.gitignore +0 -19
- data/.rspec +0 -3
- data/.rubocop.yml +0 -22
- data/Gemfile +0 -28
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/metanorma-document.gemspec +0 -35
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<header class="topbar">
|
|
3
|
+
<div class="topbar-left">
|
|
4
|
+
<button @click="$emit('toggleToc')" class="topbar-btn" title="Toggle TOC">
|
|
5
|
+
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
|
|
6
|
+
</button>
|
|
7
|
+
<span class="topbar-title">{{ title }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="topbar-right">
|
|
10
|
+
<button @click="$emit('toggleSettings')" class="topbar-btn" title="Settings">
|
|
11
|
+
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
</header>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
defineProps<{
|
|
19
|
+
title: string
|
|
20
|
+
sidebarOpen: boolean
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
defineEmits<{
|
|
24
|
+
toggleToc: []
|
|
25
|
+
toggleSettings: []
|
|
26
|
+
}>()
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.topbar {
|
|
31
|
+
position: fixed;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
height: 56px;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
padding: 0 12px;
|
|
40
|
+
background: var(--chrome-bg);
|
|
41
|
+
border-bottom: 1px solid var(--chrome-border);
|
|
42
|
+
z-index: 40;
|
|
43
|
+
backdrop-filter: blur(8px);
|
|
44
|
+
}
|
|
45
|
+
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
|
|
46
|
+
.topbar-title { font-size: 0.85rem; font-weight: 600; color: var(--chrome-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
|
|
47
|
+
.topbar-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: var(--chrome-text-dim); cursor: pointer; }
|
|
48
|
+
.topbar-btn:hover { background: var(--chrome-bg-hover); color: var(--chrome-text); }
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { createPinia, setActivePinia } from 'pinia'
|
|
4
|
+
import MirrorRenderer from '../../components/MirrorRenderer.vue'
|
|
5
|
+
import { useDocumentStore } from '../../stores/documentStore'
|
|
6
|
+
import fixture from '@test/fixtures/iso-document.json'
|
|
7
|
+
|
|
8
|
+
function mountRenderer(content: any[]) {
|
|
9
|
+
setActivePinia(createPinia())
|
|
10
|
+
const store = useDocumentStore()
|
|
11
|
+
store.processMetanormaData(fixture)
|
|
12
|
+
|
|
13
|
+
const wrapper = mount(MirrorRenderer, {
|
|
14
|
+
props: { blocks: content },
|
|
15
|
+
global: { plugins: [createPinia()] },
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
// Need to set up store after pinia is injected
|
|
19
|
+
const store2 = useDocumentStore()
|
|
20
|
+
store2.processMetanormaData(fixture)
|
|
21
|
+
|
|
22
|
+
return wrapper
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('MirrorRenderer with fixture data', () => {
|
|
26
|
+
it('renders top-level sections', () => {
|
|
27
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
28
|
+
const html = wrapper.html()
|
|
29
|
+
|
|
30
|
+
expect(html).toContain('Foreword')
|
|
31
|
+
expect(html).toContain('Scope')
|
|
32
|
+
expect(html).toContain('Normative references')
|
|
33
|
+
expect(html).toContain('Terms and definitions')
|
|
34
|
+
expect(html).toContain('Test methods')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('renders paragraphs with text content', () => {
|
|
38
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
39
|
+
const html = wrapper.html()
|
|
40
|
+
|
|
41
|
+
expect(html).toContain('ISO (the International Organization')
|
|
42
|
+
expect(html).toContain('the test methods')
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('renders strong marks', () => {
|
|
46
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
47
|
+
const html = wrapper.html()
|
|
48
|
+
|
|
49
|
+
expect(html).toContain('the test methods')
|
|
50
|
+
// Vue adds scoped data attributes and CSS classes, so check tag + text
|
|
51
|
+
const strongEls = wrapper.findAll('strong')
|
|
52
|
+
const texts = strongEls.map(e => e.text())
|
|
53
|
+
expect(texts).toContain('the test methods')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('renders emphasis marks', () => {
|
|
57
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
58
|
+
|
|
59
|
+
const emEls = wrapper.findAll('em')
|
|
60
|
+
const texts = emEls.map(e => e.text())
|
|
61
|
+
expect(texts).toContain('Oryza sativa L.')
|
|
62
|
+
expect(texts).toContain('Oryza glaberrima')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('renders bullet lists', () => {
|
|
66
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
67
|
+
const html = wrapper.html()
|
|
68
|
+
|
|
69
|
+
expect(html).toContain('Milling quality assessment')
|
|
70
|
+
expect(html).toContain('Moisture content determination')
|
|
71
|
+
expect(html).toContain('<ul')
|
|
72
|
+
expect(html).toContain('<li')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('renders tables with thead and tbody', () => {
|
|
76
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
77
|
+
const html = wrapper.html()
|
|
78
|
+
|
|
79
|
+
expect(html).toContain('Parameter')
|
|
80
|
+
expect(html).toContain('Method')
|
|
81
|
+
expect(html).toContain('Unit')
|
|
82
|
+
expect(html).toContain('ISO 712')
|
|
83
|
+
expect(html).toContain('ISO 520')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('renders admonition blocks', () => {
|
|
87
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
88
|
+
const html = wrapper.html()
|
|
89
|
+
|
|
90
|
+
expect(html).toContain('(20 ± 2) °C')
|
|
91
|
+
expect(html).toContain('admonition-warning')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('renders sourcecode blocks', () => {
|
|
95
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
96
|
+
const html = wrapper.html()
|
|
97
|
+
|
|
98
|
+
expect(html).toContain('moisture_content')
|
|
99
|
+
expect(html).toContain('python')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('renders figures with images', () => {
|
|
103
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
104
|
+
const html = wrapper.html()
|
|
105
|
+
|
|
106
|
+
expect(html).toContain('grain.png')
|
|
107
|
+
expect(html).toContain('Grain structure diagram')
|
|
108
|
+
expect(html).toContain('Grain structure')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('renders ordered lists', () => {
|
|
112
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
113
|
+
const html = wrapper.html()
|
|
114
|
+
|
|
115
|
+
expect(html).toContain('Weigh the sample')
|
|
116
|
+
expect(html).toContain('Dry at 130 °C')
|
|
117
|
+
expect(html).toContain('<ol')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('renders blockquotes', () => {
|
|
121
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
122
|
+
const html = wrapper.html()
|
|
123
|
+
|
|
124
|
+
expect(html).toContain('Precision is the soul of science')
|
|
125
|
+
expect(html).toContain('blockquote')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('renders nested clauses (terms)', () => {
|
|
129
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
130
|
+
const html = wrapper.html()
|
|
131
|
+
|
|
132
|
+
expect(html).toContain('rice')
|
|
133
|
+
expect(html).toContain('Oryza sativa L.')
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('renders xref marks as links', () => {
|
|
137
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
138
|
+
const html = wrapper.html()
|
|
139
|
+
|
|
140
|
+
expect(html).toContain('ISO 712')
|
|
141
|
+
// xref should produce an <a> tag with href to target
|
|
142
|
+
expect(html).toMatch(/href.*iso712/)
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('renders notes with title', () => {
|
|
146
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
147
|
+
const html = wrapper.html()
|
|
148
|
+
|
|
149
|
+
expect(html).toContain('Note')
|
|
150
|
+
expect(html).toContain('paddy rice')
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('renders examples', () => {
|
|
154
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
155
|
+
const html = wrapper.html()
|
|
156
|
+
|
|
157
|
+
expect(html).toContain('Long-grain rice')
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('renders formula blocks', () => {
|
|
161
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
162
|
+
const html = wrapper.html()
|
|
163
|
+
|
|
164
|
+
expect(html).toContain('formula')
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('renders footnotes section', () => {
|
|
168
|
+
const wrapper = mountRenderer(fixture.content!)
|
|
169
|
+
const html = wrapper.html()
|
|
170
|
+
|
|
171
|
+
expect(html).toContain('Published by ISO')
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it('renders document with no content without error', () => {
|
|
175
|
+
const wrapper = mountRenderer([])
|
|
176
|
+
expect(wrapper.html()).toContain('content-blocks')
|
|
177
|
+
})
|
|
178
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="getAdmonitionClass(block.attrs?.type)" class="admonition">
|
|
3
|
+
<div class="admonition-icon" v-html="getAdmonitionIconSvg(block.attrs?.type)"></div>
|
|
4
|
+
<div class="admonition-content">
|
|
5
|
+
<div class="admonition-title">{{ getAdmonitionTitle(block.attrs?.type) }}</div>
|
|
6
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
13
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
14
|
+
|
|
15
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
16
|
+
|
|
17
|
+
const ADMONITION_TITLES: Record<string, string> = {
|
|
18
|
+
danger: 'Danger', caution: 'Caution', warning: 'Warning',
|
|
19
|
+
important: 'Important', 'safety precautions': 'Safety Precautions',
|
|
20
|
+
editorial: 'Editorial', tip: 'Tip', note: 'Note', commentary: 'Commentary',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getAdmonitionClass(type: string | undefined): string {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'note': return 'admonition-note'
|
|
26
|
+
case 'warning': return 'admonition-warning'
|
|
27
|
+
case 'danger': return 'admonition-danger'
|
|
28
|
+
case 'caution': return 'admonition-caution'
|
|
29
|
+
case 'important': return 'admonition-important'
|
|
30
|
+
case 'tip': return 'admonition-tip'
|
|
31
|
+
case 'editorial': return 'admonition-editorial'
|
|
32
|
+
default: return 'admonition-note'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getAdmonitionIconSvg(type: string | undefined): string {
|
|
37
|
+
const s = 'width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"'
|
|
38
|
+
switch (type) {
|
|
39
|
+
case 'note':
|
|
40
|
+
return `<svg ${s}><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>`
|
|
41
|
+
case 'warning':
|
|
42
|
+
return `<svg ${s}><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`
|
|
43
|
+
case 'danger':
|
|
44
|
+
return `<svg ${s}><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`
|
|
45
|
+
case 'caution':
|
|
46
|
+
return `<svg ${s}><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`
|
|
47
|
+
case 'important':
|
|
48
|
+
return `<svg ${s}><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>`
|
|
49
|
+
case 'tip':
|
|
50
|
+
return `<svg ${s}><path d="M9 18h6"/><path d="M10 22h4"/><path d="M12 2a7 7 0 00-4 12.7V17h8v-2.3A7 7 0 0012 2z"/></svg>`
|
|
51
|
+
default:
|
|
52
|
+
return `<svg ${s}><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>`
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getAdmonitionTitle(type: string | undefined): string {
|
|
57
|
+
return ADMONITION_TITLES[type || ''] || (type ? type.charAt(0).toUpperCase() + type.slice(1) : 'Note')
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style scoped>
|
|
62
|
+
.admonition { display: flex; gap: 12px; padding: 14px 16px; border-radius: 8px; margin: 16px 0; }
|
|
63
|
+
.admonition-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
|
|
64
|
+
.admonition-icon :deep(svg) { width: 20px; height: 20px; }
|
|
65
|
+
.admonition-title { font-weight: 700; margin-bottom: 4px; text-transform: uppercase; font-size: 0.75em; letter-spacing: 0.04em; }
|
|
66
|
+
.admonition-content { flex: 1; min-width: 0; }
|
|
67
|
+
.admonition-note { background: color-mix(in srgb, #0d9488 10%, var(--ebook-bg)); color: color-mix(in srgb, #0d9488 70%, var(--ebook-text)); border-left: 3px solid #0d9488; }
|
|
68
|
+
.admonition-warning { background: color-mix(in srgb, #eab308 10%, var(--ebook-bg)); color: color-mix(in srgb, #eab308 70%, var(--ebook-text)); border-left: 3px solid #eab308; }
|
|
69
|
+
.admonition-danger { background: color-mix(in srgb, #ef4444 10%, var(--ebook-bg)); color: color-mix(in srgb, #ef4444 70%, var(--ebook-text)); border-left: 3px solid #ef4444; }
|
|
70
|
+
.admonition-caution { background: color-mix(in srgb, #f97316 10%, var(--ebook-bg)); color: color-mix(in srgb, #f97316 70%, var(--ebook-text)); border-left: 3px solid #f97316; }
|
|
71
|
+
.admonition-important { background: color-mix(in srgb, #a855f7 10%, var(--ebook-bg)); color: color-mix(in srgb, #a855f7 70%, var(--ebook-text)); border-left: 3px solid #a855f7; }
|
|
72
|
+
.admonition-tip { background: color-mix(in srgb, #22c55e 10%, var(--ebook-bg)); color: color-mix(in srgb, #22c55e 70%, var(--ebook-text)); border-left: 3px solid #22c55e; }
|
|
73
|
+
.admonition-editorial { background: color-mix(in srgb, #6366f1 10%, var(--ebook-bg)); color: color-mix(in srgb, #6366f1 70%, var(--ebook-text)); border-left: 3px solid #6366f1; }
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="meta.tag" :id="block.attrs?.id" class="mn-clause mb-6">
|
|
3
|
+
<component
|
|
4
|
+
v-if="block.attrs?.title"
|
|
5
|
+
:is="meta.headingTag"
|
|
6
|
+
:class="['heading-with-anchor heading-text', meta.headingClass]"
|
|
7
|
+
>
|
|
8
|
+
<a
|
|
9
|
+
v-if="block.attrs?.id"
|
|
10
|
+
:href="`#${block.attrs.id}`"
|
|
11
|
+
class="anchor-link"
|
|
12
|
+
@click.prevent="copyAnchor(block.attrs.id)"
|
|
13
|
+
>#</a>
|
|
14
|
+
<span v-if="getNumbering(block.attrs?.id)" class="muted-text mr-2">{{ getNumbering(block.attrs?.id) }}</span>
|
|
15
|
+
{{ block.attrs.title }}
|
|
16
|
+
</component>
|
|
17
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
18
|
+
</component>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { computed } from 'vue'
|
|
23
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
24
|
+
import { useDocumentStore } from '@/stores/documentStore'
|
|
25
|
+
import { SECTION_META } from '@/utils/typeMetadata'
|
|
26
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
27
|
+
|
|
28
|
+
const props = defineProps<{ block: MirrorBlockNode }>()
|
|
29
|
+
|
|
30
|
+
const documentStore = useDocumentStore()
|
|
31
|
+
|
|
32
|
+
const meta = computed(() => {
|
|
33
|
+
return SECTION_META[props.block.type] || SECTION_META['clause']!
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function getNumbering(id: string | undefined): string {
|
|
37
|
+
if (!id) return ''
|
|
38
|
+
return documentStore.getNumbering(id)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function copyAnchor(id: string) {
|
|
42
|
+
const url = `${window.location.origin}${window.location.pathname}#${id}`
|
|
43
|
+
navigator.clipboard.writeText(url)
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
.heading-text { color: var(--ebook-text-heading); }
|
|
49
|
+
.muted-text { color: var(--ebook-text-muted); }
|
|
50
|
+
.heading-with-anchor { position: relative; scroll-margin-top: 70px; }
|
|
51
|
+
.anchor-link { position: absolute; left: -1.2em; color: var(--ebook-text-muted); opacity: 0; transition: opacity 0.15s ease; text-decoration: none; font-weight: 400; font-size: 0.7em; }
|
|
52
|
+
.heading-with-anchor:hover .anchor-link, .anchor-link:focus { opacity: 1; }
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="block.attrs?.id" class="mn-example">
|
|
3
|
+
<div class="example-label">EXAMPLE</div>
|
|
4
|
+
<div class="example-content">
|
|
5
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
12
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
13
|
+
|
|
14
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.mn-example { padding: 1rem 1.25rem; margin: 1.25rem 0; border-radius: 8px; border-left: 3px solid #3b82f6; background: color-mix(in srgb, var(--ebook-bg-secondary) 50%, transparent); }
|
|
19
|
+
.example-label { font-family: ui-monospace, monospace; font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #3b82f6; margin-bottom: 6px; }
|
|
20
|
+
.example-content { color: var(--ebook-text); }
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="block.attrs?.id" class="mn-fallback">
|
|
3
|
+
<div class="fallback-type">{{ block.type }}</div>
|
|
4
|
+
<MirrorRenderer v-if="block.content?.length" :blocks="block.content" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
10
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
11
|
+
|
|
12
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
.mn-fallback { padding: 0.5rem 0; }
|
|
17
|
+
.fallback-type { font-family: ui-monospace, monospace; font-size: 0.65rem; color: var(--ebook-text-muted); opacity: 0.5; text-transform: uppercase; letter-spacing: 0.05em; }
|
|
18
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<figure :id="block.attrs?.id" class="mn-figure">
|
|
3
|
+
<template v-if="block.type === 'image'">
|
|
4
|
+
<img :src="block.attrs?.src" :alt="block.attrs?.alt || ''"
|
|
5
|
+
:height="block.attrs?.height" :width="block.attrs?.width"
|
|
6
|
+
loading="lazy" class="figure-image" />
|
|
7
|
+
</template>
|
|
8
|
+
<template v-else>
|
|
9
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
10
|
+
</template>
|
|
11
|
+
<figcaption v-if="block.attrs?.title" class="figure-caption">{{ block.attrs.title }}</figcaption>
|
|
12
|
+
</figure>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
17
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
18
|
+
|
|
19
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped>
|
|
23
|
+
.mn-figure { margin: 2rem 0; padding: 1rem; background: color-mix(in srgb, var(--ebook-bg-secondary) 40%, transparent); border-radius: 10px; border: 1px solid color-mix(in srgb, var(--ebook-border) 60%, transparent); }
|
|
24
|
+
.figure-image { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 0 auto; }
|
|
25
|
+
.figure-caption { text-align: center; font-size: 0.78rem; color: var(--ebook-text-muted); margin-top: 0.6rem; font-style: italic; }
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mn-footnotes">
|
|
3
|
+
<ol class="footnotes-list">
|
|
4
|
+
<li v-for="(fn, index) in (block.content || [])" :key="index" :id="(fn as any).attrs?.id" class="footnote-entry">
|
|
5
|
+
<MirrorRenderer :blocks="(fn as any).content || []" />
|
|
6
|
+
<a v-if="(fn as any).attrs?.ref_id" :href="`#${(fn as any).attrs.ref_id}`" class="footnote-backref">↩</a>
|
|
7
|
+
</li>
|
|
8
|
+
</ol>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
14
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
15
|
+
|
|
16
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style scoped>
|
|
20
|
+
.mn-footnotes { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--ebook-border); }
|
|
21
|
+
.footnotes-list { list-style-type: decimal; padding-left: 1.5rem; font-size: 0.85rem; color: var(--ebook-text-muted); }
|
|
22
|
+
.footnote-entry { margin-bottom: 0.5rem; line-height: 1.6; }
|
|
23
|
+
.footnote-backref { color: var(--ebook-link-color); text-decoration: none; margin-left: 4px; }
|
|
24
|
+
.footnote-backref:hover { text-decoration: underline; }
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="listTag" :class="listClass">
|
|
3
|
+
<template v-for="(item, index) in (block.content || [])" :key="index">
|
|
4
|
+
<template v-if="item.type === 'list_item'">
|
|
5
|
+
<li class="mn-list-item">
|
|
6
|
+
<template v-for="(child, ci) in (item.content || [])" :key="ci">
|
|
7
|
+
<TextRenderer v-if="child.type === 'text'" :node="child as any" />
|
|
8
|
+
<br v-else-if="child.type === 'soft_break'" />
|
|
9
|
+
<component v-else :is="getBlockComponent(child.type)" :block="child" />
|
|
10
|
+
</template>
|
|
11
|
+
</li>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else-if="item.type === 'dt'">
|
|
14
|
+
<dt class="mn-dt">
|
|
15
|
+
<template v-for="(child, ci) in (item.content || [])" :key="ci">
|
|
16
|
+
<TextRenderer v-if="child.type === 'text'" :node="child as any" />
|
|
17
|
+
</template>
|
|
18
|
+
</dt>
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else-if="item.type === 'dd'">
|
|
21
|
+
<dd class="mn-dd">
|
|
22
|
+
<MirrorRenderer :blocks="item.content || []" />
|
|
23
|
+
</dd>
|
|
24
|
+
</template>
|
|
25
|
+
</template>
|
|
26
|
+
</component>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { computed } from 'vue'
|
|
31
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
32
|
+
import TextRenderer from '@/components/TextRenderer.vue'
|
|
33
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
34
|
+
import { getBlockComponent } from './index'
|
|
35
|
+
|
|
36
|
+
const props = defineProps<{ block: MirrorBlockNode }>()
|
|
37
|
+
|
|
38
|
+
const listTag = computed(() => {
|
|
39
|
+
switch (props.block.type) {
|
|
40
|
+
case 'ordered_list': return 'ol'
|
|
41
|
+
case 'dl': return 'dl'
|
|
42
|
+
default: return 'ul'
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const listClass = computed(() => {
|
|
47
|
+
switch (props.block.type) {
|
|
48
|
+
case 'ordered_list': return 'mn-ordered-list'
|
|
49
|
+
case 'dl': return 'mn-definition-list'
|
|
50
|
+
default: return 'mn-bullet-list'
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.mn-bullet-list { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 1rem; }
|
|
57
|
+
.mn-ordered-list { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 1rem; }
|
|
58
|
+
.mn-definition-list { margin: 1rem 0; }
|
|
59
|
+
.mn-list-item { margin-bottom: 0.3rem; line-height: 1.65; color: var(--ebook-text); }
|
|
60
|
+
.mn-dt { font-weight: 600; color: var(--ebook-text-heading); margin-top: 1rem; }
|
|
61
|
+
.mn-dd { margin-left: 1.5rem; margin-bottom: 0.5rem; color: var(--ebook-text); line-height: 1.65; }
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="block.attrs?.id" class="mn-note">
|
|
3
|
+
<div class="note-title">Note</div>
|
|
4
|
+
<div class="note-content">
|
|
5
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
12
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
13
|
+
|
|
14
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.mn-note { padding: 1rem 1.25rem; margin: 1.25rem 0; border-radius: 8px; border-left: 3px solid #0d9488; background: color-mix(in srgb, var(--ebook-bg-secondary) 50%, transparent); }
|
|
19
|
+
.note-title { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #0d9488; margin-bottom: 6px; }
|
|
20
|
+
.note-content { color: var(--ebook-text); }
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p :id="block.attrs?.id" class="mn-paragraph mb-3 ebook-text leading-relaxed">
|
|
3
|
+
<template v-for="(child, ci) in block.content" :key="ci">
|
|
4
|
+
<TextRenderer v-if="child.type === 'text'" :node="child as any" />
|
|
5
|
+
<br v-else-if="child.type === 'soft_break'" />
|
|
6
|
+
<sup v-else-if="child.type === 'footnote_marker'" class="footnote-marker">
|
|
7
|
+
<a :href="`#${child.attrs?.ref_id}`" :id="child.attrs?.id">{{ child.attrs?.number || '*' }}</a>
|
|
8
|
+
</sup>
|
|
9
|
+
</template>
|
|
10
|
+
</p>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
15
|
+
import TextRenderer from '@/components/TextRenderer.vue'
|
|
16
|
+
|
|
17
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<style scoped>
|
|
21
|
+
.ebook-text { color: var(--ebook-text); }
|
|
22
|
+
.footnote-marker { font-size: 0.75em; vertical-align: super; line-height: 0; }
|
|
23
|
+
.footnote-marker a { color: var(--ebook-link-color); text-decoration: none; cursor: pointer; }
|
|
24
|
+
.footnote-marker a:hover { text-decoration: underline; }
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<blockquote :id="block.attrs?.id" class="mn-quote">
|
|
3
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
4
|
+
</blockquote>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
9
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
10
|
+
|
|
11
|
+
defineProps<{ block: MirrorBlockNode }>()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.mn-quote {
|
|
16
|
+
position: relative;
|
|
17
|
+
border-left: 3px solid var(--ebook-accent);
|
|
18
|
+
padding: 0.75rem 1.25rem 0.75rem 1.5rem;
|
|
19
|
+
margin: 1.5rem 0;
|
|
20
|
+
font-style: italic;
|
|
21
|
+
color: var(--ebook-text-muted);
|
|
22
|
+
background: color-mix(in srgb, var(--ebook-bg-secondary) 60%, transparent);
|
|
23
|
+
border-radius: 0 8px 8px 0;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="block.attrs?.id" class="mn-review mb-4 border-l-3 rounded-md" :class="borderClass">
|
|
3
|
+
<div v-if="block.attrs?.title || block.attrs?.reviewer" class="review-header">
|
|
4
|
+
<span v-if="block.attrs?.title" class="review-title">{{ block.attrs.title }}</span>
|
|
5
|
+
<span v-if="block.attrs?.reviewer" class="review-reviewer">— {{ block.attrs.reviewer }}</span>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="review-content">
|
|
8
|
+
<MirrorRenderer :blocks="block.content || []" />
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { computed } from 'vue'
|
|
15
|
+
import type { MirrorBlockNode } from '@/stores/documentStore'
|
|
16
|
+
import MirrorRenderer from '@/components/MirrorRenderer.vue'
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{ block: MirrorBlockNode }>()
|
|
19
|
+
|
|
20
|
+
const borderClass = computed(() => {
|
|
21
|
+
switch (props.block.attrs?.review_type) {
|
|
22
|
+
case 'editorial': return 'review-editorial'
|
|
23
|
+
case 'technical': return 'review-technical'
|
|
24
|
+
case 'general': return 'review-general'
|
|
25
|
+
default: return 'review-general'
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<style scoped>
|
|
31
|
+
.mn-review { border-left: 3px solid var(--ebook-border); padding: 0.75rem 1rem; background: var(--ebook-bg-secondary); }
|
|
32
|
+
.review-header { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
|
|
33
|
+
.review-title { color: var(--ebook-text-heading); }
|
|
34
|
+
.review-reviewer { color: var(--ebook-text-muted); font-weight: 400; }
|
|
35
|
+
.review-content { font-size: 0.9rem; }
|
|
36
|
+
.review-editorial { border-left-color: #f59e0b; }
|
|
37
|
+
.review-technical { border-left-color: #ef4444; }
|
|
38
|
+
.review-general { border-left-color: #3b82f6; }
|
|
39
|
+
</style>
|