metanorma-document 0.5.1 → 0.5.2.pre.alpha.1
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/README.adoc +81 -0
- data/Rakefile +3 -7
- data/data/themes/ogc.yaml +5 -0
- data/lib/metanorma/basic_document/ancillary_blocks/figure_block.rb +2 -2
- data/lib/metanorma/basic_document/multi_paragraph/admonition_block.rb +2 -2
- data/lib/metanorma/document/cli.rb +134 -0
- data/lib/metanorma/document/components/ancillary_blocks/figure_block.rb +5 -0
- data/lib/metanorma/document/components/ancillary_blocks/fmt_figure_element.rb +47 -0
- data/lib/metanorma/document/components/ancillary_blocks/formula_block.rb +2 -0
- data/lib/metanorma/document/components/ancillary_blocks/imagemap_element.rb +73 -0
- data/lib/metanorma/document/components/ancillary_blocks/literal_block.rb +2 -0
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +2 -0
- data/lib/metanorma/document/components/ancillary_blocks/svg_target_element.rb +27 -0
- data/lib/metanorma/document/components/ancillary_blocks/svgmap_element.rb +28 -0
- data/lib/metanorma/document/components/ancillary_blocks.rb +4 -0
- data/lib/metanorma/document/components/bib_data/bibliographic_item.rb +4 -0
- data/lib/metanorma/document/components/blocks/fmt_provision.rb +25 -0
- data/lib/metanorma/document/components/blocks/note_block.rb +8 -0
- data/lib/metanorma/document/components/blocks/permission_model.rb +9 -0
- data/lib/metanorma/document/components/blocks/recommendation_model.rb +9 -0
- data/lib/metanorma/document/components/blocks/requirement_base.rb +12 -0
- data/lib/metanorma/document/components/blocks/requirement_import.rb +23 -0
- data/lib/metanorma/document/components/blocks/requirement_measurement_target.rb +23 -0
- data/lib/metanorma/document/components/blocks/requirement_model.rb +9 -0
- data/lib/metanorma/document/components/blocks/requirement_specification.rb +23 -0
- data/lib/metanorma/document/components/blocks/requirement_verification.rb +23 -0
- data/lib/metanorma/document/components/blocks.rb +8 -0
- data/lib/metanorma/document/components/data_types/formatted_string.rb +9 -0
- data/lib/metanorma/document/components/id_elements/image.rb +4 -0
- data/lib/metanorma/document/components/inline/columnbreak_element.rb +17 -0
- data/lib/metanorma/document/components/inline/concept_element.rb +18 -0
- data/lib/metanorma/document/components/inline/date_element.rb +29 -0
- data/lib/metanorma/document/components/inline/display_text_element.rb +2 -0
- data/lib/metanorma/document/components/inline/em_raw_element.rb +6 -7
- data/lib/metanorma/document/components/inline/eref_element.rb +48 -22
- data/lib/metanorma/document/components/inline/eref_stack.rb +23 -0
- data/lib/metanorma/document/components/inline/error_message.rb +28 -0
- data/lib/metanorma/document/components/inline/fmt_date_element.rb +28 -0
- data/lib/metanorma/document/components/inline/fmt_date_inline_element.rb +26 -0
- data/lib/metanorma/document/components/inline/fmt_eref_element.rb +25 -0
- data/lib/metanorma/document/components/inline/fmt_origin_element.rb +24 -0
- data/lib/metanorma/document/components/inline/fmt_preferred_element.rb +3 -0
- data/lib/metanorma/document/components/inline/fmt_source_element.rb +31 -0
- data/lib/metanorma/document/components/inline/fn_element.rb +11 -0
- data/lib/metanorma/document/components/inline/link_element.rb +8 -0
- data/lib/metanorma/document/components/inline/name_with_id_element.rb +2 -0
- data/lib/metanorma/document/components/inline/refterm_element.rb +21 -0
- data/lib/metanorma/document/components/inline/semx_element.rb +22 -0
- data/lib/metanorma/document/components/inline/sourcelocality_stack_element.rb +27 -0
- data/lib/metanorma/document/components/inline/span_element.rb +2 -0
- data/lib/metanorma/document/components/inline/stem_inline_element.rb +2 -0
- data/lib/metanorma/document/components/inline/strong_raw_element.rb +6 -9
- data/lib/metanorma/document/components/inline/sub_element.rb +2 -0
- data/lib/metanorma/document/components/inline/termref_element.rb +24 -0
- data/lib/metanorma/document/components/inline/title_with_annotation_element.rb +10 -31
- data/lib/metanorma/document/components/inline/variant_title_element.rb +2 -0
- data/lib/metanorma/document/components/inline/vocabulary.rb +36 -0
- data/lib/metanorma/document/components/inline.rb +23 -0
- data/lib/metanorma/document/components/lists/dd_element.rb +6 -1
- data/lib/metanorma/document/components/lists/definition.rb +2 -0
- data/lib/metanorma/document/components/lists/definition_list.rb +3 -0
- data/lib/metanorma/document/components/lists/dt_element.rb +3 -0
- data/lib/metanorma/document/components/lists/fmt_list_element.rb +73 -0
- data/lib/metanorma/document/components/lists/list_item.rb +3 -0
- data/lib/metanorma/document/components/lists/ordered_list.rb +4 -2
- data/lib/metanorma/document/components/lists/unordered_list.rb +2 -0
- data/lib/metanorma/document/components/lists.rb +2 -0
- data/lib/metanorma/document/components/multi_paragraph/quote_block.rb +16 -0
- data/lib/metanorma/document/components/multi_paragraph/review_block.rb +2 -2
- data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +15 -0
- data/lib/metanorma/document/components/reference_elements/citation.rb +7 -0
- data/lib/metanorma/document/components/reference_elements/source_element.rb +4 -0
- data/lib/metanorma/document/components/semantic/node.rb +46 -0
- data/lib/metanorma/document/components/semantic.rb +11 -0
- data/lib/metanorma/document/components/tables/header_table_cell.rb +1 -0
- data/lib/metanorma/document/components/tables/table_cell.rb +70 -44
- data/lib/metanorma/document/components/tables/text_table_cell.rb +1 -0
- data/lib/metanorma/document/components/tables/text_table_row.rb +2 -0
- data/lib/metanorma/document/components/text_elements/ruby_annotation_element.rb +26 -0
- data/lib/metanorma/document/components/text_elements/ruby_element.rb +41 -6
- data/lib/metanorma/document/components/text_elements/ruby_pronunciation_element.rb +25 -0
- data/lib/metanorma/document/components/text_elements/strike_element.rb +3 -0
- data/lib/metanorma/document/components/text_elements/underline_element.rb +3 -0
- data/lib/metanorma/document/components/text_elements.rb +2 -0
- data/lib/metanorma/document/components.rb +1 -0
- data/lib/metanorma/document/grammar_vocabulary.rb +109 -0
- data/lib/metanorma/document/mirror_seed.rb +253 -0
- data/lib/metanorma/document/mko/collection.rb +168 -0
- data/lib/metanorma/document/mko/exporter.rb +17 -0
- data/lib/metanorma/document/mko/project.rb +1110 -0
- data/lib/metanorma/document/mko.rb +122 -0
- data/lib/metanorma/document/model_access.rb +44 -0
- data/lib/metanorma/document/native_models.rb +319 -0
- data/lib/metanorma/document/plain_text.rb +39 -0
- data/lib/metanorma/document/relaton/version_info.rb +4 -0
- data/lib/metanorma/document/version.rb +1 -1
- data/lib/metanorma/document.rb +19 -26
- data/lib/metanorma/{collection → document_collection}/directive.rb +1 -1
- data/lib/metanorma/{collection → document_collection}/doc_container.rb +6 -2
- data/lib/metanorma/{collection → document_collection}/entry.rb +2 -2
- data/lib/metanorma/{collection → document_collection}/root.rb +2 -2
- data/lib/metanorma/document_collection.rb +10 -0
- data/lib/metanorma/html/base_renderer.rb +94 -25
- data/lib/metanorma/html/component/footnote_collector.rb +21 -20
- data/lib/metanorma/html/concerns/metadata_extraction.rb +8 -3
- data/lib/metanorma/html/concerns/presentation_validation.rb +1 -2
- data/lib/metanorma/html/concerns/text_extraction.rb +154 -35
- data/lib/metanorma/html/concerns.rb +19 -0
- data/lib/metanorma/html/drops/admonition_drop.rb +1 -1
- data/lib/metanorma/html/drops/footnote_drop.rb +1 -1
- data/lib/metanorma/html/drops/sourcecode_drop.rb +22 -4
- data/lib/metanorma/html/generator.rb +11 -187
- data/lib/metanorma/html/renderer_delegation.rb +2 -2
- data/lib/metanorma/html/renderers/block_renderer.rb +206 -46
- data/lib/metanorma/html/renderers/inline_renderer.rb +144 -17
- data/lib/metanorma/html/renderers/section_renderer.rb +12 -2
- data/lib/metanorma/html/renderers/semantic_renderer.rb +487 -0
- data/lib/metanorma/html/renderers.rb +2 -0
- data/lib/metanorma/html/standard_renderer.rb +732 -76
- data/lib/metanorma/html/templates/_agency_cover.html.liquid +30 -0
- data/lib/metanorma/html/templates/_columnbreak.html.liquid +1 -0
- data/lib/metanorma/html/templates/_cover.html.liquid +3 -0
- data/lib/metanorma/html/templates/_main_content.html.liquid +1 -1
- data/lib/metanorma/html/templates/_ruby.html.liquid +1 -0
- data/lib/metanorma/html/templates/_sourcecode.html.liquid +4 -3
- data/lib/metanorma/html/templates/_standard_cover.html.liquid +54 -3
- data/lib/metanorma/html.rb +30 -15
- data/tasks/flavors.rake +116 -0
- data/tasks/grammar.rake +28 -0
- data/tasks/roundtrip_samples.rake +48 -34
- metadata +121 -416
- data/frontend/dist/app.css +0 -1
- data/frontend/dist/app.iife.js +0 -24
- data/lib/metanorma/bipm_document/metadata/bipm_bib_data_extension_type.rb +0 -20
- data/lib/metanorma/bipm_document/metadata/bipm_bibliographic_item.rb +0 -17
- data/lib/metanorma/bipm_document/metadata/bipm_structured_identifier.rb +0 -21
- data/lib/metanorma/bipm_document/metadata/depiction_element.rb +0 -18
- data/lib/metanorma/bipm_document/metadata.rb +0 -15
- data/lib/metanorma/bipm_document/root.rb +0 -25
- data/lib/metanorma/bipm_document.rb +0 -8
- data/lib/metanorma/bsi_document/metadata/bsi_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/bsi_document/metadata/bsi_bibliographic_item.rb +0 -15
- data/lib/metanorma/bsi_document/metadata.rb +0 -12
- data/lib/metanorma/bsi_document/root.rb +0 -29
- data/lib/metanorma/bsi_document/sections/bsi_annex_section.rb +0 -25
- data/lib/metanorma/bsi_document/sections/bsi_clause_section.rb +0 -25
- data/lib/metanorma/bsi_document/sections/bsi_sections.rb +0 -27
- data/lib/metanorma/bsi_document/sections.rb +0 -11
- data/lib/metanorma/bsi_document.rb +0 -11
- data/lib/metanorma/cc_document/metadata/cc_bib_data_extension_type.rb +0 -12
- data/lib/metanorma/cc_document/metadata/cc_bibliographic_item.rb +0 -17
- data/lib/metanorma/cc_document/metadata.rb +0 -11
- data/lib/metanorma/cc_document/root.rb +0 -25
- data/lib/metanorma/cc_document.rb +0 -8
- data/lib/metanorma/collection.rb +0 -10
- data/lib/metanorma/csa_document/root.rb +0 -27
- data/lib/metanorma/csa_document.rb +0 -9
- data/lib/metanorma/gb_document/metadata/gb_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/gb_document/metadata/gb_bibliographic_item.rb +0 -15
- data/lib/metanorma/gb_document/metadata.rb +0 -12
- data/lib/metanorma/gb_document/root.rb +0 -29
- data/lib/metanorma/gb_document.rb +0 -10
- data/lib/metanorma/generic_document/root.rb +0 -31
- data/lib/metanorma/generic_document.rb +0 -7
- data/lib/metanorma/html/bipm_renderer.rb +0 -23
- data/lib/metanorma/html/cc_renderer.rb +0 -9
- data/lib/metanorma/html/csa_renderer.rb +0 -9
- data/lib/metanorma/html/flavor.rb +0 -50
- data/lib/metanorma/html/flavor_registry.rb +0 -49
- data/lib/metanorma/html/icc_renderer.rb +0 -10
- data/lib/metanorma/html/iec_renderer.rb +0 -9
- data/lib/metanorma/html/ieee_renderer.rb +0 -9
- data/lib/metanorma/html/ietf_renderer.rb +0 -9
- data/lib/metanorma/html/iho_renderer.rb +0 -9
- data/lib/metanorma/html/iso_renderer.rb +0 -535
- data/lib/metanorma/html/itu_renderer.rb +0 -9
- data/lib/metanorma/html/ogc_renderer.rb +0 -23
- data/lib/metanorma/html/pdfa_renderer.rb +0 -10
- data/lib/metanorma/html/ribose_renderer.rb +0 -9
- data/lib/metanorma/html/templates/_bipm_cover.html.liquid +0 -27
- data/lib/metanorma/html/templates/_iso_cover.html.liquid +0 -31
- data/lib/metanorma/html/templates/_iso_doc_title.html.liquid +0 -3
- data/lib/metanorma/iec_document/root.rb +0 -27
- data/lib/metanorma/iec_document.rb +0 -9
- data/lib/metanorma/ieee_document/metadata/ieee_bib_data_extension_type.rb +0 -18
- data/lib/metanorma/ieee_document/metadata/ieee_bibliographic_item.rb +0 -20
- data/lib/metanorma/ieee_document/metadata/ieee_structured_identifier.rb +0 -25
- data/lib/metanorma/ieee_document/metadata.rb +0 -14
- data/lib/metanorma/ieee_document/root.rb +0 -29
- data/lib/metanorma/ieee_document/sections/ieee_sections.rb +0 -31
- data/lib/metanorma/ieee_document/sections.rb +0 -9
- data/lib/metanorma/ieee_document.rb +0 -11
- data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +0 -31
- data/lib/metanorma/ietf_document/metadata/ietf_bibliographic_item.rb +0 -51
- data/lib/metanorma/ietf_document/metadata/ietf_editorial_group.rb +0 -17
- data/lib/metanorma/ietf_document/metadata/pi_settings.rb +0 -32
- data/lib/metanorma/ietf_document/metadata.rb +0 -16
- data/lib/metanorma/ietf_document/root.rb +0 -30
- data/lib/metanorma/ietf_document/sections/ietf_annex_section.rb +0 -26
- data/lib/metanorma/ietf_document/sections/ietf_clause_section.rb +0 -26
- data/lib/metanorma/ietf_document/sections/ietf_content_section.rb +0 -25
- data/lib/metanorma/ietf_document/sections/ietf_sections.rb +0 -35
- data/lib/metanorma/ietf_document/sections.rb +0 -12
- data/lib/metanorma/ietf_document.rb +0 -11
- data/lib/metanorma/iho_document/metadata/iho_bib_data_extension_type.rb +0 -23
- data/lib/metanorma/iho_document/metadata/iho_bibliographic_item.rb +0 -20
- data/lib/metanorma/iho_document/metadata/iho_editorial_group.rb +0 -19
- data/lib/metanorma/iho_document/metadata/iho_series.rb +0 -22
- data/lib/metanorma/iho_document/metadata/iho_sub_group.rb +0 -18
- data/lib/metanorma/iho_document/metadata.rb +0 -15
- data/lib/metanorma/iho_document/root.rb +0 -25
- data/lib/metanorma/iho_document.rb +0 -8
- data/lib/metanorma/iso_document/annotation_container.rb +0 -7
- data/lib/metanorma/iso_document/blocks/iso_admonition_block.rb +0 -27
- data/lib/metanorma/iso_document/blocks/iso_admonition_type.rb +0 -25
- data/lib/metanorma/iso_document/blocks.rb +0 -12
- data/lib/metanorma/iso_document/boilerplate.rb +0 -7
- data/lib/metanorma/iso_document/metadata/abstract_title.rb +0 -36
- data/lib/metanorma/iso_document/metadata/doc_identifier.rb +0 -26
- data/lib/metanorma/iso_document/metadata/doctype_element.rb +0 -20
- data/lib/metanorma/iso_document/metadata/ics.rb +0 -19
- data/lib/metanorma/iso_document/metadata/iec_document_category.rb +0 -23
- data/lib/metanorma/iso_document/metadata/iso_bib_data_extension_type.rb +0 -38
- data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +0 -103
- data/lib/metanorma/iso_document/metadata/iso_document_id.rb +0 -46
- data/lib/metanorma/iso_document/metadata/iso_document_stage_codes.rb +0 -26
- data/lib/metanorma/iso_document/metadata/iso_document_status.rb +0 -26
- data/lib/metanorma/iso_document/metadata/iso_document_substage_codes.rb +0 -26
- data/lib/metanorma/iso_document/metadata/iso_document_type.rb +0 -25
- data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +0 -61
- data/lib/metanorma/iso_document/metadata/iso_project_group.rb +0 -32
- data/lib/metanorma/iso_document/metadata/iso_sub_group.rb +0 -38
- data/lib/metanorma/iso_document/metadata/language_element.rb +0 -18
- data/lib/metanorma/iso_document/metadata/metanorma_extension.rb +0 -9
- 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/metadata/structured_identifier.rb +0 -16
- data/lib/metanorma/iso_document/metadata/title_amd.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_amendment_prefix.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_collection.rb +0 -47
- data/lib/metanorma/iso_document/metadata/title_full.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_intro.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_main.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_part.rb +0 -12
- data/lib/metanorma/iso_document/metadata/title_part_prefix.rb +0 -12
- data/lib/metanorma/iso_document/metadata.rb +0 -44
- data/lib/metanorma/iso_document/root.rb +0 -26
- data/lib/metanorma/iso_document/sections/colophon.rb +0 -3
- data/lib/metanorma/iso_document/sections/iso_abstract_section.rb +0 -15
- data/lib/metanorma/iso_document/sections/iso_amendment_clause.rb +0 -24
- data/lib/metanorma/iso_document/sections/iso_annex_section.rb +0 -50
- data/lib/metanorma/iso_document/sections/iso_clause_section.rb +0 -49
- data/lib/metanorma/iso_document/sections/iso_foreword_section.rb +0 -33
- data/lib/metanorma/iso_document/sections/iso_preface.rb +0 -51
- data/lib/metanorma/iso_document/sections/iso_sections.rb +0 -51
- data/lib/metanorma/iso_document/sections/iso_terms_section.rb +0 -76
- data/lib/metanorma/iso_document/sections.rb +0 -17
- data/lib/metanorma/iso_document/terms/iso_term.rb +0 -71
- data/lib/metanorma/iso_document/terms/iso_term_collection.rb +0 -20
- data/lib/metanorma/iso_document/terms/term_definition.rb +0 -30
- data/lib/metanorma/iso_document/terms/term_designation.rb +0 -44
- data/lib/metanorma/iso_document/terms/term_domain_element.rb +0 -18
- data/lib/metanorma/iso_document/terms/term_example.rb +0 -40
- data/lib/metanorma/iso_document/terms/term_expression.rb +0 -10
- data/lib/metanorma/iso_document/terms/term_note.rb +0 -42
- data/lib/metanorma/iso_document/terms/term_origin.rb +0 -4
- data/lib/metanorma/iso_document/terms/term_source.rb +0 -21
- data/lib/metanorma/iso_document/terms/verbal_definition.rb +0 -42
- data/lib/metanorma/iso_document/terms.rb +0 -21
- data/lib/metanorma/iso_document.rb +0 -15
- data/lib/metanorma/itu_document/metadata/itu_bib_data_extension_type.rb +0 -26
- data/lib/metanorma/itu_document/metadata/itu_bibliographic_item.rb +0 -21
- data/lib/metanorma/itu_document/metadata/itu_series.rb +0 -22
- data/lib/metanorma/itu_document/metadata/itu_structured_identifier.rb +0 -23
- 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/itu_document/metadata.rb +0 -18
- data/lib/metanorma/itu_document/root.rb +0 -25
- data/lib/metanorma/itu_document.rb +0 -8
- data/lib/metanorma/jis_document/metadata/jis_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/jis_document/metadata/jis_bibliographic_item.rb +0 -15
- data/lib/metanorma/jis_document/metadata.rb +0 -12
- data/lib/metanorma/jis_document/root.rb +0 -29
- data/lib/metanorma/jis_document/sections/jis_annex_section.rb +0 -20
- data/lib/metanorma/jis_document/sections.rb +0 -9
- data/lib/metanorma/jis_document.rb +0 -11
- data/lib/metanorma/m3d_document/metadata/m3d_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/m3d_document/metadata/m3d_bibliographic_item.rb +0 -15
- data/lib/metanorma/m3d_document/metadata.rb +0 -12
- data/lib/metanorma/m3d_document/root.rb +0 -29
- data/lib/metanorma/m3d_document.rb +0 -10
- data/lib/metanorma/mirror/default_registry.rb +0 -191
- 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/catalog.rb +0 -52
- data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +0 -158
- data/lib/metanorma/mirror/handlers/inline/text_extractor.rb +0 -116
- data/lib/metanorma/mirror/handlers/inline.rb +0 -226
- 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/model/container.rb +0 -47
- data/lib/metanorma/mirror/model/factory.rb +0 -52
- data/lib/metanorma/mirror/model/guide.rb +0 -26
- 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 -142
- data/lib/metanorma/mirror/output/formats.rb +0 -53
- data/lib/metanorma/mirror/output/pipeline.rb +0 -93
- data/lib/metanorma/mirror/output/pipeline_context.rb +0 -22
- data/lib/metanorma/mirror/output.rb +0 -12
- data/lib/metanorma/mirror/rewriter.rb +0 -123
- 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 -110
- data/lib/metanorma/mirror.rb +0 -31
- data/lib/metanorma/nist_document/metadata/nist_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/nist_document/metadata/nist_bibliographic_item.rb +0 -15
- data/lib/metanorma/nist_document/metadata.rb +0 -12
- data/lib/metanorma/nist_document/root.rb +0 -29
- data/lib/metanorma/nist_document/sections/errata.rb +0 -16
- data/lib/metanorma/nist_document/sections/errata_clause.rb +0 -20
- data/lib/metanorma/nist_document/sections/errata_row.rb +0 -22
- data/lib/metanorma/nist_document/sections/nist_preface.rb +0 -30
- data/lib/metanorma/nist_document/sections.rb +0 -12
- data/lib/metanorma/nist_document.rb +0 -11
- data/lib/metanorma/ogc_document/metadata/ogc_bib_data_extension_type.rb +0 -12
- data/lib/metanorma/ogc_document/metadata/ogc_bibliographic_item.rb +0 -19
- data/lib/metanorma/ogc_document/metadata.rb +0 -12
- data/lib/metanorma/ogc_document/root.rb +0 -25
- data/lib/metanorma/ogc_document.rb +0 -8
- data/lib/metanorma/plateau_document/metadata/plateau_bibliographic_item.rb +0 -13
- data/lib/metanorma/plateau_document/metadata.rb +0 -10
- data/lib/metanorma/plateau_document/root.rb +0 -29
- data/lib/metanorma/plateau_document.rb +0 -10
- data/lib/metanorma/registers/setup.rb +0 -166
- data/lib/metanorma/registers.rb +0 -7
- data/lib/metanorma/ribose_document/metadata/ribose_bib_data_extension_type.rb +0 -20
- data/lib/metanorma/ribose_document/metadata/ribose_bibliographic_item.rb +0 -18
- data/lib/metanorma/ribose_document/metadata.rb +0 -12
- data/lib/metanorma/ribose_document/root.rb +0 -26
- data/lib/metanorma/ribose_document.rb +0 -8
- data/lib/metanorma/standard_document/annotation_container.rb +0 -39
- data/lib/metanorma/standard_document/block_attributes.rb +0 -281
- data/lib/metanorma/standard_document/blocks/amend_block.rb +0 -50
- data/lib/metanorma/standard_document/blocks/amend_content_block.rb +0 -35
- data/lib/metanorma/standard_document/blocks/auto_number.rb +0 -20
- data/lib/metanorma/standard_document/blocks/block_source.rb +0 -22
- data/lib/metanorma/standard_document/blocks/change_type.rb +0 -21
- data/lib/metanorma/standard_document/blocks/element_name.rb +0 -22
- data/lib/metanorma/standard_document/blocks/form.rb +0 -38
- data/lib/metanorma/standard_document/blocks/image_map_area_type.rb +0 -24
- data/lib/metanorma/standard_document/blocks/image_map_area_type_type.rb +0 -21
- data/lib/metanorma/standard_document/blocks/image_map_block.rb +0 -32
- data/lib/metanorma/standard_document/blocks/image_map_coords.rb +0 -19
- data/lib/metanorma/standard_document/blocks/image_map_radius.rb +0 -19
- data/lib/metanorma/standard_document/blocks/multilingual_rendering_type.rb +0 -21
- data/lib/metanorma/standard_document/blocks/passthrough.rb +0 -3
- data/lib/metanorma/standard_document/blocks/requirement_model.rb +0 -20
- data/lib/metanorma/standard_document/blocks/source_origin_element.rb +0 -23
- data/lib/metanorma/standard_document/blocks/standard_admonition_block.rb +0 -32
- data/lib/metanorma/standard_document/blocks/standard_block.rb +0 -28
- data/lib/metanorma/standard_document/blocks/standard_block_no_notes.rb +0 -34
- data/lib/metanorma/standard_document/blocks/standard_example_block.rb +0 -30
- data/lib/metanorma/standard_document/blocks/standard_figure_block.rb +0 -32
- data/lib/metanorma/standard_document/blocks/standard_formula_block.rb +0 -30
- data/lib/metanorma/standard_document/blocks/standard_note_block.rb +0 -64
- data/lib/metanorma/standard_document/blocks/standard_paragraph_block.rb +0 -25
- data/lib/metanorma/standard_document/blocks/standard_quote_block.rb +0 -29
- data/lib/metanorma/standard_document/blocks/standard_sourcecode_block.rb +0 -32
- data/lib/metanorma/standard_document/blocks/standard_table_block.rb +0 -39
- data/lib/metanorma/standard_document/blocks/svg_map_block.rb +0 -23
- data/lib/metanorma/standard_document/blocks/svg_target_type.rb +0 -20
- data/lib/metanorma/standard_document/blocks/table_col.rb +0 -16
- data/lib/metanorma/standard_document/blocks/to_c.rb +0 -17
- data/lib/metanorma/standard_document/blocks.rb +0 -60
- data/lib/metanorma/standard_document/boilerplate.rb +0 -32
- data/lib/metanorma/standard_document/elements/add.rb +0 -3
- data/lib/metanorma/standard_document/elements/del.rb +0 -3
- data/lib/metanorma/standard_document/elements/form_input.rb +0 -27
- data/lib/metanorma/standard_document/elements/input.rb +0 -12
- data/lib/metanorma/standard_document/elements/input_type.rb +0 -27
- data/lib/metanorma/standard_document/elements/label.rb +0 -19
- data/lib/metanorma/standard_document/elements/option.rb +0 -27
- data/lib/metanorma/standard_document/elements/orientation_type.rb +0 -27
- data/lib/metanorma/standard_document/elements/select.rb +0 -32
- data/lib/metanorma/standard_document/elements/standard_page_break_element.rb +0 -22
- data/lib/metanorma/standard_document/elements/textarea.rb +0 -25
- data/lib/metanorma/standard_document/elements.rb +0 -20
- data/lib/metanorma/standard_document/lists/standard_definition.rb +0 -24
- data/lib/metanorma/standard_document/lists/standard_definition_list.rb +0 -30
- data/lib/metanorma/standard_document/lists/standard_definition_term.rb +0 -27
- data/lib/metanorma/standard_document/lists/standard_unordered_list.rb +0 -28
- data/lib/metanorma/standard_document/lists/unordered_checkable_list_item.rb +0 -26
- data/lib/metanorma/standard_document/lists.rb +0 -17
- data/lib/metanorma/standard_document/metadata/editorial_group_type.rb +0 -25
- data/lib/metanorma/standard_document/metadata/ics_type.rb +0 -26
- data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +0 -26
- data/lib/metanorma/standard_document/metadata/presentation_metadata.rb +0 -107
- data/lib/metanorma/standard_document/metadata/semantic_metadata.rb +0 -18
- data/lib/metanorma/standard_document/metadata/standard_bib_data.rb +0 -25
- data/lib/metanorma/standard_document/metadata/standard_bib_data_extension_type.rb +0 -37
- data/lib/metanorma/standard_document/metadata/structured_identifier_type.rb +0 -48
- data/lib/metanorma/standard_document/metadata/technical_committee_type.rb +0 -27
- data/lib/metanorma/standard_document/metadata/unitsml/amount_of_substance.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/base_quantity.rb +0 -34
- data/lib/metanorma/standard_document/metadata/unitsml/dimension.rb +0 -39
- data/lib/metanorma/standard_document/metadata/unitsml/dimension_set.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/electric_current.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/enumerated_root_unit.rb +0 -23
- data/lib/metanorma/standard_document/metadata/unitsml/length.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/luminous_intensity.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/mass.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/namespace.rb +0 -17
- data/lib/metanorma/standard_document/metadata/unitsml/plane_angle.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/prefix.rb +0 -30
- data/lib/metanorma/standard_document/metadata/unitsml/prefix_name.rb +0 -21
- data/lib/metanorma/standard_document/metadata/unitsml/prefix_set.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/prefix_symbol.rb +0 -21
- data/lib/metanorma/standard_document/metadata/unitsml/quantity.rb +0 -28
- data/lib/metanorma/standard_document/metadata/unitsml/quantity_name.rb +0 -21
- data/lib/metanorma/standard_document/metadata/unitsml/quantity_set.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/root_units.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/thermodynamic_temperature.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/time.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/unit.rb +0 -32
- data/lib/metanorma/standard_document/metadata/unitsml/unit_name.rb +0 -21
- data/lib/metanorma/standard_document/metadata/unitsml/unit_set.rb +0 -19
- data/lib/metanorma/standard_document/metadata/unitsml/unit_symbol.rb +0 -36
- data/lib/metanorma/standard_document/metadata/unitsml/unit_system.rb +0 -23
- data/lib/metanorma/standard_document/metadata/unitsml/unitsml_root.rb +0 -28
- data/lib/metanorma/standard_document/metadata/unitsml.rb +0 -39
- data/lib/metanorma/standard_document/metadata.rb +0 -23
- data/lib/metanorma/standard_document/namespace.rb +0 -11
- data/lib/metanorma/standard_document/refs/reference_to_term.rb +0 -26
- data/lib/metanorma/standard_document/refs/reference_to_termbase.rb +0 -27
- data/lib/metanorma/standard_document/refs/standoc_locality_stack.rb +0 -24
- data/lib/metanorma/standard_document/refs/standoc_reference_to_citation_element.rb +0 -27
- data/lib/metanorma/standard_document/refs/standoc_reference_to_id_element.rb +0 -36
- data/lib/metanorma/standard_document/refs/xref_case_type.rb +0 -27
- data/lib/metanorma/standard_document/refs/xref_connective_type.rb +0 -27
- data/lib/metanorma/standard_document/refs/xref_target_type.rb +0 -25
- data/lib/metanorma/standard_document/refs.rb +0 -18
- data/lib/metanorma/standard_document/root.rb +0 -10
- data/lib/metanorma/standard_document/root_attributes.rb +0 -78
- data/lib/metanorma/standard_document/sections/abstract.rb +0 -19
- data/lib/metanorma/standard_document/sections/acknowledgements.rb +0 -19
- data/lib/metanorma/standard_document/sections/annex_section.rb +0 -69
- data/lib/metanorma/standard_document/sections/bibliography_section.rb +0 -20
- data/lib/metanorma/standard_document/sections/boilerplate_type.rb +0 -32
- data/lib/metanorma/standard_document/sections/clause_hierarchical_section.rb +0 -32
- data/lib/metanorma/standard_document/sections/clause_section.rb +0 -91
- data/lib/metanorma/standard_document/sections/colophon.rb +0 -16
- data/lib/metanorma/standard_document/sections/definition_section.rb +0 -72
- data/lib/metanorma/standard_document/sections/floating_section_title.rb +0 -23
- data/lib/metanorma/standard_document/sections/floating_title.rb +0 -27
- data/lib/metanorma/standard_document/sections/foreword.rb +0 -19
- data/lib/metanorma/standard_document/sections/introduction.rb +0 -20
- data/lib/metanorma/standard_document/sections/misc_container.rb +0 -31
- data/lib/metanorma/standard_document/sections/normative_type.rb +0 -29
- data/lib/metanorma/standard_document/sections/preface.rb +0 -36
- data/lib/metanorma/standard_document/sections/sections.rb +0 -47
- data/lib/metanorma/standard_document/sections/standard_content_section.rb +0 -41
- data/lib/metanorma/standard_document/sections/standard_hierarchical_section.rb +0 -30
- data/lib/metanorma/standard_document/sections/standard_references_section.rb +0 -74
- data/lib/metanorma/standard_document/sections/standard_section.rb +0 -39
- data/lib/metanorma/standard_document/sections/terms_section.rb +0 -61
- data/lib/metanorma/standard_document/sections.rb +0 -34
- data/lib/metanorma/standard_document/standard_document_type.rb +0 -15
- data/lib/metanorma/standard_document/terms/abbreviation_type.rb +0 -27
- data/lib/metanorma/standard_document/terms/concept.rb +0 -42
- data/lib/metanorma/standard_document/terms/definition_collection.rb +0 -24
- data/lib/metanorma/standard_document/terms/designation.rb +0 -31
- data/lib/metanorma/standard_document/terms/expression_designation.rb +0 -38
- data/lib/metanorma/standard_document/terms/expression_type.rb +0 -27
- data/lib/metanorma/standard_document/terms/grammar_gender.rb +0 -27
- data/lib/metanorma/standard_document/terms/grammar_info.rb +0 -36
- data/lib/metanorma/standard_document/terms/graphical_symbol_designation.rb +0 -25
- data/lib/metanorma/standard_document/terms/letter_symbol_designation.rb +0 -27
- data/lib/metanorma/standard_document/terms/non_verbal_representation.rb +0 -33
- data/lib/metanorma/standard_document/terms/related_term.rb +0 -31
- data/lib/metanorma/standard_document/terms/related_term_type.rb +0 -28
- data/lib/metanorma/standard_document/terms/term.rb +0 -66
- data/lib/metanorma/standard_document/terms/term_collection.rb +0 -24
- data/lib/metanorma/standard_document/terms/term_definition.rb +0 -29
- data/lib/metanorma/standard_document/terms/term_expression.rb +0 -20
- data/lib/metanorma/standard_document/terms/term_name_element.rb +0 -29
- data/lib/metanorma/standard_document/terms/term_source.rb +0 -29
- data/lib/metanorma/standard_document/terms/term_source_status.rb +0 -29
- data/lib/metanorma/standard_document/terms/term_source_type.rb +0 -21
- data/lib/metanorma/standard_document/terms/verbal_expression.rb +0 -35
- data/lib/metanorma/standard_document/terms.rb +0 -33
- data/lib/metanorma/standard_document.rb +0 -27
- data/lib/metanorma/un_document/blocks/un_admonition_block.rb +0 -86
- data/lib/metanorma/un_document/blocks.rb +0 -9
- data/lib/metanorma/un_document/metadata/un_bib_data_extension_type.rb +0 -10
- data/lib/metanorma/un_document/metadata/un_bibliographic_item.rb +0 -15
- data/lib/metanorma/un_document/metadata.rb +0 -12
- data/lib/metanorma/un_document/root.rb +0 -37
- data/lib/metanorma/un_document/sections/un_abstract_section.rb +0 -48
- data/lib/metanorma/un_document/sections/un_preface.rb +0 -40
- data/lib/metanorma/un_document/sections/un_sections.rb +0 -24
- data/lib/metanorma/un_document/sections.rb +0 -11
- data/lib/metanorma/un_document/un_text_element.rb +0 -116
- data/lib/metanorma/un_document.rb +0 -13
|
@@ -10,6 +10,8 @@ module Metanorma
|
|
|
10
10
|
attribute :text, :string, collection: true
|
|
11
11
|
attribute :em, "Metanorma::Document::Components::Inline::EmRawElement",
|
|
12
12
|
collection: true
|
|
13
|
+
attribute :ruby, "Metanorma::Document::Components::TextElements::RubyElement",
|
|
14
|
+
collection: true
|
|
13
15
|
attribute :strong, "Metanorma::Document::Components::Inline::StrongRawElement",
|
|
14
16
|
collection: true
|
|
15
17
|
attribute :eref, "Metanorma::Document::Components::Inline::ErefElement",
|
|
@@ -22,6 +24,7 @@ module Metanorma
|
|
|
22
24
|
mixed_content
|
|
23
25
|
map_content to: :text
|
|
24
26
|
map_element "em", to: :em
|
|
27
|
+
map_element "ruby", to: :ruby
|
|
25
28
|
map_element "strong", to: :strong
|
|
26
29
|
map_element "eref", to: :eref
|
|
27
30
|
map_element "link", to: :link
|
|
@@ -12,6 +12,8 @@ module Metanorma
|
|
|
12
12
|
|
|
13
13
|
autoload :MonospaceElement, "#{__dir__}/text_elements/monospace_element"
|
|
14
14
|
autoload :RubyElement, "#{__dir__}/text_elements/ruby_element"
|
|
15
|
+
autoload :RubyPronunciationElement, "#{__dir__}/text_elements/ruby_pronunciation_element"
|
|
16
|
+
autoload :RubyAnnotationElement, "#{__dir__}/text_elements/ruby_annotation_element"
|
|
15
17
|
autoload :SmallCapsElement,
|
|
16
18
|
"#{__dir__}/text_elements/small_caps_element"
|
|
17
19
|
autoload :StemElement, "#{__dir__}/text_elements/stem_element"
|
|
@@ -19,6 +19,7 @@ module Metanorma
|
|
|
19
19
|
autoload :ReferenceElements,
|
|
20
20
|
"metanorma/document/components/reference_elements"
|
|
21
21
|
autoload :Sections, "metanorma/document/components/sections"
|
|
22
|
+
autoload :Semantic, "metanorma/document/components/semantic"
|
|
22
23
|
autoload :Tables, "metanorma/document/components/tables"
|
|
23
24
|
autoload :Inline, "metanorma/document/components/inline"
|
|
24
25
|
autoload :TextElements, "metanorma/document/components/text_elements"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
# The standoc-grammar element vocabulary this gem is accountable
|
|
6
|
+
# for (#2): every element defined by standoc-models (standoc.rnc +
|
|
7
|
+
# basicdoc.rnc, plus the standoc-presentation.rnc overlay) is
|
|
8
|
+
# either mapped by a model class here, delegated to its owning
|
|
9
|
+
# tree, or tracked as a gap. The grammar-coverage spec asserts the
|
|
10
|
+
# classification; `rake grammar_coverage` diffs it against a
|
|
11
|
+
# standoc-models checkout when the grammars change.
|
|
12
|
+
module GrammarVocabulary
|
|
13
|
+
ELEMENT_PATTERN = /element\s+([a-zA-Z0-9_.:-]+)\s*\{/
|
|
14
|
+
|
|
15
|
+
# Regenerate the vocabulary from a standoc-models grammars/
|
|
16
|
+
# directory: { semantic: [...], presentation: [...] }
|
|
17
|
+
def self.scan(grammars_dir)
|
|
18
|
+
semantic = ["#{grammars_dir}/standoc.rnc"]
|
|
19
|
+
.concat(Dir["#{grammars_dir}/basicdoc-models/grammars/*.rnc"])
|
|
20
|
+
.flat_map { |f| File.read(f, encoding: "utf-8").scan(ELEMENT_PATTERN).flatten }
|
|
21
|
+
.uniq.sort
|
|
22
|
+
presentation = File.read("#{grammars_dir}/standoc-presentation.rnc",
|
|
23
|
+
encoding: "utf-8")
|
|
24
|
+
.scan(ELEMENT_PATTERN).flatten.uniq.sort
|
|
25
|
+
{ semantic: semantic, presentation: presentation }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
SEMANTIC_ELEMENTS = %w[
|
|
29
|
+
abbreviation-type abstract acknowledgements add admitted admonition
|
|
30
|
+
altsource amend annex annotation annotation-container appendix
|
|
31
|
+
area asciimath attribute audio author autonumber
|
|
32
|
+
bibdata bibitem bibliography body boilerplate bookmark
|
|
33
|
+
br callout callout-annotation classification clause col
|
|
34
|
+
colgroup colophon columnbreak concept coords copyright-statement
|
|
35
|
+
date dd definition definitions del deprecates
|
|
36
|
+
description display-text dl document domain dt
|
|
37
|
+
em eref erefstack errormsg example executivesummary
|
|
38
|
+
expression feedback-statement field-of-application figure floating-title fn
|
|
39
|
+
foreword form formula gender grammar grammar-value
|
|
40
|
+
graphical-symbol hr image imagemap index index-xref
|
|
41
|
+
indexsect input introduction isAdjective isAdverb isNoun
|
|
42
|
+
isParticiple isPreposition isVerb key keyword label
|
|
43
|
+
latexmath legal-statement letter-symbol li license-statement link
|
|
44
|
+
location metanorma metanorma-extension modification name newcontent
|
|
45
|
+
non-verbal-representation note number ol option origin
|
|
46
|
+
p pagebreak passthrough pre preface preferred
|
|
47
|
+
primary pronunciation quote radius references refterm
|
|
48
|
+
related renderterm review ruby ruby-annotation ruby-pronunciation
|
|
49
|
+
secondary section sections select smallcap source
|
|
50
|
+
sourcecode span stem strike strong sub
|
|
51
|
+
subject sup svg svgmap table tag
|
|
52
|
+
target tbody td term termdocsource termexample
|
|
53
|
+
termnote termref terms tertiary textarea tfoot
|
|
54
|
+
th thead title toc tr tt
|
|
55
|
+
ul underline usage-info value variable-ref variant-title
|
|
56
|
+
verbal-definition video xref
|
|
57
|
+
].freeze
|
|
58
|
+
|
|
59
|
+
PRESENTATION_ELEMENTS = %w[
|
|
60
|
+
annotation-container attribution author bibitem biblio-tag dd
|
|
61
|
+
emf eref fmt-admitted fmt-annotation-body fmt-annotation-end fmt-annotation-start
|
|
62
|
+
fmt-concept fmt-date-inline fmt-definition fmt-deprecates fmt-eref fmt-figure
|
|
63
|
+
fmt-fn-body fmt-fn-label fmt-footnote-container fmt-identifier fmt-link fmt-name
|
|
64
|
+
fmt-ol fmt-origin fmt-preferred fmt-provision fmt-related fmt-source
|
|
65
|
+
fmt-sourcecode fmt-stem fmt-termsource fmt-title fmt-ul fmt-xref-label
|
|
66
|
+
image li localized-string localized-strings metanorma-extension name
|
|
67
|
+
p passthrough rb rt ruby semx
|
|
68
|
+
source source-highlighter-css sourcelocalityStack svg tab term
|
|
69
|
+
termexample termnote title toc variant-title
|
|
70
|
+
].freeze
|
|
71
|
+
|
|
72
|
+
# Elements owned by other model trees — mapped there, not here:
|
|
73
|
+
# standoc : the sections/terms/metadata tree (metanorma-standoc)
|
|
74
|
+
# relaton : the bibliographic models (relaton)
|
|
75
|
+
# reqt : the requirements vocabulary (requirements models)
|
|
76
|
+
# basicdoc_only : defined by basicdoc, referenced by no standoc
|
|
77
|
+
# content model — dead vocabulary until adopted
|
|
78
|
+
DELEGATED = {
|
|
79
|
+
standoc: %w[
|
|
80
|
+
abbreviation-type acknowledgements amend annex annotation-container
|
|
81
|
+
appendix autonumber bibliography boilerplate clause colophon
|
|
82
|
+
copyright-statement executivesummary expression
|
|
83
|
+
feedback-statement field-of-application floating-title foreword form
|
|
84
|
+
gender graphical-symbol grammar grammar-value indexsect introduction
|
|
85
|
+
isAdjective isAdverb isNoun isParticiple isPreposition isVerb label
|
|
86
|
+
legal-statement letter-symbol license-statement metanorma-extension
|
|
87
|
+
newcontent non-verbal-representation option preface pronunciation
|
|
88
|
+
related sections select source-highlighter-css term
|
|
89
|
+
termdocsource termexample terms textarea toc usage-info
|
|
90
|
+
fmt-deprecates fmt-related
|
|
91
|
+
],
|
|
92
|
+
relaton: %w[altsource],
|
|
93
|
+
reqt: %w[attribute],
|
|
94
|
+
# basicdoc's own parallel document structure (basicdoc root
|
|
95
|
+
# `document`, generic nested `section`) — standoc content
|
|
96
|
+
# models reference neither; the collection manifest root is the
|
|
97
|
+
# metanorma gem's own model.
|
|
98
|
+
basicdoc_only: %w[document section variable-ref],
|
|
99
|
+
}.freeze
|
|
100
|
+
|
|
101
|
+
# Presentation-overlay elements with no model yet. EMPTY since
|
|
102
|
+
# the fmt-twins wave (#63): every element this gem owns —
|
|
103
|
+
# semantic and rendered — parses. sourcelocalityStack parses its
|
|
104
|
+
# text; its child pattern is a dangling grammar reference
|
|
105
|
+
# (standoc-models issue), extended when the grammar defines it.
|
|
106
|
+
KNOWN_GAPS = [].freeze
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Document
|
|
5
|
+
# Registers this gem's model knowledge into the metanorma-mirror
|
|
6
|
+
# format gem. Components-based handlers run through the lazy
|
|
7
|
+
# register_default hook; the class tables (mark builders, simple
|
|
8
|
+
# mark types, rich renderers, text substitutions, semx classes),
|
|
9
|
+
# the inline content iterator, and the Components part of the
|
|
10
|
+
# positional id categories register eagerly — none of them touch
|
|
11
|
+
# constants outside this gem. metanorma-standoc seeds the section
|
|
12
|
+
# and structural handlers and its own id categories when it loads.
|
|
13
|
+
class MirrorSeed
|
|
14
|
+
MARK_BUILDERS = {
|
|
15
|
+
Components::Inline::EmRawElement => ->(_el) {
|
|
16
|
+
Mirror::Handlers.build_mark("emphasis")
|
|
17
|
+
},
|
|
18
|
+
Components::Inline::StrongRawElement => ->(_el) {
|
|
19
|
+
Mirror::Handlers.build_mark("strong")
|
|
20
|
+
},
|
|
21
|
+
Components::Inline::SubElement => ->(_el) {
|
|
22
|
+
Mirror::Handlers.build_mark("subscript")
|
|
23
|
+
},
|
|
24
|
+
Components::Inline::SupElement => ->(_el) {
|
|
25
|
+
Mirror::Handlers.build_mark("superscript")
|
|
26
|
+
},
|
|
27
|
+
Components::Inline::TtElement => ->(_el) {
|
|
28
|
+
Mirror::Handlers.build_mark("code")
|
|
29
|
+
},
|
|
30
|
+
Components::TextElements::UnderlineElement => ->(_el) {
|
|
31
|
+
Mirror::Handlers.build_mark("underline")
|
|
32
|
+
},
|
|
33
|
+
Components::TextElements::StrikeElement => ->(_el) {
|
|
34
|
+
Mirror::Handlers.build_mark("strike")
|
|
35
|
+
},
|
|
36
|
+
Components::Inline::SmallCapElement => ->(_el) {
|
|
37
|
+
Mirror::Handlers.build_mark("smallcap")
|
|
38
|
+
},
|
|
39
|
+
Components::Inline::Bcp14Element => ->(_el) {
|
|
40
|
+
Mirror::Handlers.build_mark("bcp14")
|
|
41
|
+
},
|
|
42
|
+
Components::Inline::LinkElement => ->(el) {
|
|
43
|
+
attrs = {
|
|
44
|
+
href: Mirror::SafeAttr.read(el, :target) ||
|
|
45
|
+
Mirror::SafeAttr.read(el, :href),
|
|
46
|
+
}.compact
|
|
47
|
+
Mirror::Handlers.build_mark("link", attrs: attrs)
|
|
48
|
+
},
|
|
49
|
+
Components::Inline::XrefElement => ->(el) {
|
|
50
|
+
attrs = { target: Mirror::SafeAttr.read(el, :target) }.compact
|
|
51
|
+
Mirror::Handlers.build_mark("xref", attrs: attrs)
|
|
52
|
+
},
|
|
53
|
+
Components::Inline::ErefElement => ->(el) {
|
|
54
|
+
attrs = {
|
|
55
|
+
bibitemid: Mirror::SafeAttr.read(el, :bibitemid),
|
|
56
|
+
citeas: Mirror::SafeAttr.read(el, :citeas),
|
|
57
|
+
}.compact
|
|
58
|
+
Mirror::Handlers.build_mark("eref", attrs: attrs)
|
|
59
|
+
},
|
|
60
|
+
Components::Inline::FnElement => ->(el) {
|
|
61
|
+
attrs = {
|
|
62
|
+
id: Mirror::SafeAttr.read(el, :id),
|
|
63
|
+
reference: Mirror::SafeAttr.read(el, :reference),
|
|
64
|
+
}.compact
|
|
65
|
+
Mirror::Handlers.build_mark("footnote", attrs: attrs)
|
|
66
|
+
},
|
|
67
|
+
Components::Inline::StemInlineElement => ->(el) {
|
|
68
|
+
attrs = { stem_type: Mirror::SafeAttr.read(el, :stem_type) ||
|
|
69
|
+
"MathML" }
|
|
70
|
+
math = Mirror::SafeAttr.read(el, :math)
|
|
71
|
+
attrs[:mathml] = Mirror::MathUtil.mathml_from_math(math) if math
|
|
72
|
+
Mirror::Handlers.build_mark("stem", attrs: attrs.compact)
|
|
73
|
+
},
|
|
74
|
+
Components::Inline::ConceptElement => ->(el) {
|
|
75
|
+
attrs = {
|
|
76
|
+
refterm: Mirror::SafeAttr.read(el, :refterm),
|
|
77
|
+
renderterm: Mirror::SafeAttr.read(el, :renderterm),
|
|
78
|
+
}.compact
|
|
79
|
+
Mirror::Handlers.build_mark("concept", attrs: attrs)
|
|
80
|
+
},
|
|
81
|
+
Components::Inline::SpanElement => ->(el) {
|
|
82
|
+
attrs = {
|
|
83
|
+
class_attr: Mirror::SafeAttr.read(el, :class_attr),
|
|
84
|
+
style: Mirror::SafeAttr.read(el, :style),
|
|
85
|
+
}.compact
|
|
86
|
+
Mirror::Handlers.build_mark("span", attrs: attrs)
|
|
87
|
+
},
|
|
88
|
+
Components::TextElements::RubyElement => ->(el) {
|
|
89
|
+
pron = Mirror::SafeAttr.read(el, :pronunciation)
|
|
90
|
+
ann = Mirror::SafeAttr.read(el, :annotation)
|
|
91
|
+
attrs = {
|
|
92
|
+
pronunciation: pron && Mirror::SafeAttr.read(pron, :value),
|
|
93
|
+
annotation: ann && Mirror::SafeAttr.read(ann, :value),
|
|
94
|
+
ruby_text: Array(Mirror::SafeAttr.read(el, :ruby_text)).join,
|
|
95
|
+
}.compact
|
|
96
|
+
Mirror::Handlers.build_mark("ruby", attrs: attrs)
|
|
97
|
+
},
|
|
98
|
+
}.freeze
|
|
99
|
+
|
|
100
|
+
SIMPLE_MARK_TYPES = {
|
|
101
|
+
Components::Inline::EmRawElement => "emphasis",
|
|
102
|
+
Components::Inline::StrongRawElement => "strong",
|
|
103
|
+
Components::Inline::SubElement => "subscript",
|
|
104
|
+
Components::Inline::SupElement => "superscript",
|
|
105
|
+
Components::Inline::TtElement => "code",
|
|
106
|
+
Components::TextElements::UnderlineElement => "underline",
|
|
107
|
+
Components::TextElements::StrikeElement => "strike",
|
|
108
|
+
Components::Inline::SmallCapElement => "smallcap",
|
|
109
|
+
Components::Inline::Bcp14Element => "bcp14",
|
|
110
|
+
Components::Inline::ConceptElement => "concept",
|
|
111
|
+
}.freeze
|
|
112
|
+
|
|
113
|
+
RICH_RENDERERS = {
|
|
114
|
+
Components::Inline::StemInlineElement => ->(el) {
|
|
115
|
+
Renderer.for_stem(el)
|
|
116
|
+
},
|
|
117
|
+
Components::TextElements::StemElement => ->(el) {
|
|
118
|
+
Renderer.for_stem(el)
|
|
119
|
+
},
|
|
120
|
+
Components::Inline::XrefElement => ->(el) {
|
|
121
|
+
Renderer.for_xref(el)
|
|
122
|
+
},
|
|
123
|
+
Components::Inline::LinkElement => ->(el) {
|
|
124
|
+
Renderer.for_link(el)
|
|
125
|
+
},
|
|
126
|
+
Components::Inline::ErefElement => ->(el) {
|
|
127
|
+
Renderer.for_eref(el)
|
|
128
|
+
},
|
|
129
|
+
Components::Inline::FnElement => ->(el) {
|
|
130
|
+
Renderer.for_fn(el)
|
|
131
|
+
},
|
|
132
|
+
Components::Inline::SpanElement => ->(el) {
|
|
133
|
+
Renderer.for_span(el)
|
|
134
|
+
},
|
|
135
|
+
Components::Inline::BrElement => ->(_el) {
|
|
136
|
+
Renderer.wrap(&:br)
|
|
137
|
+
},
|
|
138
|
+
}.freeze
|
|
139
|
+
|
|
140
|
+
Renderer = Mirror::Handlers::Inline::RichHtmlRenderer
|
|
141
|
+
|
|
142
|
+
POSITIONAL_CATEGORIES = {
|
|
143
|
+
Components::AncillaryBlocks::FigureBlock => :figure,
|
|
144
|
+
Components::Tables::TableBlock => :table,
|
|
145
|
+
}.freeze
|
|
146
|
+
|
|
147
|
+
class << self
|
|
148
|
+
def register
|
|
149
|
+
register_handler_hook
|
|
150
|
+
register_tables
|
|
151
|
+
register_iterator
|
|
152
|
+
register_positional_categories
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
private
|
|
156
|
+
|
|
157
|
+
def register_handler_hook
|
|
158
|
+
Mirror.register_default do |registry|
|
|
159
|
+
registry.register(
|
|
160
|
+
Components::Paragraphs::ParagraphBlock,
|
|
161
|
+
Mirror::Handlers::Paragraph,
|
|
162
|
+
)
|
|
163
|
+
registry.register(
|
|
164
|
+
Components::Blocks::NoteBlock, Mirror::Handlers::Note
|
|
165
|
+
)
|
|
166
|
+
registry.register(
|
|
167
|
+
Components::MultiParagraph::AdmonitionBlock,
|
|
168
|
+
Mirror::Handlers::Admonition,
|
|
169
|
+
)
|
|
170
|
+
registry.register(
|
|
171
|
+
Components::AncillaryBlocks::ExampleBlock,
|
|
172
|
+
Mirror::Handlers::Example,
|
|
173
|
+
)
|
|
174
|
+
registry.register(
|
|
175
|
+
Components::AncillaryBlocks::FigureBlock,
|
|
176
|
+
Mirror::Handlers::Figure,
|
|
177
|
+
)
|
|
178
|
+
registry.register(
|
|
179
|
+
Components::AncillaryBlocks::SvgmapElement,
|
|
180
|
+
Mirror::Handlers::Svgmap,
|
|
181
|
+
)
|
|
182
|
+
registry.register(
|
|
183
|
+
Components::AncillaryBlocks::ImagemapElement,
|
|
184
|
+
Mirror::Handlers::Imagemap,
|
|
185
|
+
)
|
|
186
|
+
registry.register(
|
|
187
|
+
Components::AncillaryBlocks::SourcecodeBlock,
|
|
188
|
+
Mirror::Handlers::Sourcecode,
|
|
189
|
+
)
|
|
190
|
+
registry.register(
|
|
191
|
+
Components::AncillaryBlocks::FormulaBlock,
|
|
192
|
+
Mirror::Handlers::Formula,
|
|
193
|
+
)
|
|
194
|
+
registry.register(
|
|
195
|
+
Components::MultiParagraph::QuoteBlock,
|
|
196
|
+
Mirror::Handlers::Quote,
|
|
197
|
+
)
|
|
198
|
+
registry.register(
|
|
199
|
+
Components::Tables::TableBlock, Mirror::Handlers::Table
|
|
200
|
+
)
|
|
201
|
+
registry.register(
|
|
202
|
+
Components::MultiParagraph::ReviewBlock,
|
|
203
|
+
Mirror::Handlers::Review,
|
|
204
|
+
)
|
|
205
|
+
registry.register(
|
|
206
|
+
Components::Lists::UnorderedList,
|
|
207
|
+
Mirror::Handlers::List, method_name: :bullet
|
|
208
|
+
)
|
|
209
|
+
registry.register(
|
|
210
|
+
Components::Lists::OrderedList,
|
|
211
|
+
Mirror::Handlers::List, method_name: :ordered
|
|
212
|
+
)
|
|
213
|
+
registry.register(
|
|
214
|
+
Components::Lists::DefinitionList,
|
|
215
|
+
Mirror::Handlers::List, method_name: :definition
|
|
216
|
+
)
|
|
217
|
+
registry.register(
|
|
218
|
+
Components::Lists::ListItem,
|
|
219
|
+
Mirror::Handlers::List, method_name: :list_item
|
|
220
|
+
)
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def register_tables
|
|
225
|
+
MARK_BUILDERS.each do |klass, builder|
|
|
226
|
+
Mirror.mark_builders.register(klass, builder)
|
|
227
|
+
end
|
|
228
|
+
SIMPLE_MARK_TYPES.each do |klass, mark|
|
|
229
|
+
Mirror.simple_inline_elements.register(klass, mark)
|
|
230
|
+
end
|
|
231
|
+
RICH_RENDERERS.each do |klass, renderer|
|
|
232
|
+
Mirror.rich_html_renderers.register(klass, renderer)
|
|
233
|
+
end
|
|
234
|
+
Mirror.inline_text_substitutions
|
|
235
|
+
.register(Components::Inline::TabElement, " ")
|
|
236
|
+
Mirror.inline_text_substitutions
|
|
237
|
+
.register(Components::Inline::BrElement, "\n")
|
|
238
|
+
Mirror.semx_elements.register(Components::Inline::SemxElement, true)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def register_iterator
|
|
242
|
+
Mirror.inline_content_iterator = Components::Inline::SemanticContent
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def register_positional_categories
|
|
246
|
+
POSITIONAL_CATEGORIES.each do |klass, category|
|
|
247
|
+
Mirror::IdStrategy::Positional.register_category(klass, category)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
module Metanorma
|
|
6
|
+
module Mko
|
|
7
|
+
# Collection export (MN 116 §collections): a metanorma
|
|
8
|
+
# collection.yml declares a document family (OIML R 60 parts,
|
|
9
|
+
# amendments, R 129/138/144). Every member document exports as its
|
|
10
|
+
# own bundle (the document bundle is the unit of truth); the
|
|
11
|
+
# collection adds one small bundle with the membership contract:
|
|
12
|
+
# collection.json and the cross-document part_of edges binding the
|
|
13
|
+
# members to the family. Member identity comes from each member's
|
|
14
|
+
# exported document.json — the collection yml's identifiers are
|
|
15
|
+
# reference labels only.
|
|
16
|
+
class Collection
|
|
17
|
+
Member = Struct.new(:fileref, :xml_path, :identifier,
|
|
18
|
+
:bundle_path, :result, :skipped,
|
|
19
|
+
keyword_init: true)
|
|
20
|
+
|
|
21
|
+
class Result
|
|
22
|
+
attr_reader :collection_bundle, :members
|
|
23
|
+
|
|
24
|
+
def initialize(collection_bundle:, members:)
|
|
25
|
+
@collection_bundle = collection_bundle
|
|
26
|
+
@members = members
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def skipped
|
|
30
|
+
members.select(&:skipped)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class << self
|
|
35
|
+
def export(yml, to:, assets_from: nil, zip: false)
|
|
36
|
+
new(yml, to: to, assets_from: assets_from, zip: zip).export
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def initialize(yml, to:, assets_from: nil, zip: false)
|
|
41
|
+
@yml = if yml.is_a?(Hash)
|
|
42
|
+
yml
|
|
43
|
+
elsif File.exist?(yml.to_s)
|
|
44
|
+
YAML.safe_load_file(yml)
|
|
45
|
+
else
|
|
46
|
+
YAML.safe_load(yml)
|
|
47
|
+
end
|
|
48
|
+
@base = File.exist?(yml.to_s) ? File.dirname(File.expand_path(yml.to_s)) : Dir.pwd
|
|
49
|
+
@to = to
|
|
50
|
+
@assets_from = assets_from
|
|
51
|
+
@zip = zip
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def export
|
|
55
|
+
members = docrefs.filter_map do |ref|
|
|
56
|
+
member = resolve_member(ref)
|
|
57
|
+
next member if member.skipped
|
|
58
|
+
|
|
59
|
+
export = Mko.export(
|
|
60
|
+
File.read(member.xml_path), to: @to,
|
|
61
|
+
presentation_xml: presentation_for(member.xml_path),
|
|
62
|
+
assets_from: @assets_from || File.dirname(member.xml_path)
|
|
63
|
+
)
|
|
64
|
+
member.bundle_path = export.path
|
|
65
|
+
member.result = export.result
|
|
66
|
+
member
|
|
67
|
+
end
|
|
68
|
+
Result.new(collection_bundle: write_collection_bundle(members),
|
|
69
|
+
members: members)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def docrefs
|
|
75
|
+
manifest = @yml["manifest"]
|
|
76
|
+
manifest = manifest.first if manifest.is_a?(Array)
|
|
77
|
+
Array(manifest.is_a?(Hash) ? manifest["docref"] : nil)
|
|
78
|
+
rescue StandardError
|
|
79
|
+
[]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# The yml points members at .adoc sources; the compiled semantic
|
|
83
|
+
# XML sits beside them. Direct .xml filerefs work too.
|
|
84
|
+
def resolve_member(ref)
|
|
85
|
+
fileref = ref["fileref"].to_s
|
|
86
|
+
xml = fileref.end_with?(".xml") ? fileref : fileref.sub(/\.adoc$/, ".xml")
|
|
87
|
+
path = File.expand_path(xml, @base)
|
|
88
|
+
if File.file?(path)
|
|
89
|
+
Member.new(fileref: fileref, xml_path: path,
|
|
90
|
+
identifier: ref["identifier"])
|
|
91
|
+
else
|
|
92
|
+
Member.new(fileref: fileref, xml_path: path,
|
|
93
|
+
identifier: ref["identifier"], skipped: true)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def presentation_for(xml_path)
|
|
98
|
+
pres = xml_path.sub(/\.xml$/, ".presentation.xml")
|
|
99
|
+
File.file?(pres) ? File.read(pres) : nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def canonical
|
|
103
|
+
docid = @yml.dig("bibdata", "docid")
|
|
104
|
+
docid = docid.first if docid.is_a?(Array)
|
|
105
|
+
docid.is_a?(Hash) ? docid["id"].to_s : docid.to_s
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def title
|
|
109
|
+
t = @yml.dig("bibdata", "title")
|
|
110
|
+
t = t.first if t.is_a?(Array)
|
|
111
|
+
t.is_a?(Hash) ? t["content"].to_s : t.to_s
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def collection_short
|
|
115
|
+
Mko.slug(canonical.empty? ? "collection" : canonical)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Member identity from the export's own Result — the same truth
|
|
119
|
+
# the bundle was written from, never a read-back of our output.
|
|
120
|
+
def member_data(member)
|
|
121
|
+
document = member.result.document
|
|
122
|
+
{ "bundle" => "#{document.ids.short}.mko",
|
|
123
|
+
"docidentifier" => document.ids.canonical,
|
|
124
|
+
"identifier" => member.identifier,
|
|
125
|
+
"title" => document.titles.first&.text,
|
|
126
|
+
"edition" => document.edition }
|
|
127
|
+
rescue StandardError
|
|
128
|
+
nil
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def collection_member(member)
|
|
132
|
+
data = member_data(member) or return nil
|
|
133
|
+
|
|
134
|
+
Schema::CollectionMember.new(
|
|
135
|
+
bundle: data["bundle"], docidentifier: data["docidentifier"],
|
|
136
|
+
identifier: data["identifier"], title: data["title"],
|
|
137
|
+
edition: data["edition"]
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def write_collection_bundle(members)
|
|
142
|
+
collection = Schema::Collection.new(
|
|
143
|
+
canonical: canonical, short: collection_short, title: title,
|
|
144
|
+
edition: @yml.dig("bibdata", "edition"),
|
|
145
|
+
members: members.filter_map { |m| collection_member(m) }
|
|
146
|
+
)
|
|
147
|
+
# A member whose identity collides with the family (e.g. a
|
|
148
|
+
# stale amendment bibdata — mn-samples-oiml#66) would emit a
|
|
149
|
+
# self-edge; skip those, they say nothing.
|
|
150
|
+
edges = collection.members.reject do |m|
|
|
151
|
+
m.docidentifier.to_s.empty? || m.docidentifier == collection.canonical
|
|
152
|
+
end.map do |m|
|
|
153
|
+
{ "from" => "doc:#{m.docidentifier}",
|
|
154
|
+
"to" => "doc:#{collection.canonical}",
|
|
155
|
+
"kind" => "part_of" }
|
|
156
|
+
end
|
|
157
|
+
bundle = Bundle.open(collection_short, @to)
|
|
158
|
+
bundle.flavor = nil
|
|
159
|
+
bundle.add_json("collection", "collection.json", collection)
|
|
160
|
+
bundle.add_lines("edges", "edges.jsonl", edges) do |edge|
|
|
161
|
+
JSON.generate(edge)
|
|
162
|
+
end
|
|
163
|
+
bundle.write_manifest
|
|
164
|
+
@zip ? bundle.zip! : bundle.dir
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Mko
|
|
5
|
+
# Registry-facing exporter: quacks like a renderer (generate_full_document)
|
|
6
|
+
# so the Core::Flavors format table and the compile pipeline can select
|
|
7
|
+
# mko like any output format.
|
|
8
|
+
class Exporter
|
|
9
|
+
def generate_full_document(document, **options)
|
|
10
|
+
output = options[:output] || options[:output_filename] || "."
|
|
11
|
+
to = File.directory?(output) ? output : File.dirname(output)
|
|
12
|
+
Mko.export(document, to: to,
|
|
13
|
+
presentation_xml: options[:presentation_xml])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|