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,184 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module Inline
|
|
7
|
+
# Shared vocabulary of inline child elements that may appear in any
|
|
8
|
+
# general-purpose inline-content container. Including this module
|
|
9
|
+
# in a `Lutaml::Model::Serializable` subclass declares every inline
|
|
10
|
+
# element type as a collection attribute, so that no inline child
|
|
11
|
+
# encountered during parsing is silently dropped.
|
|
12
|
+
#
|
|
13
|
+
# Use together with `VocabularyXmlMapping.apply_inline_mappings`
|
|
14
|
+
# inside the class's `xml do ... end` block.
|
|
15
|
+
#
|
|
16
|
+
# Restricted child sets (e.g. `XrefElement` with only `<location>`
|
|
17
|
+
# children) intentionally do NOT include this module — they have
|
|
18
|
+
# semantic reasons to exclude the general vocabulary.
|
|
19
|
+
module Vocabulary
|
|
20
|
+
def self.included(base)
|
|
21
|
+
declare_text_attributes_on(base)
|
|
22
|
+
declare_formatting_attributes_on(base)
|
|
23
|
+
declare_cross_reference_attributes_on(base)
|
|
24
|
+
declare_structural_attributes_on(base)
|
|
25
|
+
declare_rendered_display_attributes_on(base)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class << self
|
|
29
|
+
def declare_text_attributes_on(base)
|
|
30
|
+
base.attribute :text, :string, collection: true
|
|
31
|
+
base.attribute :semx,
|
|
32
|
+
Metanorma::Document::Components::Inline::SemxElement,
|
|
33
|
+
collection: true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def declare_formatting_attributes_on(base)
|
|
37
|
+
base.attribute :em,
|
|
38
|
+
Metanorma::Document::Components::Inline::EmRawElement,
|
|
39
|
+
collection: true
|
|
40
|
+
base.attribute :strong,
|
|
41
|
+
Metanorma::Document::Components::Inline::StrongRawElement,
|
|
42
|
+
collection: true
|
|
43
|
+
base.attribute :sub,
|
|
44
|
+
Metanorma::Document::Components::Inline::SubElement,
|
|
45
|
+
collection: true
|
|
46
|
+
base.attribute :sup,
|
|
47
|
+
Metanorma::Document::Components::Inline::SupElement,
|
|
48
|
+
collection: true
|
|
49
|
+
base.attribute :tt,
|
|
50
|
+
Metanorma::Document::Components::Inline::TtElement,
|
|
51
|
+
collection: true
|
|
52
|
+
base.attribute :underline,
|
|
53
|
+
Metanorma::Document::Components::TextElements::UnderlineElement,
|
|
54
|
+
collection: true
|
|
55
|
+
base.attribute :strike,
|
|
56
|
+
Metanorma::Document::Components::TextElements::StrikeElement,
|
|
57
|
+
collection: true
|
|
58
|
+
base.attribute :smallcap,
|
|
59
|
+
Metanorma::Document::Components::Inline::SmallCapElement,
|
|
60
|
+
collection: true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def declare_cross_reference_attributes_on(base)
|
|
64
|
+
base.attribute :xref,
|
|
65
|
+
Metanorma::Document::Components::Inline::XrefElement,
|
|
66
|
+
collection: true
|
|
67
|
+
base.attribute :eref,
|
|
68
|
+
Metanorma::Document::Components::Inline::ErefElement,
|
|
69
|
+
collection: true
|
|
70
|
+
base.attribute :link,
|
|
71
|
+
Metanorma::Document::Components::Inline::LinkElement,
|
|
72
|
+
collection: true
|
|
73
|
+
base.attribute :span,
|
|
74
|
+
Metanorma::Document::Components::Inline::SpanElement,
|
|
75
|
+
collection: true
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def declare_structural_attributes_on(base)
|
|
79
|
+
base.attribute :stem,
|
|
80
|
+
Metanorma::Document::Components::Inline::StemInlineElement,
|
|
81
|
+
collection: true
|
|
82
|
+
base.attribute :concept,
|
|
83
|
+
Metanorma::Document::Components::Inline::ConceptElement,
|
|
84
|
+
collection: true
|
|
85
|
+
base.attribute :fn,
|
|
86
|
+
Metanorma::Document::Components::Inline::FnElement,
|
|
87
|
+
collection: true
|
|
88
|
+
base.attribute :bcp14,
|
|
89
|
+
Metanorma::Document::Components::Inline::Bcp14Element,
|
|
90
|
+
collection: true
|
|
91
|
+
base.attribute :br,
|
|
92
|
+
Metanorma::Document::Components::Inline::BrElement,
|
|
93
|
+
collection: true
|
|
94
|
+
base.attribute :tab,
|
|
95
|
+
Metanorma::Document::Components::Inline::TabElement,
|
|
96
|
+
collection: true
|
|
97
|
+
base.attribute :bookmark,
|
|
98
|
+
Metanorma::Document::Components::IdElements::Bookmark,
|
|
99
|
+
collection: true
|
|
100
|
+
base.attribute :image,
|
|
101
|
+
Metanorma::Document::Components::IdElements::Image,
|
|
102
|
+
collection: true
|
|
103
|
+
base.attribute :index,
|
|
104
|
+
Metanorma::Document::Components::EmptyElements::IndexElement,
|
|
105
|
+
collection: true
|
|
106
|
+
base.attribute :add, "Metanorma::Document::Elements::Add",
|
|
107
|
+
collection: true
|
|
108
|
+
base.attribute :del, "Metanorma::Document::Elements::Del",
|
|
109
|
+
collection: true
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def declare_rendered_display_attributes_on(base)
|
|
113
|
+
base.attribute :fmt_stem,
|
|
114
|
+
Metanorma::Document::Components::Inline::FmtStemElement,
|
|
115
|
+
collection: true
|
|
116
|
+
base.attribute :fmt_concept,
|
|
117
|
+
Metanorma::Document::Components::Inline::FmtConceptElement,
|
|
118
|
+
collection: true
|
|
119
|
+
base.attribute :fmt_fn_label,
|
|
120
|
+
Metanorma::Document::Components::Inline::FmtFnLabelElement,
|
|
121
|
+
collection: true
|
|
122
|
+
base.attribute :fmt_annotation_start,
|
|
123
|
+
Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
|
|
124
|
+
collection: true
|
|
125
|
+
base.attribute :fmt_annotation_end,
|
|
126
|
+
Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
|
|
127
|
+
collection: true
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Adds the `map_element` calls corresponding to every vocabulary
|
|
132
|
+
# attribute. Call inside an `xml do ... end` block:
|
|
133
|
+
#
|
|
134
|
+
# xml do
|
|
135
|
+
# element "span"
|
|
136
|
+
# mixed_content
|
|
137
|
+
# map_attribute "class", to: :class_attr
|
|
138
|
+
# map_content to: :text
|
|
139
|
+
# VocabularyXmlMapping.apply_inline_mappings(self)
|
|
140
|
+
# end
|
|
141
|
+
module VocabularyXmlMapping
|
|
142
|
+
INLINE_MAPPINGS = {
|
|
143
|
+
"semx" => :semx,
|
|
144
|
+
"em" => :em,
|
|
145
|
+
"strong" => :strong,
|
|
146
|
+
"sub" => :sub,
|
|
147
|
+
"sup" => :sup,
|
|
148
|
+
"tt" => :tt,
|
|
149
|
+
"underline" => :underline,
|
|
150
|
+
"strike" => :strike,
|
|
151
|
+
"smallcap" => :smallcap,
|
|
152
|
+
"br" => :br,
|
|
153
|
+
"tab" => :tab,
|
|
154
|
+
"xref" => :xref,
|
|
155
|
+
"eref" => :eref,
|
|
156
|
+
"link" => :link,
|
|
157
|
+
"span" => :span,
|
|
158
|
+
"stem" => :stem,
|
|
159
|
+
"concept" => :concept,
|
|
160
|
+
"fn" => :fn,
|
|
161
|
+
"bcp14" => :bcp14,
|
|
162
|
+
"bookmark" => :bookmark,
|
|
163
|
+
"image" => :image,
|
|
164
|
+
"index" => :index,
|
|
165
|
+
"add" => :add,
|
|
166
|
+
"del" => :del,
|
|
167
|
+
"fmt-stem" => :fmt_stem,
|
|
168
|
+
"fmt-concept" => :fmt_concept,
|
|
169
|
+
"fmt-fn-label" => :fmt_fn_label,
|
|
170
|
+
"fmt-annotation-start" => :fmt_annotation_start,
|
|
171
|
+
"fmt-annotation-end" => :fmt_annotation_end,
|
|
172
|
+
}.freeze
|
|
173
|
+
|
|
174
|
+
def self.apply_inline_mappings(mapping)
|
|
175
|
+
INLINE_MAPPINGS.each do |element_name, attr_name|
|
|
176
|
+
mapping.map_element(element_name, to: attr_name)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Metanorma
|
|
2
4
|
module Document
|
|
3
5
|
module Components
|
|
4
6
|
module Inline
|
|
7
|
+
# A cross-reference to another part of the document.
|
|
8
|
+
#
|
|
9
|
+
# Multi-target cross-references carry one or more `<location>`
|
|
10
|
+
# children — secondary targets joined by connectives
|
|
11
|
+
# (e.g. "see Figure 4, 5.1.6 and 5.1.7"). The primary target is
|
|
12
|
+
# in the `target` attribute; secondary targets are in `location`.
|
|
5
13
|
class XrefElement < Lutaml::Model::Serializable
|
|
6
14
|
attribute :id, :string
|
|
7
15
|
attribute :target, :string
|
|
@@ -12,6 +20,7 @@ module Metanorma
|
|
|
12
20
|
attribute :nopage, :string
|
|
13
21
|
attribute :alt, :string
|
|
14
22
|
attribute :text, :string, collection: true
|
|
23
|
+
attribute :location, LocationElement, collection: true
|
|
15
24
|
|
|
16
25
|
xml do
|
|
17
26
|
element "xref"
|
|
@@ -24,6 +33,7 @@ module Metanorma
|
|
|
24
33
|
map_attribute "nopage", to: :nopage
|
|
25
34
|
map_attribute "alt", to: :alt
|
|
26
35
|
map_content to: :text
|
|
36
|
+
map_element "location", to: :location
|
|
27
37
|
end
|
|
28
38
|
end
|
|
29
39
|
end
|
|
@@ -94,6 +94,18 @@ module Metanorma
|
|
|
94
94
|
"metanorma/document/components/inline/display_text_element"
|
|
95
95
|
autoload :Bcp14Element,
|
|
96
96
|
"metanorma/document/components/inline/bcp14_element"
|
|
97
|
+
autoload :Vocabulary,
|
|
98
|
+
"metanorma/document/components/inline/vocabulary"
|
|
99
|
+
autoload :RenderedDisplay,
|
|
100
|
+
"metanorma/document/components/inline/rendered_display"
|
|
101
|
+
autoload :SemanticContent,
|
|
102
|
+
"metanorma/document/components/inline/semantic_content"
|
|
103
|
+
autoload :LocationElement,
|
|
104
|
+
"metanorma/document/components/inline/location_element"
|
|
105
|
+
autoload :SemanticMathElement,
|
|
106
|
+
"metanorma/document/components/inline/semantic_math_element"
|
|
107
|
+
autoload :RenderedMathElement,
|
|
108
|
+
"metanorma/document/components/inline/rendered_math_element"
|
|
97
109
|
end
|
|
98
110
|
end
|
|
99
111
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module MultiParagraph
|
|
7
|
+
class QuoteAuthorElement < Lutaml::Model::Serializable
|
|
8
|
+
attribute :id, :string
|
|
9
|
+
attribute :text, :string
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "author"
|
|
13
|
+
map_attribute "id", to: :id
|
|
14
|
+
map_content to: :text
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -4,46 +4,17 @@ module Metanorma
|
|
|
4
4
|
module Document
|
|
5
5
|
module Components
|
|
6
6
|
module MultiParagraph
|
|
7
|
-
# Author element inside a quote: <author id="...">text</author>
|
|
8
|
-
class QuoteAuthorElement < Lutaml::Model::Serializable
|
|
9
|
-
attribute :id, :string
|
|
10
|
-
attribute :text, :string
|
|
11
|
-
|
|
12
|
-
xml do
|
|
13
|
-
element "author"
|
|
14
|
-
map_attribute "id", to: :id
|
|
15
|
-
map_content to: :text
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Block quotation, containing extensive textual content originally authored outside of the current
|
|
20
|
-
# document.
|
|
21
7
|
class QuoteBlock < ParagraphsBlock
|
|
22
|
-
# Bibliographic citation for the quotation.
|
|
23
8
|
attribute :source, Metanorma::Document::Components::ReferenceElements::ReferenceToCitationElement
|
|
24
|
-
|
|
25
|
-
# Author of the quotation. The `author` attribute of the quotation is redundant with the citation,
|
|
26
|
-
# since it restates information about the author that should be recoverable from the citation itself.
|
|
27
|
-
# It is included for convenience, in case processing the citation to extract the author is prohibitive
|
|
28
|
-
# for rendering tools.
|
|
29
9
|
attribute :author, QuoteAuthorElement
|
|
30
|
-
|
|
31
|
-
# Paragraphs within the quote.
|
|
32
10
|
attribute :paragraphs,
|
|
33
11
|
Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
34
12
|
collection: true
|
|
35
|
-
|
|
36
|
-
# Unordered lists within the quote.
|
|
37
13
|
attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
|
|
38
14
|
collection: true
|
|
39
|
-
|
|
40
|
-
# Ordered lists within the quote.
|
|
41
15
|
attribute :ol, Metanorma::Document::Components::Lists::OrderedList,
|
|
42
16
|
collection: true
|
|
43
|
-
|
|
44
|
-
# Attribution for the quotation (presentation XML).
|
|
45
17
|
attribute :attribution, "Metanorma::Document::Components::Inline::AttributionElement"
|
|
46
|
-
|
|
47
18
|
attribute :json_type, :string
|
|
48
19
|
|
|
49
20
|
def json_type
|
|
@@ -8,6 +8,8 @@ module Metanorma
|
|
|
8
8
|
autoload :AdmonitionType, "#{__dir__}/multi_paragraph/admonition_type"
|
|
9
9
|
autoload :ParagraphsBlock, "#{__dir__}/multi_paragraph/paragraphs_block"
|
|
10
10
|
autoload :QuoteBlock, "#{__dir__}/multi_paragraph/quote_block"
|
|
11
|
+
autoload :QuoteAuthorElement,
|
|
12
|
+
"#{__dir__}/multi_paragraph/quote_author_element"
|
|
11
13
|
autoload :ReviewBlock, "#{__dir__}/multi_paragraph/review_block"
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -4,37 +4,6 @@ module Metanorma
|
|
|
4
4
|
module Document
|
|
5
5
|
module Components
|
|
6
6
|
module ReferenceElements
|
|
7
|
-
class SourceOrigin < Lutaml::Model::Serializable
|
|
8
|
-
attribute :bibitemid, :string
|
|
9
|
-
attribute :type, :string
|
|
10
|
-
attribute :citeas, :string
|
|
11
|
-
attribute :locality_stack, Metanorma::Document::Relaton::LocalityStack,
|
|
12
|
-
collection: true
|
|
13
|
-
attribute :display_text,
|
|
14
|
-
Metanorma::Document::Components::Inline::DisplayTextElement
|
|
15
|
-
|
|
16
|
-
xml do
|
|
17
|
-
element "origin"
|
|
18
|
-
map_attribute "bibitemid", to: :bibitemid
|
|
19
|
-
map_attribute "type", to: :type
|
|
20
|
-
map_attribute "citeas", to: :citeas
|
|
21
|
-
map_element "localityStack", to: :locality_stack
|
|
22
|
-
map_element "display-text", to: :display_text
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
class SourceModification < Lutaml::Model::Serializable
|
|
27
|
-
attribute :id, :string
|
|
28
|
-
attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
29
|
-
collection: true
|
|
30
|
-
|
|
31
|
-
xml do
|
|
32
|
-
element "modification"
|
|
33
|
-
map_attribute "id", to: :id
|
|
34
|
-
map_element "p", to: :p
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
7
|
class SourceElement < Lutaml::Model::Serializable
|
|
39
8
|
attribute :id, :string
|
|
40
9
|
attribute :status, :string
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module ReferenceElements
|
|
7
|
+
class SourceModification < Lutaml::Model::Serializable
|
|
8
|
+
attribute :id, :string
|
|
9
|
+
attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
10
|
+
collection: true
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
element "modification"
|
|
14
|
+
map_attribute "id", to: :id
|
|
15
|
+
map_element "p", to: :p
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module ReferenceElements
|
|
7
|
+
class SourceOrigin < Lutaml::Model::Serializable
|
|
8
|
+
attribute :bibitemid, :string
|
|
9
|
+
attribute :type, :string
|
|
10
|
+
attribute :citeas, :string
|
|
11
|
+
attribute :locality_stack, Metanorma::Document::Relaton::LocalityStack,
|
|
12
|
+
collection: true
|
|
13
|
+
attribute :display_text,
|
|
14
|
+
Metanorma::Document::Components::Inline::DisplayTextElement
|
|
15
|
+
|
|
16
|
+
xml do
|
|
17
|
+
element "origin"
|
|
18
|
+
map_attribute "bibitemid", to: :bibitemid
|
|
19
|
+
map_attribute "type", to: :type
|
|
20
|
+
map_attribute "citeas", to: :citeas
|
|
21
|
+
map_element "localityStack", to: :locality_stack
|
|
22
|
+
map_element "display-text", to: :display_text
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -24,9 +24,9 @@ module Metanorma
|
|
|
24
24
|
autoload :SourceElement,
|
|
25
25
|
"#{__dir__}/reference_elements/source_element"
|
|
26
26
|
autoload :SourceModification,
|
|
27
|
-
"#{__dir__}/reference_elements/
|
|
27
|
+
"#{__dir__}/reference_elements/source_modification"
|
|
28
28
|
autoload :SourceOrigin,
|
|
29
|
-
"#{__dir__}/reference_elements/
|
|
29
|
+
"#{__dir__}/reference_elements/source_origin"
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module Tables
|
|
7
|
+
class ColElement < Lutaml::Model::Serializable
|
|
8
|
+
attribute :width, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "col"
|
|
12
|
+
map_attribute "width", to: :width
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
module Components
|
|
6
|
+
module Tables
|
|
7
|
+
class ColGroupElement < Lutaml::Model::Serializable
|
|
8
|
+
attribute :col, ColElement, collection: true
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "colgroup"
|
|
12
|
+
map_element "col", to: :col
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -4,27 +4,6 @@ module Metanorma
|
|
|
4
4
|
module Document
|
|
5
5
|
module Components
|
|
6
6
|
module Tables
|
|
7
|
-
# Column element within colgroup.
|
|
8
|
-
class ColElement < Lutaml::Model::Serializable
|
|
9
|
-
attribute :width, :string
|
|
10
|
-
|
|
11
|
-
xml do
|
|
12
|
-
element "col"
|
|
13
|
-
map_attribute "width", to: :width
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Column group element for table column width specifications.
|
|
18
|
-
class ColGroupElement < Lutaml::Model::Serializable
|
|
19
|
-
attribute :col, ColElement, collection: true
|
|
20
|
-
|
|
21
|
-
xml do
|
|
22
|
-
element "colgroup"
|
|
23
|
-
map_element "col", to: :col
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Tabular arrangement of text
|
|
28
7
|
class TableBlock < Metanorma::Document::Components::Blocks::BasicBlock
|
|
29
8
|
attribute :id, :string
|
|
30
9
|
attribute :anchor, :string
|
|
@@ -52,7 +31,6 @@ module Metanorma
|
|
|
52
31
|
collection: true
|
|
53
32
|
attribute :colgroup, ColGroupElement
|
|
54
33
|
|
|
55
|
-
# Presentation-specific elements
|
|
56
34
|
attribute :fmt_name, Metanorma::Document::Components::Inline::FmtNameElement
|
|
57
35
|
attribute :fmt_xref_label,
|
|
58
36
|
Metanorma::Document::Components::Inline::FmtXrefLabelElement, collection: true
|
|
@@ -4,7 +4,6 @@ module Metanorma
|
|
|
4
4
|
module Document
|
|
5
5
|
module Components
|
|
6
6
|
module Tables
|
|
7
|
-
# Base class for table sections (thead, tbody, tfoot) wrapping rows.
|
|
8
7
|
class TableSection < Lutaml::Model::Serializable
|
|
9
8
|
attribute :tr, TextTableRow, collection: true
|
|
10
9
|
|
|
@@ -12,30 +11,6 @@ module Metanorma
|
|
|
12
11
|
map_element "tr", to: :tr
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
|
-
|
|
16
|
-
# Table header section wrapping <thead> rows.
|
|
17
|
-
class TableHeadSection < TableSection
|
|
18
|
-
xml do
|
|
19
|
-
element "thead"
|
|
20
|
-
map_element "tr", to: :tr
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Table body section wrapping <tbody> rows.
|
|
25
|
-
class TableBodySection < TableSection
|
|
26
|
-
xml do
|
|
27
|
-
element "tbody"
|
|
28
|
-
map_element "tr", to: :tr
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Table footer section wrapping <tfoot> rows.
|
|
33
|
-
class TableFootSection < TableSection
|
|
34
|
-
xml do
|
|
35
|
-
element "tfoot"
|
|
36
|
-
map_element "tr", to: :tr
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
14
|
end
|
|
40
15
|
end
|
|
41
16
|
end
|
|
@@ -4,13 +4,15 @@ module Metanorma
|
|
|
4
4
|
module Document
|
|
5
5
|
module Components
|
|
6
6
|
module Tables
|
|
7
|
+
autoload :ColElement, "#{__dir__}/tables/col_element"
|
|
8
|
+
autoload :ColGroupElement, "#{__dir__}/tables/col_group_element"
|
|
7
9
|
autoload :HeaderTableCell, "#{__dir__}/tables/header_table_cell"
|
|
8
10
|
autoload :ParagraphTableCell, "#{__dir__}/tables/paragraph_table_cell"
|
|
9
11
|
autoload :TableBlock, "#{__dir__}/tables/table_block"
|
|
10
12
|
autoload :TableCell, "#{__dir__}/tables/table_cell"
|
|
11
|
-
autoload :TableHeadSection, "#{__dir__}/tables/
|
|
12
|
-
autoload :TableBodySection, "#{__dir__}/tables/
|
|
13
|
-
autoload :TableFootSection, "#{__dir__}/tables/
|
|
13
|
+
autoload :TableHeadSection, "#{__dir__}/tables/table_head_section"
|
|
14
|
+
autoload :TableBodySection, "#{__dir__}/tables/table_body_section"
|
|
15
|
+
autoload :TableFootSection, "#{__dir__}/tables/table_foot_section"
|
|
14
16
|
autoload :TableSection, "#{__dir__}/tables/table_section"
|
|
15
17
|
autoload :TextAlignment, "#{__dir__}/tables/text_alignment"
|
|
16
18
|
autoload :TextTableCell, "#{__dir__}/tables/text_table_cell"
|
|
@@ -3,33 +3,6 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module Document
|
|
5
5
|
module Relaton
|
|
6
|
-
# Model for formattedAddress element which may contain mixed content with <br/> tags.
|
|
7
|
-
class FormattedAddress < Lutaml::Model::Serializable
|
|
8
|
-
attribute :content, :string, collection: true
|
|
9
|
-
attribute :br, Metanorma::Document::Components::Inline::BrElement,
|
|
10
|
-
collection: true
|
|
11
|
-
|
|
12
|
-
xml do
|
|
13
|
-
element "formattedAddress"
|
|
14
|
-
mixed_content
|
|
15
|
-
map_content to: :content
|
|
16
|
-
map_element "br", to: :br
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Construct a FormattedAddress from an array of text lines,
|
|
20
|
-
# inserting <br/> elements between them for proper mixed-content
|
|
21
|
-
# serialization.
|
|
22
|
-
def self.from_lines(lines)
|
|
23
|
-
new.tap do |fa|
|
|
24
|
-
fa.content = lines
|
|
25
|
-
fa.br = lines[1..].map do
|
|
26
|
-
Metanorma::Document::Components::Inline::BrElement.new
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# An address for a person or organization.
|
|
33
6
|
class Address < Lutaml::Model::Serializable
|
|
34
7
|
attribute :formatted_address_attr, :string
|
|
35
8
|
attribute :formatted_address, FormattedAddress
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "relaton/bib"
|
|
4
|
+
|
|
3
5
|
module Metanorma
|
|
4
6
|
module Document
|
|
5
7
|
module Relaton
|
|
6
|
-
|
|
7
|
-
class BibItemLocality < Lutaml::Model::Serializable
|
|
8
|
-
attribute :type, :string
|
|
9
|
-
attribute :reference_from, :string
|
|
10
|
-
attribute :reference_to, :string
|
|
11
|
-
|
|
12
|
-
xml do
|
|
13
|
-
element "locality"
|
|
14
|
-
map_attribute "type", to: :type
|
|
15
|
-
map_element "referenceFrom", to: :reference_from
|
|
16
|
-
map_element "referenceTo", to: :reference_to
|
|
17
|
-
end
|
|
8
|
+
class BibItemLocality < ::Relaton::Bib::Locality
|
|
18
9
|
end
|
|
19
10
|
end
|
|
20
11
|
end
|