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
|
@@ -2,22 +2,151 @@
|
|
|
2
2
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module Html
|
|
5
|
+
# Renders BipmDocument components to HTML.
|
|
6
|
+
# Extends IsoRenderer with BIPM-specific branding (institutional navy, scientific precision).
|
|
5
7
|
class BipmRenderer < IsoRenderer
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
def flavor_publishers(_doc_id)
|
|
9
|
+
["BIPM"]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def flavor_publisher_name
|
|
13
|
+
"BIPM"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def publisher_logo_map
|
|
17
|
+
{ "BIPM" => "bipm-logo.svg" }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Strip redundant publisher prefix from doc identifiers.
|
|
21
|
+
# XML has "BIPM BIPM-2015/02" but we already show the BIPM logo.
|
|
22
|
+
def clean_doc_id(raw_id)
|
|
23
|
+
raw_id.to_s.gsub(/\ABIPM\s+/, "").strip
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# BIPM logo: white fill for dark header
|
|
27
|
+
def load_logo_svg(filename, **opts)
|
|
28
|
+
svg = super
|
|
29
|
+
svg = svg.gsub("fill:#0f3c80", "fill:white") if svg
|
|
30
|
+
svg
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Strip BIPM prefix from doc IDs shown in header
|
|
34
|
+
def extract_primary_doc_id
|
|
35
|
+
raw = super
|
|
36
|
+
clean_doc_id(raw)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Override cover page to show clean doc ID (without redundant "BIPM " prefix)
|
|
40
|
+
def render_coverpage(doc)
|
|
41
|
+
bibdata = doc.bibdata
|
|
42
|
+
return unless bibdata
|
|
43
|
+
|
|
44
|
+
@output << "<div class=\"title-section\">"
|
|
45
|
+
@output << "<div class=\"cover-grid\">"
|
|
46
|
+
@output << "<div class=\"cover-meta\">"
|
|
47
|
+
|
|
48
|
+
# Publisher logos
|
|
49
|
+
logos = publisher_logos_html(doc)
|
|
50
|
+
if logos && !logos.empty?
|
|
51
|
+
@output << "<div class=\"cover-publishers\">"
|
|
52
|
+
logos.each do |svg|
|
|
53
|
+
@output << "<span class=\"cover-logo\">#{svg}</span>"
|
|
54
|
+
end
|
|
55
|
+
@output << "</div>"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
identifiers = Array(bibdata.doc_identifier).compact
|
|
59
|
+
cover_ids = identifiers.select do |di|
|
|
60
|
+
safe_attr(di, :type) == "iso-reference"
|
|
61
|
+
end
|
|
62
|
+
cover_ids = [identifiers.first].compact if cover_ids.empty?
|
|
63
|
+
|
|
64
|
+
cover_ids.each do |di|
|
|
65
|
+
id = clean_doc_id(extract_text_value(di))
|
|
66
|
+
next if id.to_s.empty?
|
|
67
|
+
|
|
68
|
+
@output << "<p class=\"cover-doc-id\">#{escape_html(id)}</p>"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
bibdata.date&.each do |date|
|
|
72
|
+
date_type = extract_text_value(safe_attr(date,
|
|
73
|
+
:type_attr) || safe_attr(
|
|
74
|
+
date, :type
|
|
75
|
+
))
|
|
76
|
+
date_val = extract_text_value(date.is_a?(Metanorma::Document::Relaton::BibliographicDate) ? date.on : safe_attr(
|
|
77
|
+
date, :text
|
|
78
|
+
))
|
|
79
|
+
if date_type == "published" && date_val
|
|
80
|
+
@output << "<p class=\"cover-date\">#{escape_html(date_val)}</p>"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
@output << "</div>"
|
|
85
|
+
@output << "<div class=\"cover-body\">"
|
|
86
|
+
|
|
87
|
+
title_text = extract_display_title(bibdata)
|
|
88
|
+
if title_text && !title_text.empty?
|
|
89
|
+
@output << "<div class=\"cover-title\"><span>#{escape_html(title_text)}</span></div>"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if bibdata.status&.stage
|
|
93
|
+
stages = Array(bibdata.status.stage)
|
|
94
|
+
stage_text = stages.map { |s| Array(s.value).join }.join(" ")
|
|
95
|
+
unless stage_text.empty?
|
|
96
|
+
@output << "<div class=\"cover-stage\"><p>#{escape_html(stage_text)}</p></div>"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
@output << "</div>"
|
|
101
|
+
@output << "</div>"
|
|
102
|
+
@output << "</div><hr class=\"cover-separator\" />"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def theme
|
|
106
|
+
@theme ||= Theme.new.tap do |t|
|
|
107
|
+
t.primary = "#0f3c80"
|
|
108
|
+
t.accent = "#3d7ec7"
|
|
109
|
+
t.accent_deep = "#1a5a9e"
|
|
110
|
+
t.gradient = "linear-gradient(135deg, #082247 0%, #0f3c80 50%, #1a5a9e 100%)"
|
|
111
|
+
t.primary_light = "#edf1f7"
|
|
112
|
+
t.accent_light = "#e8f0fa"
|
|
113
|
+
t.warm = "#7a6952"
|
|
114
|
+
t.warm_light = "#f5f0e8"
|
|
115
|
+
t.sidebar_bg = "#f4f6fa"
|
|
116
|
+
t.font_body = '"Crimson Pro", "Georgia", "Times New Roman", serif'
|
|
117
|
+
t.font_sans = '"IBM Plex Sans", "Helvetica Neue", Arial, sans-serif'
|
|
118
|
+
t.font_mono = '"IBM Plex Mono", "Fira Code", "Courier New", monospace'
|
|
119
|
+
t.font_url = "https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap"
|
|
120
|
+
t.header_background = "linear-gradient(135deg, #082247 0%, #0f3c80 50%, #1a5a9e 100%)"
|
|
121
|
+
t.cover_background = "linear-gradient(175deg, #04122a 0%, #0a2e5c 25%, #0f3c80 55%, #1a5a9e 80%, #3d7ec7 100%)"
|
|
122
|
+
t.cover_before_bg = "background: radial-gradient(ellipse at 25% 15%, rgba(61,126,199,0.15) 0%, transparent 50%), radial-gradient(ellipse at 75% 85%, rgba(15,60,128,0.18) 0%, transparent 40%), radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%)"
|
|
123
|
+
t.cover_after_bg = "height: 3px; background: linear-gradient(90deg, transparent, #3d7ec7 20%, #0f3c80 50%, #3d7ec7 80%, transparent)"
|
|
124
|
+
t.progress_bar_color = "#3d7ec7"
|
|
125
|
+
t.note_border = "#3d7ec7"
|
|
126
|
+
t.note_bg = "#edf1f7"
|
|
127
|
+
t.note_color = "#3d7ec7"
|
|
128
|
+
t.example_border = "#0f3c80"
|
|
129
|
+
t.example_bg = "#f5f0e8"
|
|
130
|
+
t.example_color = "#7a6952"
|
|
131
|
+
t.admonition_border = "#7a6952"
|
|
132
|
+
t.admonition_bg = "#f5f0e8"
|
|
133
|
+
t.admonition_color = "#7a6952"
|
|
134
|
+
t.footer_border_color = "#3d7ec7"
|
|
135
|
+
t.cover_separator_color = "rgba(61,126,199,0.25)"
|
|
136
|
+
t.dark_note_bg = "#0d1520"
|
|
137
|
+
t.dark_example_bg = "#14100e"
|
|
138
|
+
t.dark_admonition_bg = "#141210"
|
|
139
|
+
t.extra_css = <<~CSS
|
|
140
|
+
.sourcecode pre { background: #0a1628; border-color: #1a2d4a; }
|
|
141
|
+
.reading-progress { box-shadow: 0 0 10px rgba(61,126,199,0.4); }
|
|
142
|
+
mark.search-match { background: #edf1f7; box-shadow: 0 0 0 1px rgba(15,60,128,0.25); }
|
|
143
|
+
mark.search-match.search-current { background: #3d7ec7; color: #fff; }
|
|
144
|
+
[data-theme="dark"] .sourcecode pre { background: #060a14; border-color: #1a2040; }
|
|
145
|
+
[data-theme="dark"] mark.search-match { background: #0d1a30; box-shadow: 0 0 0 1px rgba(61,126,199,0.4); }
|
|
146
|
+
[data-theme="dark"] mark.search-match.search-current { background: #1a5a9e; }
|
|
147
|
+
CSS
|
|
148
|
+
end
|
|
149
|
+
end
|
|
21
150
|
end
|
|
22
151
|
end
|
|
23
152
|
end
|
|
@@ -2,8 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module Html
|
|
5
|
+
# Renders CcDocument (CalConnect) components to HTML.
|
|
6
|
+
# Extends IsoRenderer with CalConnect branding.
|
|
5
7
|
class CcRenderer < IsoRenderer
|
|
6
|
-
|
|
8
|
+
def flavor_publishers(_doc_id)
|
|
9
|
+
["CalConnect"]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def flavor_publisher_name
|
|
13
|
+
"CalConnect"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def publisher_logo_map
|
|
17
|
+
{}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def theme
|
|
21
|
+
@theme ||= Theme.new.tap do |t|
|
|
22
|
+
t.font_body = '"Lora", "Georgia", serif'
|
|
23
|
+
t.font_sans = '"Karla", "Helvetica Neue", Arial, sans-serif'
|
|
24
|
+
t.font_mono = '"JetBrains Mono", "Fira Code", monospace'
|
|
25
|
+
t.font_url = "https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Karla:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
26
|
+
t.primary = "#003d7c"
|
|
27
|
+
t.accent = "#0078d4"
|
|
28
|
+
t.accent_deep = "#005fa3"
|
|
29
|
+
t.gradient = "linear-gradient(135deg, #002244 0%, #003d7c 50%, #0078d4 100%)"
|
|
30
|
+
t.primary_light = "#edf3fa"
|
|
31
|
+
t.accent_light = "#e0effc"
|
|
32
|
+
t.warm = "#c9982e"
|
|
33
|
+
t.warm_light = "#fdf8ec"
|
|
34
|
+
t.header_background = "linear-gradient(135deg, #002244 0%, #003d7c 50%, #0078d4 100%)"
|
|
35
|
+
t.cover_background = "linear-gradient(175deg, #001a33 0%, #003d7c 40%, #0078d4 80%, #0092d6 100%)"
|
|
36
|
+
t.cover_before_bg = "background: radial-gradient(ellipse at 25% 15%, rgba(0,120,212,0.2) 0%, transparent 50%), radial-gradient(ellipse at 75% 85%, rgba(201,152,46,0.15) 0%, transparent 40%)"
|
|
37
|
+
t.cover_after_bg = "height: 3px; background: linear-gradient(90deg, transparent, #c9982e, transparent)"
|
|
38
|
+
t.progress_bar_color = "#0078d4"
|
|
39
|
+
t.note_border = "#0078d4"
|
|
40
|
+
t.note_bg = "#e0effc"
|
|
41
|
+
t.note_color = "#0078d4"
|
|
42
|
+
t.example_border = "#003d7c"
|
|
43
|
+
t.example_bg = "#edf3fa"
|
|
44
|
+
t.example_color = "#003d7c"
|
|
45
|
+
t.admonition_border = "#c9982e"
|
|
46
|
+
t.admonition_color = "#c9982e"
|
|
47
|
+
t.footer_border_color = "#0078d4"
|
|
48
|
+
t.cover_separator_color = "rgba(0,120,212,0.25)"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
7
51
|
end
|
|
8
52
|
end
|
|
9
53
|
end
|
|
@@ -38,6 +38,11 @@ module Metanorma
|
|
|
38
38
|
raise NotImplementedError, "#{self.class}#render not implemented"
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def output
|
|
42
|
+
renderer.instance_variable_get(:@output)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def tag(...) = renderer.tag(...)
|
|
41
46
|
def escape_html(...) = renderer.escape_html(...)
|
|
42
47
|
def render_mixed_inline(...) = renderer.render_mixed_inline(...)
|
|
43
48
|
def render_mixed_content_in_order(...) = renderer.render_mixed_content_in_order(...)
|
|
@@ -45,9 +50,9 @@ module Metanorma
|
|
|
45
50
|
def safe_attr(obj, method_name) = renderer.safe_attr(obj, method_name)
|
|
46
51
|
def extract_plain_text(node) = renderer.extract_plain_text(node)
|
|
47
52
|
def extract_text_value(val) = renderer.extract_text_value(val)
|
|
48
|
-
def render_liquid(...) = renderer.render_liquid(...)
|
|
49
53
|
|
|
50
|
-
def extract_block_label(block,
|
|
54
|
+
def extract_block_label(block,
|
|
55
|
+
default)
|
|
51
56
|
renderer.extract_block_label(block, default)
|
|
52
57
|
end
|
|
53
58
|
|
|
@@ -7,28 +7,24 @@ module Metanorma
|
|
|
7
7
|
def render(collector, **_opts)
|
|
8
8
|
return if collector.nil? || collector.empty?
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
output << tag(:div,
|
|
11
|
+
%( id="index" class="index-section" data-component="index")) do
|
|
12
|
+
html = tag(:h2) { "Index" }
|
|
13
|
+
html << render_quicknav(collector.sorted_groups)
|
|
14
|
+
html << render_letter_groups(collector.sorted_groups)
|
|
15
|
+
html
|
|
16
|
+
end
|
|
17
17
|
|
|
18
18
|
renderer.register_toc_entry(id: "index", level: 1, text: "Index")
|
|
19
|
-
index_html
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
private
|
|
23
22
|
|
|
24
23
|
def render_quicknav(groups)
|
|
25
24
|
links = groups.filter_map do |g|
|
|
26
|
-
|
|
27
|
-
render_liquid("_link.html.liquid",
|
|
28
|
-
"attrs" => %( href="#index-letter-#{letter}"), "display_text" => letter)
|
|
25
|
+
%(<a href="#index-letter-#{escape_html(g.letter)}">#{escape_html(g.letter)}</a>)
|
|
29
26
|
end.join
|
|
30
|
-
|
|
31
|
-
"extra_attrs" => " class=\"index-quicknav\"", "content" => links)
|
|
27
|
+
%(<div class="index-quicknav">#{links}</div>)
|
|
32
28
|
end
|
|
33
29
|
|
|
34
30
|
def render_letter_groups(groups)
|
|
@@ -36,48 +32,54 @@ module Metanorma
|
|
|
36
32
|
end
|
|
37
33
|
|
|
38
34
|
def render_letter_group(group)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
tag(:div,
|
|
36
|
+
%( class="index-letter-group" id="index-letter-#{escape_html(group.letter)}")) do
|
|
37
|
+
html = tag(:h3, %( class="index-letter")) { group.letter }
|
|
38
|
+
html << group.entries.map { |e| render_entry(e, "primary") }.join
|
|
39
|
+
html
|
|
40
|
+
end
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
def render_entry(entry, level)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
tag(:div, %( class="index-entry index-entry--#{level}")) do
|
|
45
|
+
html = +""
|
|
46
|
+
html << tag(:span, %( class="index-term")) do
|
|
47
|
+
escape_html(entry.term)
|
|
48
|
+
end
|
|
49
|
+
html << render_locators(entry.locators)
|
|
50
|
+
html << render_see(entry.see) if entry.see
|
|
51
|
+
html << render_see_also(entry.see_also_entries) unless entry.see_also_entries.empty?
|
|
52
|
+
unless entry.children.empty?
|
|
53
|
+
html << entry.children.map { |c|
|
|
54
|
+
render_entry(c, next_level(level))
|
|
55
|
+
}.join
|
|
56
|
+
end
|
|
57
|
+
html
|
|
58
58
|
end
|
|
59
|
-
render_liquid("_element.html.liquid", "tag" => "div",
|
|
60
|
-
"extra_attrs" => %( class="index-entry index-entry--#{level}"), "content" => inner)
|
|
61
59
|
end
|
|
62
60
|
|
|
63
61
|
def render_locators(locators)
|
|
64
62
|
links = locators.map do |loc|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
tag(:a, %( href="##{escape_html(loc.id)}")) do
|
|
64
|
+
escape_html(loc.text)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
tag(:span, %( class="index-locator")) { links.join(", ") }
|
|
70
68
|
end
|
|
71
69
|
|
|
72
70
|
def render_see(term)
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
tag(:div, %( class="index-see")) do
|
|
72
|
+
"<em>see</em> #{escape_html(term)}"
|
|
73
|
+
end
|
|
75
74
|
end
|
|
76
75
|
|
|
77
76
|
def render_see_also(terms)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
tag(:div,
|
|
78
|
+
%( class="index-see-also")) do
|
|
79
|
+
"<em>see also</em> #{terms.map do |t|
|
|
80
|
+
escape_html(t)
|
|
81
|
+
end.join(', ')}"
|
|
82
|
+
end
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
def next_level(level)
|
|
@@ -8,7 +8,10 @@ module Metanorma
|
|
|
8
8
|
type = renderer.safe_attr(admonition, :type) || "note"
|
|
9
9
|
id = renderer.safe_attr(admonition, :id)
|
|
10
10
|
|
|
11
|
-
content_html = renderer.
|
|
11
|
+
content_html = renderer.capture_output do
|
|
12
|
+
renderer.render_block_children(admonition,
|
|
13
|
+
children: BaseRenderer::SIMPLE_CHILDREN)
|
|
14
|
+
end
|
|
12
15
|
|
|
13
16
|
new(
|
|
14
17
|
id: id,
|
|
@@ -6,13 +6,8 @@ module Metanorma
|
|
|
6
6
|
class BlockElementDrop < Liquid::Drop
|
|
7
7
|
attr_reader :id, :type, :label_html, :content_html, :css_class
|
|
8
8
|
|
|
9
|
-
def initialize(
|
|
10
|
-
|
|
11
|
-
@id = id
|
|
12
|
-
@type = type
|
|
13
|
-
@label_html = label_html
|
|
14
|
-
@content_html = content_html
|
|
15
|
-
@css_class = css_class
|
|
9
|
+
def initialize(attrs = {})
|
|
10
|
+
attrs.each { |k, v| instance_variable_set(:"@#{k}", v) }
|
|
16
11
|
end
|
|
17
12
|
|
|
18
13
|
# Subclasses override to build from model + RendererContext
|
|
@@ -8,7 +8,10 @@ module Metanorma
|
|
|
8
8
|
id = renderer.safe_attr(example, :id)
|
|
9
9
|
label = renderer.extract_block_label(example, "EXAMPLE")
|
|
10
10
|
|
|
11
|
-
content_html = renderer.
|
|
11
|
+
content_html = renderer.capture_output do
|
|
12
|
+
renderer.render_block_children(example,
|
|
13
|
+
children: BaseRenderer::BLOCK_CHILDREN)
|
|
14
|
+
end
|
|
12
15
|
|
|
13
16
|
new(
|
|
14
17
|
id: id,
|
|
@@ -6,16 +6,6 @@ module Metanorma
|
|
|
6
6
|
class FigureDrop < BlockElementDrop
|
|
7
7
|
attr_reader :image_html, :caption_html, :key_html, :sub_figures_html
|
|
8
8
|
|
|
9
|
-
def initialize(id: nil, image_html: nil, caption_html: nil, key_html: nil,
|
|
10
|
-
sub_figures_html: nil, css_class: nil)
|
|
11
|
-
@id = id
|
|
12
|
-
@image_html = image_html
|
|
13
|
-
@caption_html = caption_html
|
|
14
|
-
@key_html = key_html
|
|
15
|
-
@sub_figures_html = sub_figures_html
|
|
16
|
-
@css_class = css_class
|
|
17
|
-
end
|
|
18
|
-
|
|
19
9
|
def self.from_model(figure, renderer:)
|
|
20
10
|
id = renderer.safe_attr(figure, :id)
|
|
21
11
|
fig_name = renderer.safe_attr(figure,
|
|
@@ -27,34 +17,35 @@ module Metanorma
|
|
|
27
17
|
text: renderer.extract_plain_text(fig_name))
|
|
28
18
|
end
|
|
29
19
|
|
|
30
|
-
image_html =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
image_html = renderer.capture_output do
|
|
21
|
+
if figure.image
|
|
22
|
+
renderer.render_image(figure.image)
|
|
23
|
+
elsif renderer.safe_attr(figure, :source)
|
|
24
|
+
src = renderer.safe_attr(figure, :source)
|
|
25
|
+
@output << %(<img src="#{renderer.escape_html(src)}" />)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
37
28
|
|
|
38
29
|
caption_html = if fig_name || renderer.safe_attr(figure, :name)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
renderer.capture_output do
|
|
31
|
+
el = renderer.safe_attr(figure,
|
|
32
|
+
:fmt_name) || figure.name
|
|
33
|
+
renderer.render_inline_element(el)
|
|
34
|
+
end
|
|
42
35
|
end
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
sub_figures_parts << (renderer.render_figure(sub) || "")
|
|
37
|
+
sub_figures_html = renderer.capture_output do
|
|
38
|
+
figure.figure&.each { |sub| renderer.render_figure(sub) }
|
|
47
39
|
end
|
|
48
|
-
sub_figures_html = sub_figures_parts.join
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
key_html = renderer.capture_output do
|
|
42
|
+
renderer.safe_attr(figure, :note)&.each do |n|
|
|
43
|
+
renderer.render_note(n)
|
|
44
|
+
end
|
|
45
|
+
renderer.safe_attr(figure, :dl)&.then do |dl|
|
|
46
|
+
renderer.render_definition_list(dl)
|
|
47
|
+
end
|
|
56
48
|
end
|
|
57
|
-
key_html = key_parts.join
|
|
58
49
|
|
|
59
50
|
new(
|
|
60
51
|
id: id,
|
|
@@ -4,74 +4,45 @@ module Metanorma
|
|
|
4
4
|
module Html
|
|
5
5
|
module Drops
|
|
6
6
|
class FormulaDrop < BlockElementDrop
|
|
7
|
-
attr_reader :stem_html, :where_html, :
|
|
8
|
-
|
|
9
|
-
def initialize(id: nil, stem_html: nil, where_html: nil, where_label: nil,
|
|
10
|
-
number_html: nil, css_class: nil)
|
|
11
|
-
@id = id
|
|
12
|
-
@stem_html = stem_html
|
|
13
|
-
@where_html = where_html
|
|
14
|
-
@where_label = where_label
|
|
15
|
-
@number_html = number_html
|
|
16
|
-
@css_class = css_class
|
|
17
|
-
end
|
|
7
|
+
attr_reader :stem_html, :where_html, :number_html
|
|
18
8
|
|
|
19
9
|
def self.from_model(formula, renderer:)
|
|
20
10
|
id = renderer.safe_attr(formula, :id)
|
|
21
11
|
|
|
22
|
-
stem_html =
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
where_parts = []
|
|
27
|
-
if formula.key
|
|
28
|
-
if formula.key.dl
|
|
29
|
-
where_parts << (renderer.render_definition_list(formula.key.dl) || "")
|
|
30
|
-
end
|
|
31
|
-
formula.key.p&.each do |para|
|
|
32
|
-
where_parts << (renderer.render_paragraph(para) || "")
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
formula.dl&.then do |dl|
|
|
36
|
-
where_parts << (renderer.render_definition_list(dl) || "")
|
|
12
|
+
stem_html = renderer.capture_output do
|
|
13
|
+
renderer.render_stem_content(formula.stem) if formula.stem
|
|
37
14
|
end
|
|
38
|
-
formula.p&.each do |para|
|
|
39
|
-
next if renderer.safe_attr(para, :keep_with_next)
|
|
40
15
|
|
|
41
|
-
|
|
16
|
+
where_html = renderer.capture_output do
|
|
17
|
+
if formula.key
|
|
18
|
+
if formula.key.dl
|
|
19
|
+
@output = renderer.capture_output {}
|
|
20
|
+
# "where" label rendered in template, just render the dl
|
|
21
|
+
renderer.render_definition_list(formula.key.dl)
|
|
22
|
+
end
|
|
23
|
+
formula.key.p&.each { |para| renderer.render_paragraph(para) }
|
|
24
|
+
end
|
|
25
|
+
formula.dl&.then { |dl| renderer.render_definition_list(dl) }
|
|
42
26
|
end
|
|
43
|
-
where_html = where_parts.join
|
|
44
|
-
|
|
45
|
-
needs_where_label = !formula.key.nil? || !formula.dl.nil? ||
|
|
46
|
-
has_where_paragraph?(formula, renderer)
|
|
47
27
|
|
|
48
28
|
name_el = renderer.safe_attr(formula,
|
|
49
29
|
:fmt_name) || renderer.safe_attr(
|
|
50
30
|
formula, :name
|
|
51
31
|
)
|
|
52
32
|
number_html = if name_el
|
|
53
|
-
renderer.
|
|
33
|
+
renderer.capture_output do
|
|
34
|
+
renderer.render_inline_element(name_el)
|
|
35
|
+
end
|
|
54
36
|
end
|
|
55
37
|
|
|
56
38
|
new(
|
|
57
39
|
id: id,
|
|
58
40
|
stem_html: stem_html,
|
|
59
41
|
where_html: where_html,
|
|
60
|
-
where_label: needs_where_label,
|
|
61
42
|
number_html: number_html,
|
|
62
43
|
css_class: "formula",
|
|
63
44
|
)
|
|
64
45
|
end
|
|
65
|
-
|
|
66
|
-
class << self
|
|
67
|
-
private
|
|
68
|
-
|
|
69
|
-
def has_where_paragraph?(formula, renderer)
|
|
70
|
-
Array(formula.p).any? do |para|
|
|
71
|
-
renderer.safe_attr(para, :keep_with_next)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
46
|
end
|
|
76
47
|
end
|
|
77
48
|
end
|
|
@@ -8,17 +8,15 @@ module Metanorma
|
|
|
8
8
|
id = renderer.safe_attr(note, :id)
|
|
9
9
|
label = renderer.extract_block_label(note, "NOTE")
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
content_html = renderer.capture_output do
|
|
12
|
+
if note.content && !note.content.empty?
|
|
13
|
+
note.content.each { |para| renderer.render_paragraph(para) }
|
|
14
|
+
else
|
|
15
|
+
renderer.render_mixed_inline(note)
|
|
15
16
|
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
content_parts << inline if inline
|
|
17
|
+
renderer.render_block_children(note,
|
|
18
|
+
children: BaseRenderer::NOTE_CHILDREN)
|
|
19
19
|
end
|
|
20
|
-
content_parts << (renderer.render_note_children(note) || "")
|
|
21
|
-
content_html = content_parts.join
|
|
22
20
|
|
|
23
21
|
new(
|
|
24
22
|
id: id,
|
|
@@ -6,27 +6,20 @@ module Metanorma
|
|
|
6
6
|
class SourcecodeDrop < BlockElementDrop
|
|
7
7
|
attr_reader :lang, :name_html, :code_html
|
|
8
8
|
|
|
9
|
-
def initialize(id: nil, lang: nil, name_html: nil, code_html: nil,
|
|
10
|
-
css_class: nil)
|
|
11
|
-
@id = id
|
|
12
|
-
@lang = lang
|
|
13
|
-
@name_html = name_html
|
|
14
|
-
@code_html = code_html
|
|
15
|
-
@css_class = css_class
|
|
16
|
-
end
|
|
17
|
-
|
|
18
9
|
def self.from_model(sc, renderer:)
|
|
19
10
|
id = renderer.safe_attr(sc, :id)
|
|
20
11
|
lang = renderer.safe_attr(sc, :lang)
|
|
21
12
|
|
|
22
13
|
name_html = if sc.name
|
|
23
|
-
renderer.
|
|
14
|
+
renderer.capture_output do
|
|
15
|
+
renderer.render_inline_element(sc.name)
|
|
16
|
+
end
|
|
24
17
|
end
|
|
25
18
|
|
|
26
19
|
code_text = if sc.body&.content
|
|
27
|
-
|
|
20
|
+
sc.body.content
|
|
28
21
|
elsif sc.content
|
|
29
|
-
|
|
22
|
+
sc.content
|
|
30
23
|
else
|
|
31
24
|
""
|
|
32
25
|
end
|
data/lib/metanorma/html/drops.rb
CHANGED