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 @@
|
|
|
1
|
+
<audio{{ attrs }} controls></audio>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p{% if entry.id %} id="{{ entry.id }}"{% endif %} class="{{ entry.css_class }}">{% if entry.has_ordinal %}<span class="biblio-ordinal">{{ entry.ordinal_html }}</span> {% endif %}{% if entry.has_url %}<a href="{{ entry.url }}" target="_blank" rel="noopener" class="biblio-link">{% endif %}{% if entry.pubid_html %}<span class="ref-pubid">{{ entry.pubid_html }}</span>{% endif %}{% if entry.has_url %}</a>{% endif %} {{ entry.content_html }}</p>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<div class="title-section">
|
|
2
|
+
<div class="cover-grid">
|
|
3
|
+
<div class="cover-meta">
|
|
4
|
+
{% if logos %}
|
|
5
|
+
<div class="cover-publishers">
|
|
6
|
+
{% for svg in logos %}
|
|
7
|
+
{{ svg }}
|
|
8
|
+
{% endfor %}
|
|
9
|
+
</div>
|
|
10
|
+
{% endif %}
|
|
11
|
+
{% for id in doc_ids %}
|
|
12
|
+
<p class="cover-doc-id">{{ id }}</p>
|
|
13
|
+
{% endfor %}
|
|
14
|
+
{% if date %}
|
|
15
|
+
<p class="cover-date">{{ date }}</p>
|
|
16
|
+
{% endif %}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="cover-body">
|
|
19
|
+
{% if title %}
|
|
20
|
+
<div class="cover-title"><span>{{ title }}</span></div>
|
|
21
|
+
{% endif %}
|
|
22
|
+
{% if stage %}
|
|
23
|
+
<div class="cover-stage"><p>{{ stage }}</p></div>
|
|
24
|
+
{% endif %}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div><hr class="cover-separator" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="boilerplate-copyright">{{ content }}</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<a id="{{ id }}"></a>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<br />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<{{ tag }}{{ extra_attrs }}>{{ content }}</{{ tag }}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span{{ attrs }}><span class="fn-link" id="fnref-{{ number }}" tabindex="0" role="link" aria-label="Footnote {{ label }}" data-href="#footnote-{{ number }}">{{ label }}</span>{% if popup_html %}<span class="fn-popup">{{ popup_html }}</span>{% endif %}</span>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<section class="footnotes-section" aria-label="Footnotes">
|
|
2
2
|
<h2 class="footnotes-title">Footnotes</h2>
|
|
3
|
-
<
|
|
3
|
+
<div class="footnotes">
|
|
4
4
|
{% for entry in footnotes %}
|
|
5
|
-
<
|
|
6
|
-
<a href="#fnref-{{ entry.number }}" class="footnote-backref">
|
|
7
|
-
|
|
8
|
-
</
|
|
5
|
+
<div id="footnote-{{ entry.number }}" class="footnote">
|
|
6
|
+
<a href="#fnref-{{ entry.number }}" class="footnote-backref" aria-label="Back to reference">↩</a><span class="footnote-label">{{ entry.label }}</span>
|
|
7
|
+
{{ entry.content_html }}
|
|
8
|
+
</div>
|
|
9
9
|
{% endfor %}
|
|
10
|
-
</
|
|
10
|
+
</div>
|
|
11
11
|
</section>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div{% if block.id %} id="{{ block.id }}"{% endif %} class="{{ block.css_class }}">
|
|
2
2
|
{{ block.stem_html }}
|
|
3
|
-
{% if block.
|
|
3
|
+
{% if block.where_label %}<p class="formula-where">where,</p>{% endif %}
|
|
4
4
|
{{ block.where_html }}
|
|
5
5
|
{% if block.number_html %}<span class="formula-number">{{ block.number_html }}</span>{% endif %}
|
|
6
6
|
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</button>
|
|
13
13
|
<div class="header-settings">
|
|
14
14
|
<button class="reader-btn settings-toggle" id="settings-toggle" aria-label="Reader settings" title="Settings">
|
|
15
|
-
<svg viewBox="0 0
|
|
15
|
+
<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.994 6.994 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.994 6.994 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.994 6.994 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.994 6.994 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" clip-rule="evenodd"/></svg>
|
|
16
16
|
</button>
|
|
17
17
|
<div class="settings-dropdown" id="settings-dropdown">
|
|
18
18
|
<button class="reader-btn font-decrease" id="font-decrease" aria-label="Decrease font size" title="Smaller text">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<{{ tag }}{{ class_attr }}>{{ content }}</{{ tag }}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<img{{ attrs }} />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span{{ attrs }}>{{ content }}</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<a{{ attrs }}>{% if content %}{{ content }}{% else %}{{ display_text }}{% endif %}</a>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<li{{ attrs }}>{{ content }}</li>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<main class="main-section">{{ content }}</main>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span class="math-container"{{ data_attrs }}><math xmlns="http://www.w3.org/1998/Math/MathML">{{ content }}</math></span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p{{ attrs }}>{{ content }}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="prefatory-section">{{ content }}</div><hr class="cover-separator" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{% if publisher %}<span class="ref-publisher-name">{{ publisher }}</span>{% endif %}{% if number %} <span class="ref-doc-number">{{ number }}</span>{% endif %}{% if date %}:<span class="ref-year">{{ date }}</span>{% endif %}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{ prefix }}<span class="ref-year">{{ year }}</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
, <i>{{ content }}</i>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div class="title-section">
|
|
2
|
+
<div class="cover-grid">
|
|
3
|
+
<div class="cover-meta">
|
|
4
|
+
{% if publisher_logos %}
|
|
5
|
+
<div class="cover-publishers">
|
|
6
|
+
{% for logo in publisher_logos %}
|
|
7
|
+
{{ logo }}
|
|
8
|
+
{% endfor %}
|
|
9
|
+
</div>
|
|
10
|
+
{% endif %}
|
|
11
|
+
{% if doc_id %}
|
|
12
|
+
<p class="cover-doc-id">{{ doc_id | escape }}</p>
|
|
13
|
+
{% endif %}
|
|
14
|
+
{% if pub_date %}
|
|
15
|
+
<p class="cover-date">{{ pub_date | escape }}</p>
|
|
16
|
+
{% endif %}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="cover-body">
|
|
19
|
+
{% if doctype %}
|
|
20
|
+
<p class="cover-doctype">{{ doctype | escape }}</p>
|
|
21
|
+
{% endif %}
|
|
22
|
+
{% if title %}
|
|
23
|
+
<div class="cover-title"><span>{{ title | escape }}</span></div>
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% if stage %}
|
|
26
|
+
<div class="cover-stage"><p>{{ stage | escape }}</p></div>
|
|
27
|
+
{% endif %}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<hr class="cover-separator" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span class="stem"{{ data_attrs }}>{{ text }}</span>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="table-scroll-wrapper">
|
|
2
|
+
{% if caption %}<div class="table-caption">{{ caption }}</div>{% endif %}
|
|
3
|
+
<table{{ attrs }}>
|
|
4
|
+
{% if colgroup_html %}{{ colgroup_html }}{% endif %}
|
|
5
|
+
{% if thead_html %}{{ thead_html }}{% endif %}
|
|
6
|
+
{{ tbody_html }}
|
|
7
|
+
{% if tfoot_html %}{{ tfoot_html }}{% endif %}
|
|
8
|
+
</table>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="term-domain"><{{ text }}></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p><span class="example-label">{{ label }}</span> {{ content }}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p><span class="term-note-label">{{ label }}: </span>{{ content }}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="term-number">{{ content }}</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p class="term-source">[SOURCE: {{ content }}]</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="note-block"><p><span class="term-note-label">{{ label }}</span>{{ content }}</p></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<video{{ attrs }} controls></video>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div id="preface" class="preface-section"><h1 class="foreword-title">Preface</h1>{{ content }}</div>
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
<button class="toc-hamburger" id="toc-hamburger" aria-label="Open table of contents">☰</button>
|
|
37
37
|
<button class="back-to-top" id="back-to-top" aria-label="Back to top"><svg viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="3,8 6,4 9,8"/></svg></button>
|
|
38
|
+
<div class="fn-annotation-pane" id="fn-annotation-pane">
|
|
39
|
+
<div class="fn-annotation-header"><span class="fn-annotation-label" id="fn-annotation-label"></span></div>
|
|
40
|
+
<div class="fn-annotation-body" id="fn-annotation-content"></div>
|
|
41
|
+
</div>
|
|
38
42
|
{{ scripts }}
|
|
39
43
|
</body>
|
|
40
44
|
</html>
|
data/lib/metanorma/html/theme.rb
CHANGED
|
@@ -2,113 +2,186 @@
|
|
|
2
2
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module Html
|
|
5
|
-
class Theme
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
5
|
+
class Theme < Lutaml::Model::Serializable
|
|
6
|
+
THEMES_DIR = File.join(File.dirname(__FILE__), "..", "..", "..", "data",
|
|
7
|
+
"themes")
|
|
8
|
+
TEMPLATES_ROOT = File.join(File.dirname(__FILE__), "templates")
|
|
9
|
+
|
|
10
|
+
# --- Primary palette ---
|
|
11
|
+
attribute :primary, :string, default: -> { "#28388A" }
|
|
12
|
+
attribute :accent, :string, default: -> { "#9C60C1" }
|
|
13
|
+
attribute :gradient, :string, default: -> {
|
|
14
|
+
"linear-gradient(135deg, #28388A 0%, #3a4ba0 50%, #9C60C1 100%)"
|
|
15
|
+
}
|
|
16
|
+
attribute :primary_light, :string, default: -> { "#eef0f8" }
|
|
17
|
+
attribute :accent_light, :string, default: -> { "#f5eef9" }
|
|
18
|
+
attribute :primary_dark, :string, default: -> { "#1c2660" }
|
|
19
|
+
attribute :accent_deep, :string
|
|
20
|
+
attribute :warm, :string
|
|
21
|
+
attribute :warm_light, :string
|
|
22
|
+
|
|
23
|
+
# --- Text & backgrounds ---
|
|
24
|
+
attribute :text_color, :string, default: -> { "#1a1a2e" }
|
|
25
|
+
attribute :text_light, :string, default: -> { "#4a4a6a" }
|
|
26
|
+
attribute :text_muted, :string, default: -> { "#8888a0" }
|
|
27
|
+
attribute :bg, :string, default: -> { "#fff" }
|
|
28
|
+
attribute :bg_light, :string, default: -> { "#fafbff" }
|
|
29
|
+
attribute :border, :string, default: -> { "#e0e2ee" }
|
|
30
|
+
attribute :sidebar_bg, :string, default: -> { "#f7f7fc" }
|
|
31
|
+
|
|
32
|
+
# --- Typography ---
|
|
33
|
+
attribute :font_body, :string, default: -> {
|
|
34
|
+
'"Source Serif 4", "Noto Serif", Georgia, "Times New Roman", serif'
|
|
35
|
+
}
|
|
36
|
+
attribute :font_sans, :string, default: -> {
|
|
37
|
+
'"DM Sans", "Helvetica Neue", Arial, sans-serif'
|
|
38
|
+
}
|
|
39
|
+
attribute :font_mono, :string, default: -> {
|
|
40
|
+
'"JetBrains Mono", "Fira Code", "Courier New", monospace'
|
|
41
|
+
}
|
|
42
|
+
attribute :font_url, :string, default: -> { "https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300..700;1,8..60,300..700&family=JetBrains+Mono:wght@400;500&display=swap" }
|
|
43
|
+
|
|
44
|
+
# --- Layout constants ---
|
|
45
|
+
attribute :content_max_width, :string, default: -> { "50em" }
|
|
46
|
+
attribute :sidebar_width, :string, default: -> { "260px" }
|
|
47
|
+
attribute :header_height, :string, default: -> { "52px" }
|
|
48
|
+
attribute :radius_sm, :string, default: -> { "4px" }
|
|
49
|
+
attribute :radius_md, :string, default: -> { "8px" }
|
|
50
|
+
attribute :shadow_sm, :string, default: -> {
|
|
51
|
+
"0 1px 3px rgba(40,56,138,0.08)"
|
|
52
|
+
}
|
|
53
|
+
attribute :shadow_md, :string, default: -> {
|
|
54
|
+
"0 4px 12px rgba(40,56,138,0.12)"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# --- Block element colors ---
|
|
58
|
+
attribute :note_color, :string, default: -> { "var(--mn-accent)" }
|
|
59
|
+
attribute :note_bg, :string, default: -> { "var(--mn-accent-light)" }
|
|
60
|
+
attribute :note_border, :string, default: -> { "var(--mn-accent)" }
|
|
61
|
+
attribute :example_color, :string, default: -> { "#0d9488" }
|
|
62
|
+
attribute :example_bg, :string, default: -> { "rgba(232, 248, 245, 0.6)" }
|
|
63
|
+
attribute :example_border, :string, default: -> { "#0d9488" }
|
|
64
|
+
attribute :admonition_color, :string, default: -> { "#b8860b" }
|
|
65
|
+
attribute :admonition_bg, :string, default: -> {
|
|
66
|
+
"rgba(255, 252, 245, 0.8)"
|
|
67
|
+
}
|
|
68
|
+
attribute :admonition_border, :string, default: -> { "#e8a820" }
|
|
69
|
+
|
|
70
|
+
# --- Footer & cover ---
|
|
71
|
+
attribute :footer_border_color, :string
|
|
72
|
+
attribute :cover_separator_color, :string
|
|
73
|
+
|
|
74
|
+
# --- Computed CSS (gradients) ---
|
|
75
|
+
attribute :header_background, :string
|
|
76
|
+
attribute :cover_background, :string
|
|
77
|
+
attribute :cover_after_bg, :string
|
|
78
|
+
attribute :cover_before_bg, :string
|
|
79
|
+
attribute :progress_bar_color, :string
|
|
80
|
+
|
|
81
|
+
# --- Dark mode overrides ---
|
|
82
|
+
attribute :dark_bg, :string, default: -> { "#0f1118" }
|
|
83
|
+
attribute :dark_bg_light, :string, default: -> { "#1a1d2a" }
|
|
84
|
+
attribute :dark_border, :string, default: -> { "#2e3248" }
|
|
85
|
+
attribute :dark_sidebar, :string, default: -> { "#141620" }
|
|
86
|
+
attribute :dark_text, :string, default: -> { "#e2e6f0" }
|
|
87
|
+
attribute :dark_text_light, :string, default: -> { "#c0c8dc" }
|
|
88
|
+
attribute :dark_text_muted, :string, default: -> { "#96a0b8" }
|
|
89
|
+
attribute :dark_primary_light, :string, default: -> { "#1e2140" }
|
|
90
|
+
attribute :dark_accent_light, :string, default: -> { "#2a2040" }
|
|
91
|
+
attribute :dark_note_bg, :string
|
|
92
|
+
attribute :dark_example_bg, :string
|
|
93
|
+
attribute :dark_admonition_bg, :string
|
|
94
|
+
attribute :dark_code_bg, :string
|
|
95
|
+
attribute :dark_code_border, :string
|
|
96
|
+
|
|
97
|
+
# --- Arbitrary per-element CSS overrides ---
|
|
98
|
+
attribute :extra_css, :string
|
|
99
|
+
|
|
100
|
+
# --- Publisher metadata ---
|
|
101
|
+
attribute :publishers, :string, collection: true, default: -> { [] }
|
|
102
|
+
attribute :publisher_name, :string
|
|
103
|
+
attribute :logos_light, :hash, default: -> { {} }
|
|
104
|
+
attribute :logos_dark, :hash, default: -> { {} }
|
|
105
|
+
attribute :doctype_labels, :hash, default: -> { {} }
|
|
106
|
+
|
|
107
|
+
# --- Document identifier formatting ---
|
|
108
|
+
attribute :doc_id_strip_prefix, :string
|
|
109
|
+
|
|
110
|
+
# --- Section ordering ---
|
|
111
|
+
attribute :preface_order, :string, collection: true, default: -> {
|
|
112
|
+
%w[foreword introduction abstract clause acknowledgements executivesummary]
|
|
113
|
+
}
|
|
114
|
+
attribute :clause_order, :string, collection: true, default: -> {
|
|
115
|
+
%w[sections annex bibliography indexsect]
|
|
116
|
+
}
|
|
117
|
+
attribute :preface_wrap, :boolean, default: -> { false }
|
|
118
|
+
attribute :toc_filter_types, :string, collection: true, default: -> { [] }
|
|
119
|
+
|
|
120
|
+
# --- Non-YAML state (set programmatically) ---
|
|
121
|
+
attr_accessor :theme_dir
|
|
122
|
+
|
|
123
|
+
def self.load(flavor)
|
|
124
|
+
dir_theme = File.join(THEMES_DIR, flavor.to_s, "theme.yaml")
|
|
125
|
+
flat_theme = File.join(THEMES_DIR, "#{flavor}.yaml")
|
|
126
|
+
|
|
127
|
+
if File.exist?(dir_theme)
|
|
128
|
+
from_directory(dir_theme, flavor)
|
|
129
|
+
elsif File.exist?(flat_theme)
|
|
130
|
+
from_file(flat_theme)
|
|
131
|
+
else
|
|
132
|
+
new
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def self.from_file(path)
|
|
137
|
+
from_yaml(File.read(path))
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def self.from_directory(path, flavor)
|
|
141
|
+
theme = from_yaml(File.read(path))
|
|
142
|
+
theme.theme_dir = File.join(THEMES_DIR, flavor.to_s)
|
|
143
|
+
theme
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def logos
|
|
147
|
+
logos_light
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def theme_templates_dir
|
|
151
|
+
return nil unless theme_dir
|
|
152
|
+
|
|
153
|
+
dir = File.join(theme_dir, "templates")
|
|
154
|
+
File.directory?(dir) ? dir : nil
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def theme_assets_dir
|
|
158
|
+
return nil unless theme_dir
|
|
159
|
+
|
|
160
|
+
dir = File.join(theme_dir, "assets")
|
|
161
|
+
File.directory?(dir) ? dir : nil
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def theme_css_path
|
|
165
|
+
return nil unless theme_dir
|
|
166
|
+
|
|
167
|
+
path = File.join(theme_dir, "custom.css")
|
|
168
|
+
File.exist?(path) ? path : nil
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def resolve_template(template_name)
|
|
172
|
+
if theme_templates_dir
|
|
173
|
+
flavor_path = File.join(theme_templates_dir, template_name)
|
|
174
|
+
return flavor_path if File.exist?(flavor_path)
|
|
175
|
+
end
|
|
176
|
+
File.join(TEMPLATES_ROOT, template_name)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def resolve_asset(filename)
|
|
180
|
+
if theme_assets_dir
|
|
181
|
+
flavor_path = File.join(theme_assets_dir, filename)
|
|
182
|
+
return flavor_path if File.exist?(flavor_path)
|
|
183
|
+
end
|
|
184
|
+
nil
|
|
112
185
|
end
|
|
113
186
|
|
|
114
187
|
def to_css_root
|
data/lib/metanorma/html.rb
CHANGED
|
@@ -22,7 +22,20 @@ module Metanorma
|
|
|
22
22
|
node.children.to_a
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Patch missing Moxml module method used by lutaml-model XML serializer
|
|
28
|
+
::Moxml.class_eval do
|
|
29
|
+
def self.preprocess_entities(text)
|
|
30
|
+
if block_given?
|
|
31
|
+
yield text
|
|
32
|
+
else
|
|
33
|
+
text
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
25
37
|
|
|
38
|
+
module Html
|
|
26
39
|
Lutaml::Xml::XmlElement.class_eval do
|
|
27
40
|
remove_method :order
|
|
28
41
|
|
|
@@ -3,31 +3,6 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module IetfDocument
|
|
5
5
|
module Metadata
|
|
6
|
-
class PiSettings < Lutaml::Model::Serializable
|
|
7
|
-
attribute :toc, :string
|
|
8
|
-
attribute :tocdepth, :string
|
|
9
|
-
attribute :symrefs, :string
|
|
10
|
-
attribute :sortrefs, :string
|
|
11
|
-
attribute :compact, :string
|
|
12
|
-
attribute :subcompact, :string
|
|
13
|
-
attribute :strict, :string
|
|
14
|
-
attribute :comments, :string
|
|
15
|
-
attribute :notedraftinprogress, :string
|
|
16
|
-
|
|
17
|
-
xml do
|
|
18
|
-
element "pi"
|
|
19
|
-
map_element "toc", to: :toc
|
|
20
|
-
map_element "tocdepth", to: :tocdepth
|
|
21
|
-
map_element "symrefs", to: :symrefs
|
|
22
|
-
map_element "sortrefs", to: :sortrefs
|
|
23
|
-
map_element "compact", to: :compact
|
|
24
|
-
map_element "subcompact", to: :subcompact
|
|
25
|
-
map_element "strict", to: :strict
|
|
26
|
-
map_element "comments", to: :comments
|
|
27
|
-
map_element "notedraftinprogress", to: :notedraftinprogress
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
6
|
class IetfBibDataExtensionType < Lutaml::Model::Serializable
|
|
32
7
|
attribute :doctype, :string
|
|
33
8
|
attribute :flavor, :string
|