metanorma-document 0.2.12 → 0.2.13
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/.github/workflows/rake.yml +21 -0
- data/.github/workflows/release.yml +25 -0
- data/.github/workflows/roundtrip-samples.yml +132 -0
- data/.gitignore +19 -0
- data/.rspec +3 -0
- data/.rubocop.yml +22 -0
- data/.rubocop_todo.yml +66 -164
- data/CHANGELOG.md +1 -0
- data/Gemfile +32 -0
- data/README.adoc +0 -144
- data/Rakefile +2 -14
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/data/javascripts/components/mn-lightbox.js +2 -18
- data/data/javascripts/components/mn-shortcuts.js +0 -2
- data/data/javascripts/core/mn-navigation.js +0 -8
- data/data/javascripts/core/mn-theme.js +9 -9
- data/data/logos/pdfa-logo.svg +94 -31
- data/data/stylesheets/base/_layout.css +0 -3
- data/data/stylesheets/base/_reset.css +3 -3
- data/data/stylesheets/base/_typography.css +5 -0
- data/data/stylesheets/components/bibliography.css +3 -3
- data/data/stylesheets/components/cover.css +1 -3
- data/data/stylesheets/components/figure.css +1 -13
- data/data/stylesheets/components/footnote.css +5 -65
- data/data/stylesheets/components/formula.css +0 -44
- data/data/stylesheets/components/header.css +2 -17
- data/data/stylesheets/components/inline.css +1 -1
- data/data/stylesheets/components/table.css +2 -15
- data/data/stylesheets/components/term.css +1 -0
- data/lib/metanorma/bipm_document/metadata/bipm_bibliographic_item.rb +14 -0
- data/lib/metanorma/bipm_document/metadata.rb +1 -1
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +65 -0
- data/lib/metanorma/document/components/ancillary_blocks.rb +0 -4
- data/lib/metanorma/document/components/bib_data/bib_data.rb +0 -7
- data/lib/metanorma/document/components/blocks/requirement_model.rb +131 -0
- data/lib/metanorma/document/components/blocks.rb +7 -8
- data/lib/metanorma/document/components/id_elements/image.rb +0 -2
- data/lib/metanorma/document/components/inline/asciimath_element.rb +0 -2
- data/lib/metanorma/document/components/inline/attribution_element.rb +0 -2
- data/lib/metanorma/document/components/inline/bcp14_element.rb +0 -2
- data/lib/metanorma/document/components/inline/biblio_tag_element.rb +0 -2
- data/lib/metanorma/document/components/inline/br_element.rb +0 -2
- data/lib/metanorma/document/components/inline/comma_element.rb +0 -2
- data/lib/metanorma/document/components/inline/concept_element.rb +0 -2
- data/lib/metanorma/document/components/inline/display_text_element.rb +0 -2
- data/lib/metanorma/document/components/inline/em_raw_element.rb +0 -2
- data/lib/metanorma/document/components/inline/enum_comma_element.rb +0 -2
- data/lib/metanorma/document/components/inline/eref_element.rb +0 -2
- data/lib/metanorma/document/components/inline/fmt_admitted_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_annotation_body_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_annotation_end_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_annotation_start_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_concept_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_definition_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_fn_body_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_fn_label_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_footnote_container_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_identifier_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_name_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_preferred_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_sourcecode_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_stem_element.rb +0 -10
- data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_title_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_xref_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fmt_xref_label_element.rb +0 -4
- data/lib/metanorma/document/components/inline/fn_element.rb +0 -2
- data/lib/metanorma/document/components/inline/link_element.rb +0 -2
- data/lib/metanorma/document/components/inline/localized_string_element.rb +0 -2
- data/lib/metanorma/document/components/inline/localized_strings_element.rb +0 -2
- data/lib/metanorma/document/components/inline/math_element.rb +0 -2
- data/lib/metanorma/document/components/inline/name_with_id_element.rb +0 -4
- data/lib/metanorma/document/components/inline/semx_child_element.rb +0 -2
- data/lib/metanorma/document/components/inline/semx_element.rb +1 -13
- data/lib/metanorma/document/components/inline/small_cap_element.rb +0 -2
- data/lib/metanorma/document/components/inline/span_element.rb +15 -10
- data/lib/metanorma/document/components/inline/stem_inline_element.rb +1 -7
- data/lib/metanorma/document/components/inline/strong_raw_element.rb +0 -2
- data/lib/metanorma/document/components/inline/sub_element.rb +0 -2
- data/lib/metanorma/document/components/inline/sup_element.rb +0 -2
- data/lib/metanorma/document/components/inline/tab_element.rb +0 -2
- data/lib/metanorma/document/components/inline/title_with_annotation_element.rb +0 -4
- data/lib/metanorma/document/components/inline/tt_element.rb +0 -2
- data/lib/metanorma/document/components/inline/variant_title_element.rb +0 -2
- data/lib/metanorma/document/components/inline/xref_element.rb +0 -10
- data/lib/metanorma/document/components/inline.rb +0 -12
- data/lib/metanorma/document/components/multi_paragraph/quote_block.rb +29 -0
- data/lib/metanorma/document/components/multi_paragraph.rb +0 -2
- data/lib/metanorma/document/components/reference_elements/source_element.rb +31 -0
- data/lib/metanorma/document/components/reference_elements.rb +2 -2
- data/lib/metanorma/document/components/tables/table_block.rb +22 -0
- data/lib/metanorma/document/components/tables/table_section.rb +25 -0
- data/lib/metanorma/document/components/tables.rb +3 -5
- data/lib/metanorma/document/relaton/address.rb +27 -0
- data/lib/metanorma/document/relaton/bib_item_locality.rb +12 -3
- data/lib/metanorma/document/relaton/copyright_association.rb +10 -0
- data/lib/metanorma/document/relaton/edition.rb +7 -4
- data/lib/metanorma/document/relaton/organization.rb +14 -0
- data/lib/metanorma/document/relaton/phone.rb +9 -3
- data/lib/metanorma/document/relaton/place_type.rb +13 -0
- data/lib/metanorma/document/relaton/price_type.rb +9 -3
- data/lib/metanorma/document/relaton.rb +1 -6
- data/lib/metanorma/document/version.rb +1 -1
- data/lib/metanorma/document.rb +0 -2
- data/lib/metanorma/html/asset_pipeline.rb +0 -1
- data/lib/metanorma/html/base_renderer.rb +1008 -261
- data/lib/metanorma/html/bipm_renderer.rb +144 -15
- data/lib/metanorma/html/cc_renderer.rb +45 -1
- data/lib/metanorma/html/component/base.rb +7 -2
- data/lib/metanorma/html/component/index_section.rb +43 -41
- data/lib/metanorma/html/drops/admonition_drop.rb +4 -1
- data/lib/metanorma/html/drops/block_element_drop.rb +2 -7
- data/lib/metanorma/html/drops/example_drop.rb +4 -1
- data/lib/metanorma/html/drops/figure_drop.rb +22 -31
- data/lib/metanorma/html/drops/footnote_drop.rb +1 -1
- data/lib/metanorma/html/drops/formula_drop.rb +16 -45
- data/lib/metanorma/html/drops/note_drop.rb +7 -9
- data/lib/metanorma/html/drops/sourcecode_drop.rb +5 -12
- data/lib/metanorma/html/drops.rb +0 -2
- data/lib/metanorma/html/generator.rb +2 -2
- data/lib/metanorma/html/icc_renderer.rb +39 -0
- data/lib/metanorma/html/iec_renderer.rb +44 -1
- data/lib/metanorma/html/ieee_renderer.rb +45 -1
- data/lib/metanorma/html/ietf_renderer.rb +48 -1
- data/lib/metanorma/html/iho_renderer.rb +46 -1
- data/lib/metanorma/html/iso_renderer.rb +343 -290
- data/lib/metanorma/html/itu_renderer.rb +45 -1
- data/lib/metanorma/html/ogc_renderer.rb +76 -15
- data/lib/metanorma/html/oiml_renderer.rb +38 -18
- data/lib/metanorma/html/pdfa_renderer.rb +39 -0
- data/lib/metanorma/html/ribose_renderer.rb +45 -1
- data/lib/metanorma/html/standard_renderer.rb +229 -341
- 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/_iso_cover.html.liquid +1 -1
- data/lib/metanorma/html/templates/document.html.liquid +0 -4
- data/lib/metanorma/html/theme.rb +107 -180
- data/lib/metanorma/html.rb +3 -14
- data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +25 -0
- data/lib/metanorma/ietf_document/metadata.rb +0 -2
- data/lib/metanorma/iso_document/metadata/iso_bib_data_extension_type.rb +48 -0
- data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +72 -0
- data/lib/metanorma/iso_document/metadata/iso_document_status.rb +30 -0
- data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +1 -4
- data/lib/metanorma/iso_document/metadata/structured_identifier.rb +17 -0
- data/lib/metanorma/iso_document/metadata/title_collection.rb +0 -1
- data/lib/metanorma/iso_document/metadata.rb +4 -9
- data/lib/metanorma/iso_document/terms/iso_term.rb +13 -0
- data/lib/metanorma/iso_document/terms.rb +0 -1
- data/lib/metanorma/itu_document/metadata/itu_bib_data_extension_type.rb +37 -0
- data/lib/metanorma/itu_document/metadata.rb +4 -3
- data/lib/metanorma/standard_document/block_attributes.rb +9 -5
- data/lib/metanorma/standard_document/blocks/block_source.rb +23 -0
- data/lib/metanorma/standard_document/blocks.rb +1 -1
- data/lib/metanorma/standard_document/terms/term_expression.rb +31 -0
- data/lib/metanorma/standard_document/terms.rb +0 -1
- data/metanorma-document.gemspec +35 -0
- metadata +13 -262
- data/CLAUDE.md +0 -26
- data/TODO.finalize/01-split-multi-class-files.md +0 -8
- data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +0 -6
- data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +0 -11
- data/TODO.finalize/04-theme-per-flavor-config-driven.md +0 -9
- data/TODO.finalize/05-migrate-all-html-to-liquid.md +0 -16
- data/TODO.finalize/06-integrate-pubid-library.md +0 -16
- data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +0 -39
- data/TODO.finalize/08-refactor-renderer-architecture.md +0 -25
- data/TODO.finalize/09-eliminate-code-smells.md +0 -14
- data/TODO.finalize/10-comprehensive-spec-coverage.md +0 -24
- data/TODO.finalize/11-config-driven-flavor-metadata.md +0 -20
- data/TODO.finalize/12-add-frozen-string-literal.md +0 -6
- data/TODO.finalize/13-extract-composition-from-god-class.md +0 -96
- data/TODO.finalize/14-config-driven-section-ordering.md +0 -31
- data/TODO.finalize/15-theme-directories-per-flavor.md +0 -46
- data/TODO.finalize/16-theme-lutaml-model-schema.md +0 -44
- data/data/javascripts/components/mn-footnotes.js +0 -68
- data/data/logos/oiml-logo-full-dark.svg +0 -1
- data/data/logos/oiml-logo-full-light.svg +0 -1
- data/data/logos/oiml-logo-icon-dark.svg +0 -1
- data/data/logos/oiml-logo-icon-light.svg +0 -1
- data/data/logos/oiml-logo.svg +0 -1
- data/data/themes/bipm.yaml +0 -60
- data/data/themes/cc.yaml +0 -43
- data/data/themes/icc.yaml +0 -39
- data/data/themes/iec.yaml +0 -44
- data/data/themes/ieee.yaml +0 -43
- data/data/themes/ietf.yaml +0 -45
- data/data/themes/iho.yaml +0 -46
- data/data/themes/iso.yaml +0 -40
- data/data/themes/itu.yaml +0 -45
- data/data/themes/ogc.yaml +0 -51
- data/data/themes/oiml.yaml +0 -56
- data/data/themes/pdfa.yaml +0 -44
- data/data/themes/ribose.yaml +0 -43
- data/exe/metanorma-document +0 -11
- data/frontend/e2e/sample-html.test.ts +0 -256
- data/frontend/index.html +0 -12
- data/frontend/package-lock.json +0 -4725
- data/frontend/package.json +0 -32
- data/frontend/postcss.config.js +0 -6
- data/frontend/src/App.vue +0 -79
- data/frontend/src/app.ts +0 -21
- data/frontend/src/components/AppSidebar.vue +0 -77
- data/frontend/src/components/DocumentReader.vue +0 -180
- data/frontend/src/components/MirrorRenderer.vue +0 -23
- data/frontend/src/components/ReadingProgressBar.vue +0 -29
- data/frontend/src/components/TextRenderer.vue +0 -131
- data/frontend/src/components/TocItem.vue +0 -57
- data/frontend/src/components/TopBar.vue +0 -49
- data/frontend/src/components/__tests__/MirrorRenderer.test.ts +0 -178
- data/frontend/src/components/blocks/AdmonitionBlock.vue +0 -74
- data/frontend/src/components/blocks/ClauseBlock.vue +0 -53
- data/frontend/src/components/blocks/ExampleBlock.vue +0 -21
- data/frontend/src/components/blocks/FallbackBlock.vue +0 -18
- data/frontend/src/components/blocks/FigureBlock.vue +0 -26
- data/frontend/src/components/blocks/FootnotesBlock.vue +0 -25
- data/frontend/src/components/blocks/ListBlocks.vue +0 -62
- data/frontend/src/components/blocks/NoteBlock.vue +0 -21
- data/frontend/src/components/blocks/ParagraphBlock.vue +0 -25
- data/frontend/src/components/blocks/QuoteBlock.vue +0 -25
- data/frontend/src/components/blocks/ReviewBlock.vue +0 -39
- data/frontend/src/components/blocks/SourcecodeBlock.vue +0 -52
- data/frontend/src/components/blocks/TableBlock.vue +0 -48
- data/frontend/src/components/blocks/index.ts +0 -36
- data/frontend/src/stores/__tests__/documentStore.fixture.test.ts +0 -272
- data/frontend/src/stores/__tests__/documentStore.test.ts +0 -143
- data/frontend/src/stores/__tests__/ebookStore.test.ts +0 -145
- data/frontend/src/stores/__tests__/uiStore.test.ts +0 -42
- data/frontend/src/stores/documentStore.ts +0 -153
- data/frontend/src/stores/ebookStore.ts +0 -179
- data/frontend/src/stores/uiStore.ts +0 -32
- data/frontend/src/styles.css +0 -156
- data/frontend/src/types/__tests__/rendering-contract.test.ts +0 -172
- data/frontend/src/types/rendering-contract.ts +0 -209
- data/frontend/src/utils/__tests__/typeMetadata.test.ts +0 -102
- data/frontend/src/utils/typeMetadata.ts +0 -121
- data/frontend/tailwind.config.js +0 -18
- data/frontend/test/fixtures/iso-document.json +0 -271
- data/frontend/tmp/debug_e2e.cjs +0 -46
- data/frontend/tsconfig.json +0 -25
- data/frontend/tsconfig.node.json +0 -11
- data/frontend/vite.config.ts +0 -37
- data/frontend/vitest.e2e.config.ts +0 -9
- data/lib/metanorma/bipm_document/metadata/depiction_element.rb +0 -18
- data/lib/metanorma/document/cli.rb +0 -116
- data/lib/metanorma/document/components/ancillary_blocks/callout_annotation.rb +0 -27
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +0 -18
- data/lib/metanorma/document/components/blocks/classification_value.rb +0 -21
- data/lib/metanorma/document/components/blocks/permission_model.rb +0 -28
- data/lib/metanorma/document/components/blocks/recommendation_model.rb +0 -28
- data/lib/metanorma/document/components/blocks/requirement_base.rb +0 -30
- data/lib/metanorma/document/components/blocks/requirement_classification.rb +0 -20
- data/lib/metanorma/document/components/blocks/requirement_description.rb +0 -43
- data/lib/metanorma/document/components/blocks/requirement_inherit.rb +0 -24
- data/lib/metanorma/document/components/inline/location_element.rb +0 -24
- data/lib/metanorma/document/components/inline/rendered_display.rb +0 -23
- data/lib/metanorma/document/components/inline/rendered_math_element.rb +0 -21
- data/lib/metanorma/document/components/inline/semantic_content.rb +0 -51
- data/lib/metanorma/document/components/inline/semantic_math_element.rb +0 -20
- data/lib/metanorma/document/components/inline/vocabulary.rb +0 -184
- data/lib/metanorma/document/components/multi_paragraph/quote_author_element.rb +0 -20
- data/lib/metanorma/document/components/reference_elements/source_modification.rb +0 -21
- data/lib/metanorma/document/components/reference_elements/source_origin.rb +0 -28
- data/lib/metanorma/document/components/tables/col_element.rb +0 -18
- data/lib/metanorma/document/components/tables/col_group_element.rb +0 -18
- data/lib/metanorma/document/components/tables/table_body_section.rb +0 -16
- data/lib/metanorma/document/components/tables/table_foot_section.rb +0 -16
- data/lib/metanorma/document/components/tables/table_head_section.rb +0 -16
- data/lib/metanorma/document/relaton/copyright_owner.rb +0 -16
- data/lib/metanorma/document/relaton/formatted_address.rb +0 -29
- data/lib/metanorma/document/relaton/logo_element.rb +0 -18
- data/lib/metanorma/document/relaton/region_element.rb +0 -18
- data/lib/metanorma/html/drops/biblio_entry_drop.rb +0 -50
- data/lib/metanorma/html/renderers/block_renderer.rb +0 -372
- data/lib/metanorma/html/renderers/inline_renderer.rb +0 -655
- data/lib/metanorma/html/renderers/pubid_renderer.rb +0 -69
- data/lib/metanorma/html/renderers/section_renderer.rb +0 -193
- data/lib/metanorma/html/renderers.rb +0 -8
- data/lib/metanorma/html/templates/_audio.html.liquid +0 -1
- data/lib/metanorma/html/templates/_biblio_entry.html.liquid +0 -1
- data/lib/metanorma/html/templates/_bipm_cover.html.liquid +0 -27
- data/lib/metanorma/html/templates/_boilerplate.html.liquid +0 -1
- data/lib/metanorma/html/templates/_bookmark.html.liquid +0 -1
- data/lib/metanorma/html/templates/_br.html.liquid +0 -1
- data/lib/metanorma/html/templates/_definition_list.html.liquid +0 -6
- data/lib/metanorma/html/templates/_element.html.liquid +0 -1
- data/lib/metanorma/html/templates/_fn_marker.html.liquid +0 -1
- data/lib/metanorma/html/templates/_heading.html.liquid +0 -1
- data/lib/metanorma/html/templates/_image.html.liquid +0 -1
- data/lib/metanorma/html/templates/_inline_span.html.liquid +0 -1
- data/lib/metanorma/html/templates/_link.html.liquid +0 -1
- data/lib/metanorma/html/templates/_list.html.liquid +0 -3
- data/lib/metanorma/html/templates/_list_item.html.liquid +0 -1
- data/lib/metanorma/html/templates/_main_content.html.liquid +0 -1
- data/lib/metanorma/html/templates/_math_container.html.liquid +0 -1
- data/lib/metanorma/html/templates/_paragraph.html.liquid +0 -1
- data/lib/metanorma/html/templates/_prefatory_section.html.liquid +0 -1
- data/lib/metanorma/html/templates/_pubid_identifier.html.liquid +0 -1
- data/lib/metanorma/html/templates/_quote.html.liquid +0 -4
- data/lib/metanorma/html/templates/_ref_date.html.liquid +0 -1
- data/lib/metanorma/html/templates/_ref_title.html.liquid +0 -1
- data/lib/metanorma/html/templates/_section.html.liquid +0 -5
- data/lib/metanorma/html/templates/_standard_cover.html.liquid +0 -31
- data/lib/metanorma/html/templates/_standard_doc_title.html.liquid +0 -3
- data/lib/metanorma/html/templates/_stem_span.html.liquid +0 -1
- data/lib/metanorma/html/templates/_table.html.liquid +0 -9
- data/lib/metanorma/html/templates/_term_domain.html.liquid +0 -1
- data/lib/metanorma/html/templates/_term_example.html.liquid +0 -1
- data/lib/metanorma/html/templates/_term_note.html.liquid +0 -1
- data/lib/metanorma/html/templates/_term_number.html.liquid +0 -1
- data/lib/metanorma/html/templates/_term_source.html.liquid +0 -1
- data/lib/metanorma/html/templates/_term_text_note.html.liquid +0 -1
- data/lib/metanorma/html/templates/_video.html.liquid +0 -1
- data/lib/metanorma/html/templates/_wrapped_preface.html.liquid +0 -1
- data/lib/metanorma/ietf_document/metadata/pi_settings.rb +0 -32
- data/lib/metanorma/iso_document/metadata/doctype_element.rb +0 -20
- data/lib/metanorma/iso_document/metadata/language_element.rb +0 -18
- data/lib/metanorma/iso_document/metadata/project_number.rb +0 -22
- data/lib/metanorma/iso_document/metadata/script_element.rb +0 -18
- data/lib/metanorma/iso_document/metadata/stage_element.rb +0 -26
- data/lib/metanorma/iso_document/metadata/stagename_element.rb +0 -18
- data/lib/metanorma/iso_document/terms/term_domain_element.rb +0 -18
- data/lib/metanorma/itu_document/metadata/meeting_date.rb +0 -18
- data/lib/metanorma/itu_document/metadata/meeting_element.rb +0 -18
- data/lib/metanorma/itu_document/metadata/study_period.rb +0 -18
- data/lib/metanorma/mirror/default_registry.rb +0 -170
- data/lib/metanorma/mirror/handler_registry.rb +0 -60
- data/lib/metanorma/mirror/handler_result.rb +0 -37
- data/lib/metanorma/mirror/handlers/admonition.rb +0 -18
- data/lib/metanorma/mirror/handlers/example.rb +0 -21
- data/lib/metanorma/mirror/handlers/figure.rb +0 -53
- data/lib/metanorma/mirror/handlers/formula.rb +0 -35
- data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +0 -159
- data/lib/metanorma/mirror/handlers/inline/text_extractor.rb +0 -116
- data/lib/metanorma/mirror/handlers/inline.rb +0 -225
- data/lib/metanorma/mirror/handlers/list.rb +0 -110
- data/lib/metanorma/mirror/handlers/note.rb +0 -26
- data/lib/metanorma/mirror/handlers/paragraph.rb +0 -19
- data/lib/metanorma/mirror/handlers/quote.rb +0 -16
- data/lib/metanorma/mirror/handlers/review.rb +0 -19
- data/lib/metanorma/mirror/handlers/section.rb +0 -149
- data/lib/metanorma/mirror/handlers/sourcecode.rb +0 -27
- data/lib/metanorma/mirror/handlers/structural.rb +0 -68
- data/lib/metanorma/mirror/handlers/table.rb +0 -81
- data/lib/metanorma/mirror/handlers/term.rb +0 -100
- data/lib/metanorma/mirror/handlers.rb +0 -60
- data/lib/metanorma/mirror/id_strategy/positional.rb +0 -166
- data/lib/metanorma/mirror/id_strategy/preserve.rb +0 -12
- data/lib/metanorma/mirror/id_strategy.rb +0 -34
- data/lib/metanorma/mirror/math_util.rb +0 -53
- data/lib/metanorma/mirror/metadata.rb +0 -37
- data/lib/metanorma/mirror/metanorma_to_mirror.rb +0 -101
- data/lib/metanorma/mirror/model/container.rb +0 -47
- data/lib/metanorma/mirror/model/factory.rb +0 -52
- data/lib/metanorma/mirror/model/guide.rb +0 -25
- data/lib/metanorma/mirror/model/leaf.rb +0 -17
- data/lib/metanorma/mirror/model/mark.rb +0 -53
- data/lib/metanorma/mirror/model/node.rb +0 -47
- data/lib/metanorma/mirror/model/soft_break.rb +0 -33
- data/lib/metanorma/mirror/model/text.rb +0 -34
- data/lib/metanorma/mirror/model.rb +0 -16
- data/lib/metanorma/mirror/output/builder.rb +0 -39
- data/lib/metanorma/mirror/output/formats/base_format.rb +0 -90
- data/lib/metanorma/mirror/output/formats/inline_format.rb +0 -81
- data/lib/metanorma/mirror/output/formats.rb +0 -53
- data/lib/metanorma/mirror/output/html_renderer.rb +0 -95
- data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +0 -178
- data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +0 -61
- data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +0 -96
- data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +0 -64
- data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +0 -129
- data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +0 -80
- data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +0 -87
- data/lib/metanorma/mirror/output/html_renderers.rb +0 -76
- data/lib/metanorma/mirror/output/pipeline.rb +0 -92
- data/lib/metanorma/mirror/output/pipeline_context.rb +0 -22
- data/lib/metanorma/mirror/output.rb +0 -14
- data/lib/metanorma/mirror/rewriter.rb +0 -121
- data/lib/metanorma/mirror/safe_attr.rb +0 -16
- data/lib/metanorma/mirror/serialization/json_serializer.rb +0 -25
- data/lib/metanorma/mirror/serialization/yaml_serializer.rb +0 -20
- data/lib/metanorma/mirror/serialization.rb +0 -10
- data/lib/metanorma/mirror/transformer.rb +0 -22
- data/lib/metanorma/mirror.rb +0 -32
- data/lib/metanorma/standard_document/annotation.rb +0 -37
- data/lib/metanorma/standard_document/blocks/source_origin_element.rb +0 -23
- data/lib/metanorma/standard_document/terms/term_name_element.rb +0 -29
- data/script/render_both.rb +0 -18
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "doc",
|
|
3
|
-
"attrs": { "id": "iso-17301-1" },
|
|
4
|
-
"meta": {
|
|
5
|
-
"title": "ISO 17301-1:2016 — Cereals and pulses",
|
|
6
|
-
"flavor": "iso",
|
|
7
|
-
"type": "international-standard",
|
|
8
|
-
"schema_version": "v2.1.5"
|
|
9
|
-
},
|
|
10
|
-
"toc": {
|
|
11
|
-
"sections": [
|
|
12
|
-
{ "id": "foreword", "title": "Foreword", "type": "foreword", "children": [] },
|
|
13
|
-
{ "id": "scope", "title": "Scope", "type": "clause", "children": [] },
|
|
14
|
-
{ "id": "normrefs", "title": "Normative references", "type": "references", "children": [] },
|
|
15
|
-
{ "id": "terms", "title": "Terms and definitions", "type": "terms", "children": [
|
|
16
|
-
{ "id": "term-rice", "title": "rice", "type": "clause", "children": [] }
|
|
17
|
-
]},
|
|
18
|
-
{ "id": "test-methods", "title": "Test methods", "type": "clause", "children": [] }
|
|
19
|
-
],
|
|
20
|
-
"numbering": { "scope": "1", "normrefs": "2", "terms": "3", "term-rice": "3.1", "test-methods": "4" }
|
|
21
|
-
},
|
|
22
|
-
"content": [
|
|
23
|
-
{
|
|
24
|
-
"type": "foreword",
|
|
25
|
-
"attrs": { "id": "foreword", "title": "Foreword" },
|
|
26
|
-
"content": [
|
|
27
|
-
{
|
|
28
|
-
"type": "paragraph",
|
|
29
|
-
"attrs": { "id": "foreword-p1" },
|
|
30
|
-
"content": [
|
|
31
|
-
{ "type": "text", "text": "ISO (the International Organization for Standardization) is a worldwide federation of national standards bodies (ISO member bodies)." }
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"type": "paragraph",
|
|
36
|
-
"attrs": { "id": "foreword-p2" },
|
|
37
|
-
"content": [
|
|
38
|
-
{ "type": "text", "text": "The procedures used to develop this document are described in the ISO/IEC Directives, Part 1." }
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"type": "clause",
|
|
45
|
-
"attrs": { "id": "scope", "title": "Scope", "number": "1" },
|
|
46
|
-
"content": [
|
|
47
|
-
{
|
|
48
|
-
"type": "paragraph",
|
|
49
|
-
"attrs": { "id": "scope-p1" },
|
|
50
|
-
"content": [
|
|
51
|
-
{ "type": "text", "text": "This document specifies " },
|
|
52
|
-
{ "type": "text", "text": "the test methods", "marks": [{ "type": "strong" }] },
|
|
53
|
-
{ "type": "text", "text": " for cereals and pulses." }
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"type": "paragraph",
|
|
58
|
-
"attrs": { "id": "scope-p2" },
|
|
59
|
-
"content": [
|
|
60
|
-
{ "type": "text", "text": "It is applicable to " },
|
|
61
|
-
{ "type": "text", "text": "Oryza sativa L.", "marks": [{ "type": "emphasis" }] },
|
|
62
|
-
{ "type": "text", "text": " and " },
|
|
63
|
-
{ "type": "text", "text": "Oryza glaberrima", "marks": [{ "type": "emphasis" }] },
|
|
64
|
-
{ "type": "text", "text": "." }
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"type": "bullet_list",
|
|
69
|
-
"attrs": { "id": "scope-list1" },
|
|
70
|
-
"content": [
|
|
71
|
-
{ "type": "list_item", "content": [{ "type": "text", "text": "Milling quality assessment" }] },
|
|
72
|
-
{ "type": "list_item", "content": [{ "type": "text", "text": "Moisture content determination" }] },
|
|
73
|
-
{ "type": "list_item", "content": [
|
|
74
|
-
{ "type": "text", "text": "See " },
|
|
75
|
-
{ "type": "text", "text": "ISO 712", "marks": [{ "type": "xref", "attrs": { "target": "iso712" } }] }
|
|
76
|
-
] }
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"type": "references",
|
|
83
|
-
"attrs": { "id": "normrefs", "title": "Normative references", "number": "2" },
|
|
84
|
-
"content": [
|
|
85
|
-
{
|
|
86
|
-
"type": "paragraph",
|
|
87
|
-
"attrs": { "id": "normrefs-p1" },
|
|
88
|
-
"content": [
|
|
89
|
-
{ "type": "text", "text": "The following documents are referred to in the text." }
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"type": "bullet_list",
|
|
94
|
-
"attrs": { "id": "normrefs-list1" },
|
|
95
|
-
"content": [
|
|
96
|
-
{ "type": "list_item", "content": [
|
|
97
|
-
{ "type": "text", "text": "ISO 712, " },
|
|
98
|
-
{ "type": "text", "text": "Cereals and cereal products", "marks": [{ "type": "emphasis" }] },
|
|
99
|
-
{ "type": "text", "text": " — Determination of moisture content" }
|
|
100
|
-
] },
|
|
101
|
-
{ "type": "list_item", "content": [
|
|
102
|
-
{ "type": "text", "text": "ISO 520, " },
|
|
103
|
-
{ "type": "text", "text": "Cereals", "marks": [{ "type": "emphasis" }] },
|
|
104
|
-
{ "type": "text", "text": " — Determination of the mass of 1 000 grains" }
|
|
105
|
-
] }
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"type": "terms",
|
|
112
|
-
"attrs": { "id": "terms", "title": "Terms and definitions", "number": "3" },
|
|
113
|
-
"content": [
|
|
114
|
-
{
|
|
115
|
-
"type": "paragraph",
|
|
116
|
-
"attrs": { "id": "terms-p1" },
|
|
117
|
-
"content": [
|
|
118
|
-
{ "type": "text", "text": "For the purposes of this document, the following terms and definitions apply." }
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"type": "clause",
|
|
123
|
-
"attrs": { "id": "term-rice", "title": "rice", "number": "3.1" },
|
|
124
|
-
"content": [
|
|
125
|
-
{
|
|
126
|
-
"type": "paragraph",
|
|
127
|
-
"attrs": { "id": "term-rice-p1" },
|
|
128
|
-
"content": [
|
|
129
|
-
{ "type": "text", "text": "grains of " },
|
|
130
|
-
{ "type": "text", "text": "Oryza sativa L.", "marks": [{ "type": "emphasis" }] }
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"type": "example",
|
|
135
|
-
"attrs": { "id": "term-rice-ex1", "type": "example" },
|
|
136
|
-
"content": [
|
|
137
|
-
{
|
|
138
|
-
"type": "paragraph",
|
|
139
|
-
"content": [
|
|
140
|
-
{ "type": "text", "text": "Long-grain rice, medium-grain rice, and short-grain rice are the main categories." }
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"type": "note",
|
|
147
|
-
"attrs": { "id": "term-rice-n1", "type": "note" },
|
|
148
|
-
"content": [
|
|
149
|
-
{
|
|
150
|
-
"type": "paragraph",
|
|
151
|
-
"content": [
|
|
152
|
-
{ "type": "text", "text": "The term \"rice\" also applies to paddy rice (unhulled) and brown rice (hulled but unpolished)." }
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"type": "clause",
|
|
163
|
-
"attrs": { "id": "test-methods", "title": "Test methods", "number": "4" },
|
|
164
|
-
"content": [
|
|
165
|
-
{
|
|
166
|
-
"type": "paragraph",
|
|
167
|
-
"attrs": { "id": "test-methods-p1" },
|
|
168
|
-
"content": [
|
|
169
|
-
{ "type": "text", "text": "The following test methods shall be used for determining the quality parameters." }
|
|
170
|
-
]
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"type": "table",
|
|
174
|
-
"attrs": { "id": "table-1", "title": "Table 1 — Test parameters" },
|
|
175
|
-
"content": [
|
|
176
|
-
{
|
|
177
|
-
"type": "table_head",
|
|
178
|
-
"content": [
|
|
179
|
-
{
|
|
180
|
-
"type": "table_row",
|
|
181
|
-
"content": [
|
|
182
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "Parameter" }] },
|
|
183
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "Method" }] },
|
|
184
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "Unit" }] }
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"type": "table_body",
|
|
191
|
-
"content": [
|
|
192
|
-
{
|
|
193
|
-
"type": "table_row",
|
|
194
|
-
"content": [
|
|
195
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "Moisture content" }] },
|
|
196
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "ISO 712" }] },
|
|
197
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "%" }] }
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
"type": "table_row",
|
|
202
|
-
"content": [
|
|
203
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "Grain mass" }] },
|
|
204
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "ISO 520" }] },
|
|
205
|
-
{ "type": "table_cell", "content": [{ "type": "text", "text": "g" }] }
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
]
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
"type": "admonition",
|
|
214
|
-
"attrs": { "type": "warning" },
|
|
215
|
-
"content": [
|
|
216
|
-
{
|
|
217
|
-
"type": "paragraph",
|
|
218
|
-
"content": [
|
|
219
|
-
{ "type": "text", "text": "All measurements shall be performed at (20 ± 2) °C ambient temperature." }
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"type": "sourcecode",
|
|
226
|
-
"attrs": { "language": "python", "text": "def moisture_content(wet, dry):\n return (wet - dry) / wet * 100" }
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"type": "figure",
|
|
230
|
-
"attrs": { "id": "fig-1", "title": "Figure 1 — Grain structure" },
|
|
231
|
-
"content": [
|
|
232
|
-
{ "type": "image", "attrs": { "src": "grain.png", "alt": "Grain structure diagram" } }
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"type": "formula",
|
|
237
|
-
"attrs": { "id": "formula-1", "text": "m = (w - d) / w * 100" }
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"type": "ordered_list",
|
|
241
|
-
"attrs": { "id": "test-steps" },
|
|
242
|
-
"content": [
|
|
243
|
-
{ "type": "list_item", "content": [{ "type": "text", "text": "Weigh the sample" }] },
|
|
244
|
-
{ "type": "list_item", "content": [{ "type": "text", "text": "Dry at 130 °C" }] },
|
|
245
|
-
{ "type": "list_item", "content": [{ "type": "text", "text": "Re-weigh and calculate" }] }
|
|
246
|
-
]
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
"type": "quote",
|
|
250
|
-
"attrs": { "id": "quote-1" },
|
|
251
|
-
"content": [
|
|
252
|
-
{
|
|
253
|
-
"type": "paragraph",
|
|
254
|
-
"content": [
|
|
255
|
-
{ "type": "text", "text": "Precision is the soul of science." }
|
|
256
|
-
]
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"type": "footnotes",
|
|
264
|
-
"content": [
|
|
265
|
-
{ "type": "list_item", "attrs": { "id": "fn1", "ref_id": "fnref1" }, "content": [
|
|
266
|
-
{ "type": "paragraph", "content": [{ "type": "text", "text": "Published by ISO." }] }
|
|
267
|
-
] }
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
]
|
|
271
|
-
}
|
data/frontend/tmp/debug_e2e.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const puppeteer = require('puppeteer');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
async function main() {
|
|
5
|
-
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
|
|
6
|
-
const page = await browser.newPage();
|
|
7
|
-
|
|
8
|
-
const errors = [];
|
|
9
|
-
page.on('console', msg => { if (msg.type() === 'error') errors.push(msg.text()); });
|
|
10
|
-
page.on('pageerror', err => errors.push('PAGE: ' + err.message));
|
|
11
|
-
|
|
12
|
-
const samplePath = path.resolve('dist/sample.html');
|
|
13
|
-
await page.goto('file://' + samplePath, { waitUntil: 'networkidle0', timeout: 15000 });
|
|
14
|
-
await page.waitForSelector('#metanorma-app', { timeout: 5000 });
|
|
15
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
16
|
-
|
|
17
|
-
console.log('=== Console Errors ===');
|
|
18
|
-
errors.forEach(e => console.log(e));
|
|
19
|
-
|
|
20
|
-
console.log('\n=== Admonition classes ===');
|
|
21
|
-
const admonitions = await page.$$eval('[class*="admonition"]', function(els) {
|
|
22
|
-
return els.map(function(el) { return { tag: el.tagName, cls: el.className.substring(0, 100) }; });
|
|
23
|
-
});
|
|
24
|
-
admonitions.forEach(function(a) { console.log(JSON.stringify(a)); });
|
|
25
|
-
|
|
26
|
-
console.log('\n=== Body computed styles ===');
|
|
27
|
-
const bodyStyles = await page.evaluate(function() {
|
|
28
|
-
var s = getComputedStyle(document.body);
|
|
29
|
-
return { color: s.color, bg: s.backgroundColor };
|
|
30
|
-
});
|
|
31
|
-
console.log(JSON.stringify(bodyStyles));
|
|
32
|
-
|
|
33
|
-
console.log('\n=== Root CSS vars ===');
|
|
34
|
-
const rootVars = await page.evaluate(function() {
|
|
35
|
-
var s = getComputedStyle(document.documentElement);
|
|
36
|
-
return { ebookBg: s.getPropertyValue('--ebook-bg').trim(), ebookText: s.getPropertyValue('--ebook-text').trim() };
|
|
37
|
-
});
|
|
38
|
-
console.log(JSON.stringify(rootVars));
|
|
39
|
-
|
|
40
|
-
console.log('\n=== html class ===');
|
|
41
|
-
const htmlClass = await page.evaluate(function() { return document.documentElement.className; });
|
|
42
|
-
console.log(htmlClass);
|
|
43
|
-
|
|
44
|
-
await browser.close();
|
|
45
|
-
}
|
|
46
|
-
main().catch(console.error);
|
data/frontend/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"allowImportingTsExtensions": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"jsx": "preserve",
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noUnusedLocals": true,
|
|
16
|
-
"noUnusedParameters": true,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"paths": {
|
|
19
|
-
"@/*": ["./src/*"],
|
|
20
|
-
"@test/*": ["./test/*"]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "test/**/*.ts"],
|
|
24
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
-
}
|
data/frontend/tsconfig.node.json
DELETED
data/frontend/vite.config.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from 'vite'
|
|
3
|
-
import vue from '@vitejs/plugin-vue'
|
|
4
|
-
import { resolve } from 'path'
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [vue()],
|
|
8
|
-
test: {
|
|
9
|
-
environment: 'happy-dom',
|
|
10
|
-
globals: true,
|
|
11
|
-
exclude: ['e2e/**', 'node_modules/**'],
|
|
12
|
-
},
|
|
13
|
-
build: {
|
|
14
|
-
lib: {
|
|
15
|
-
entry: resolve(__dirname, 'src/app.ts'),
|
|
16
|
-
name: 'MetanormaSpa',
|
|
17
|
-
fileName: 'app',
|
|
18
|
-
formats: ['iife']
|
|
19
|
-
},
|
|
20
|
-
rollupOptions: {
|
|
21
|
-
output: {
|
|
22
|
-
inlineDynamicImports: true,
|
|
23
|
-
assetFileNames: 'app.[ext]'
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
minify: 'esbuild'
|
|
27
|
-
},
|
|
28
|
-
define: {
|
|
29
|
-
'process.env.NODE_ENV': JSON.stringify('production')
|
|
30
|
-
},
|
|
31
|
-
resolve: {
|
|
32
|
-
alias: {
|
|
33
|
-
'@': resolve(__dirname, 'src'),
|
|
34
|
-
'@test': resolve(__dirname, 'test'),
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module BipmDocument
|
|
5
|
-
module Metadata
|
|
6
|
-
class DepictionElement < Lutaml::Model::Serializable
|
|
7
|
-
attribute :type, :string
|
|
8
|
-
attribute :content, :string
|
|
9
|
-
|
|
10
|
-
xml do
|
|
11
|
-
element "depiction"
|
|
12
|
-
map_attribute "type", to: :type
|
|
13
|
-
map_all_content to: :content
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "optparse"
|
|
4
|
-
require "fileutils"
|
|
5
|
-
|
|
6
|
-
module Metanorma
|
|
7
|
-
module Document
|
|
8
|
-
class CLI
|
|
9
|
-
class Error < StandardError; end
|
|
10
|
-
|
|
11
|
-
ToMirrorOptions = Struct.new(
|
|
12
|
-
:xml_path,
|
|
13
|
-
:output,
|
|
14
|
-
:flavor,
|
|
15
|
-
:id_strategy,
|
|
16
|
-
:title,
|
|
17
|
-
keyword_init: true,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
def self.run(argv)
|
|
21
|
-
command = argv.shift
|
|
22
|
-
case command
|
|
23
|
-
when "to-mirror"
|
|
24
|
-
to_mirror(argv)
|
|
25
|
-
when nil, "-h", "--help"
|
|
26
|
-
puts usage
|
|
27
|
-
else
|
|
28
|
-
raise Error, "Unknown command: #{command}"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def self.to_mirror(argv)
|
|
33
|
-
options = parse_to_mirror_options(argv)
|
|
34
|
-
execute_to_mirror(options)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def self.parse_to_mirror_options(argv)
|
|
38
|
-
options = ToMirrorOptions.new(output: nil, flavor: nil,
|
|
39
|
-
id_strategy: nil, title: nil)
|
|
40
|
-
|
|
41
|
-
parser = OptionParser.new do |opts|
|
|
42
|
-
opts.banner = "Usage: metanorma-document to-mirror <xml_path> [options]"
|
|
43
|
-
|
|
44
|
-
opts.on("-o", "--output PATH",
|
|
45
|
-
"Output JSON path (default: stdout)") do |path|
|
|
46
|
-
options.output = path
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
opts.on("-f", "--flavor FLAVOR",
|
|
50
|
-
"Document flavor (default: auto-detect)") do |flavor|
|
|
51
|
-
options.flavor = flavor
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
opts.on("--id-strategy STRATEGY",
|
|
55
|
-
"ID strategy: preserve (default), positional") do |strategy|
|
|
56
|
-
case strategy
|
|
57
|
-
when "positional"
|
|
58
|
-
options.id_strategy = Mirror::IdStrategy::Positional.new
|
|
59
|
-
when "preserve"
|
|
60
|
-
options.id_strategy = Mirror::IdStrategy::Preserve.new
|
|
61
|
-
else
|
|
62
|
-
raise Error,
|
|
63
|
-
"Unknown ID strategy: #{strategy}. Use 'preserve' or 'positional'."
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
opts.on("--title TITLE", "Document title override") do |title|
|
|
68
|
-
options.title = title
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
parser.parse!(argv)
|
|
73
|
-
|
|
74
|
-
xml_path = argv.shift
|
|
75
|
-
raise Error, "XML path required" unless xml_path
|
|
76
|
-
raise Error, "File not found: #{xml_path}" unless File.exist?(xml_path)
|
|
77
|
-
|
|
78
|
-
options.xml_path = xml_path
|
|
79
|
-
options
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def self.execute_to_mirror(options)
|
|
83
|
-
pipeline = Mirror::Output::Pipeline.new(
|
|
84
|
-
xml_path: options.xml_path,
|
|
85
|
-
flavor: options.flavor,
|
|
86
|
-
title: options.title,
|
|
87
|
-
id_strategy: options.id_strategy,
|
|
88
|
-
)
|
|
89
|
-
guide = pipeline.process
|
|
90
|
-
|
|
91
|
-
json = Mirror::Serialization::JsonSerializer.serialize_pretty(guide.content)
|
|
92
|
-
write_output(json, options.output)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def self.write_output(json, output_path)
|
|
96
|
-
if output_path
|
|
97
|
-
FileUtils.mkdir_p(File.dirname(output_path))
|
|
98
|
-
File.write(output_path, json)
|
|
99
|
-
else
|
|
100
|
-
$stdout.puts(json)
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def self.usage
|
|
105
|
-
<<~USAGE
|
|
106
|
-
Usage: metanorma-document <command> [options]
|
|
107
|
-
|
|
108
|
-
Commands:
|
|
109
|
-
to-mirror Convert presentation XML to mirror JSON
|
|
110
|
-
|
|
111
|
-
Run `metanorma-document <command> --help` for command-specific options.
|
|
112
|
-
USAGE
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module Document
|
|
5
|
-
module Components
|
|
6
|
-
module AncillaryBlocks
|
|
7
|
-
class CalloutAnnotation < Lutaml::Model::Serializable
|
|
8
|
-
attribute :id, :string
|
|
9
|
-
attribute :anchor, :string
|
|
10
|
-
attribute :semx_id, :string
|
|
11
|
-
attribute :original_id, :string
|
|
12
|
-
attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
13
|
-
collection: true
|
|
14
|
-
|
|
15
|
-
xml do
|
|
16
|
-
element "callout-annotation"
|
|
17
|
-
map_attribute "id", to: :id
|
|
18
|
-
map_attribute "anchor", to: :anchor
|
|
19
|
-
map_attribute "semx-id", to: :semx_id
|
|
20
|
-
map_attribute "original-id", to: :original_id
|
|
21
|
-
map_element "p", to: :p
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module Document
|
|
5
|
-
module Components
|
|
6
|
-
module AncillaryBlocks
|
|
7
|
-
class SourcecodeBody < Lutaml::Model::Serializable
|
|
8
|
-
attribute :content, :string
|
|
9
|
-
|
|
10
|
-
xml do
|
|
11
|
-
element "body"
|
|
12
|
-
map_all_content to: :content
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module Document
|
|
5
|
-
module Components
|
|
6
|
-
module Blocks
|
|
7
|
-
class ClassificationValue < Lutaml::Model::Serializable
|
|
8
|
-
attribute :text, :string, collection: true
|
|
9
|
-
attribute :link, Metanorma::Document::Components::Inline::LinkElement,
|
|
10
|
-
collection: true
|
|
11
|
-
|
|
12
|
-
xml do
|
|
13
|
-
mixed_content
|
|
14
|
-
map_content to: :text
|
|
15
|
-
map_element "link", to: :link
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module Document
|
|
5
|
-
module Components
|
|
6
|
-
module Blocks
|
|
7
|
-
class PermissionModel < RequirementBase
|
|
8
|
-
xml do
|
|
9
|
-
element "permission"
|
|
10
|
-
map_attribute "id", to: :id
|
|
11
|
-
map_attribute "model", to: :model
|
|
12
|
-
map_attribute "obligation", to: :obligation
|
|
13
|
-
map_attribute "type", to: :type
|
|
14
|
-
map_attribute "anchor", to: :anchor
|
|
15
|
-
map_element "subject", to: :subject
|
|
16
|
-
map_element "classification", to: :classification
|
|
17
|
-
map_element "description", to: :description
|
|
18
|
-
map_element "inherit", to: :inherit
|
|
19
|
-
map_element "requirement", to: :requirement
|
|
20
|
-
map_element "recommendation", to: :recommendation
|
|
21
|
-
map_element "permission", to: :permission
|
|
22
|
-
map_element "example", to: :example
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Metanorma
|
|
4
|
-
module Document
|
|
5
|
-
module Components
|
|
6
|
-
module Blocks
|
|
7
|
-
class RecommendationModel < RequirementBase
|
|
8
|
-
xml do
|
|
9
|
-
element "recommendation"
|
|
10
|
-
map_attribute "id", to: :id
|
|
11
|
-
map_attribute "model", to: :model
|
|
12
|
-
map_attribute "obligation", to: :obligation
|
|
13
|
-
map_attribute "type", to: :type
|
|
14
|
-
map_attribute "anchor", to: :anchor
|
|
15
|
-
map_element "subject", to: :subject
|
|
16
|
-
map_element "classification", to: :classification
|
|
17
|
-
map_element "description", to: :description
|
|
18
|
-
map_element "inherit", to: :inherit
|
|
19
|
-
map_element "requirement", to: :requirement
|
|
20
|
-
map_element "recommendation", to: :recommendation
|
|
21
|
-
map_element "permission", to: :permission
|
|
22
|
-
map_element "example", to: :example
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|