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.
Files changed (391) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +21 -0
  3. data/.github/workflows/release.yml +25 -0
  4. data/.github/workflows/roundtrip-samples.yml +132 -0
  5. data/.gitignore +19 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +22 -0
  8. data/.rubocop_todo.yml +66 -164
  9. data/CHANGELOG.md +1 -0
  10. data/Gemfile +32 -0
  11. data/README.adoc +0 -144
  12. data/Rakefile +2 -14
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/data/javascripts/components/mn-lightbox.js +2 -18
  16. data/data/javascripts/components/mn-shortcuts.js +0 -2
  17. data/data/javascripts/core/mn-navigation.js +0 -8
  18. data/data/javascripts/core/mn-theme.js +9 -9
  19. data/data/logos/pdfa-logo.svg +94 -31
  20. data/data/stylesheets/base/_layout.css +0 -3
  21. data/data/stylesheets/base/_reset.css +3 -3
  22. data/data/stylesheets/base/_typography.css +5 -0
  23. data/data/stylesheets/components/bibliography.css +3 -3
  24. data/data/stylesheets/components/cover.css +1 -3
  25. data/data/stylesheets/components/figure.css +1 -13
  26. data/data/stylesheets/components/footnote.css +5 -65
  27. data/data/stylesheets/components/formula.css +0 -44
  28. data/data/stylesheets/components/header.css +2 -17
  29. data/data/stylesheets/components/inline.css +1 -1
  30. data/data/stylesheets/components/table.css +2 -15
  31. data/data/stylesheets/components/term.css +1 -0
  32. data/lib/metanorma/bipm_document/metadata/bipm_bibliographic_item.rb +14 -0
  33. data/lib/metanorma/bipm_document/metadata.rb +1 -1
  34. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +65 -0
  35. data/lib/metanorma/document/components/ancillary_blocks.rb +0 -4
  36. data/lib/metanorma/document/components/bib_data/bib_data.rb +0 -7
  37. data/lib/metanorma/document/components/blocks/requirement_model.rb +131 -0
  38. data/lib/metanorma/document/components/blocks.rb +7 -8
  39. data/lib/metanorma/document/components/id_elements/image.rb +0 -2
  40. data/lib/metanorma/document/components/inline/asciimath_element.rb +0 -2
  41. data/lib/metanorma/document/components/inline/attribution_element.rb +0 -2
  42. data/lib/metanorma/document/components/inline/bcp14_element.rb +0 -2
  43. data/lib/metanorma/document/components/inline/biblio_tag_element.rb +0 -2
  44. data/lib/metanorma/document/components/inline/br_element.rb +0 -2
  45. data/lib/metanorma/document/components/inline/comma_element.rb +0 -2
  46. data/lib/metanorma/document/components/inline/concept_element.rb +0 -2
  47. data/lib/metanorma/document/components/inline/display_text_element.rb +0 -2
  48. data/lib/metanorma/document/components/inline/em_raw_element.rb +0 -2
  49. data/lib/metanorma/document/components/inline/enum_comma_element.rb +0 -2
  50. data/lib/metanorma/document/components/inline/eref_element.rb +0 -2
  51. data/lib/metanorma/document/components/inline/fmt_admitted_element.rb +0 -4
  52. data/lib/metanorma/document/components/inline/fmt_annotation_body_element.rb +0 -4
  53. data/lib/metanorma/document/components/inline/fmt_annotation_end_element.rb +0 -4
  54. data/lib/metanorma/document/components/inline/fmt_annotation_start_element.rb +0 -4
  55. data/lib/metanorma/document/components/inline/fmt_concept_element.rb +0 -4
  56. data/lib/metanorma/document/components/inline/fmt_definition_element.rb +0 -4
  57. data/lib/metanorma/document/components/inline/fmt_fn_body_element.rb +0 -4
  58. data/lib/metanorma/document/components/inline/fmt_fn_label_element.rb +0 -4
  59. data/lib/metanorma/document/components/inline/fmt_footnote_container_element.rb +0 -4
  60. data/lib/metanorma/document/components/inline/fmt_identifier_element.rb +0 -4
  61. data/lib/metanorma/document/components/inline/fmt_name_element.rb +0 -4
  62. data/lib/metanorma/document/components/inline/fmt_preferred_element.rb +0 -4
  63. data/lib/metanorma/document/components/inline/fmt_sourcecode_element.rb +0 -4
  64. data/lib/metanorma/document/components/inline/fmt_stem_element.rb +0 -10
  65. data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +0 -4
  66. data/lib/metanorma/document/components/inline/fmt_title_element.rb +0 -4
  67. data/lib/metanorma/document/components/inline/fmt_xref_element.rb +0 -4
  68. data/lib/metanorma/document/components/inline/fmt_xref_label_element.rb +0 -4
  69. data/lib/metanorma/document/components/inline/fn_element.rb +0 -2
  70. data/lib/metanorma/document/components/inline/link_element.rb +0 -2
  71. data/lib/metanorma/document/components/inline/localized_string_element.rb +0 -2
  72. data/lib/metanorma/document/components/inline/localized_strings_element.rb +0 -2
  73. data/lib/metanorma/document/components/inline/math_element.rb +0 -2
  74. data/lib/metanorma/document/components/inline/name_with_id_element.rb +0 -4
  75. data/lib/metanorma/document/components/inline/semx_child_element.rb +0 -2
  76. data/lib/metanorma/document/components/inline/semx_element.rb +1 -13
  77. data/lib/metanorma/document/components/inline/small_cap_element.rb +0 -2
  78. data/lib/metanorma/document/components/inline/span_element.rb +15 -10
  79. data/lib/metanorma/document/components/inline/stem_inline_element.rb +1 -7
  80. data/lib/metanorma/document/components/inline/strong_raw_element.rb +0 -2
  81. data/lib/metanorma/document/components/inline/sub_element.rb +0 -2
  82. data/lib/metanorma/document/components/inline/sup_element.rb +0 -2
  83. data/lib/metanorma/document/components/inline/tab_element.rb +0 -2
  84. data/lib/metanorma/document/components/inline/title_with_annotation_element.rb +0 -4
  85. data/lib/metanorma/document/components/inline/tt_element.rb +0 -2
  86. data/lib/metanorma/document/components/inline/variant_title_element.rb +0 -2
  87. data/lib/metanorma/document/components/inline/xref_element.rb +0 -10
  88. data/lib/metanorma/document/components/inline.rb +0 -12
  89. data/lib/metanorma/document/components/multi_paragraph/quote_block.rb +29 -0
  90. data/lib/metanorma/document/components/multi_paragraph.rb +0 -2
  91. data/lib/metanorma/document/components/reference_elements/source_element.rb +31 -0
  92. data/lib/metanorma/document/components/reference_elements.rb +2 -2
  93. data/lib/metanorma/document/components/tables/table_block.rb +22 -0
  94. data/lib/metanorma/document/components/tables/table_section.rb +25 -0
  95. data/lib/metanorma/document/components/tables.rb +3 -5
  96. data/lib/metanorma/document/relaton/address.rb +27 -0
  97. data/lib/metanorma/document/relaton/bib_item_locality.rb +12 -3
  98. data/lib/metanorma/document/relaton/copyright_association.rb +10 -0
  99. data/lib/metanorma/document/relaton/edition.rb +7 -4
  100. data/lib/metanorma/document/relaton/organization.rb +14 -0
  101. data/lib/metanorma/document/relaton/phone.rb +9 -3
  102. data/lib/metanorma/document/relaton/place_type.rb +13 -0
  103. data/lib/metanorma/document/relaton/price_type.rb +9 -3
  104. data/lib/metanorma/document/relaton.rb +1 -6
  105. data/lib/metanorma/document/version.rb +1 -1
  106. data/lib/metanorma/document.rb +0 -2
  107. data/lib/metanorma/html/asset_pipeline.rb +0 -1
  108. data/lib/metanorma/html/base_renderer.rb +1008 -261
  109. data/lib/metanorma/html/bipm_renderer.rb +144 -15
  110. data/lib/metanorma/html/cc_renderer.rb +45 -1
  111. data/lib/metanorma/html/component/base.rb +7 -2
  112. data/lib/metanorma/html/component/index_section.rb +43 -41
  113. data/lib/metanorma/html/drops/admonition_drop.rb +4 -1
  114. data/lib/metanorma/html/drops/block_element_drop.rb +2 -7
  115. data/lib/metanorma/html/drops/example_drop.rb +4 -1
  116. data/lib/metanorma/html/drops/figure_drop.rb +22 -31
  117. data/lib/metanorma/html/drops/footnote_drop.rb +1 -1
  118. data/lib/metanorma/html/drops/formula_drop.rb +16 -45
  119. data/lib/metanorma/html/drops/note_drop.rb +7 -9
  120. data/lib/metanorma/html/drops/sourcecode_drop.rb +5 -12
  121. data/lib/metanorma/html/drops.rb +0 -2
  122. data/lib/metanorma/html/generator.rb +2 -2
  123. data/lib/metanorma/html/icc_renderer.rb +39 -0
  124. data/lib/metanorma/html/iec_renderer.rb +44 -1
  125. data/lib/metanorma/html/ieee_renderer.rb +45 -1
  126. data/lib/metanorma/html/ietf_renderer.rb +48 -1
  127. data/lib/metanorma/html/iho_renderer.rb +46 -1
  128. data/lib/metanorma/html/iso_renderer.rb +343 -290
  129. data/lib/metanorma/html/itu_renderer.rb +45 -1
  130. data/lib/metanorma/html/ogc_renderer.rb +76 -15
  131. data/lib/metanorma/html/oiml_renderer.rb +38 -18
  132. data/lib/metanorma/html/pdfa_renderer.rb +39 -0
  133. data/lib/metanorma/html/ribose_renderer.rb +45 -1
  134. data/lib/metanorma/html/standard_renderer.rb +229 -341
  135. data/lib/metanorma/html/templates/_footnotes.html.liquid +6 -6
  136. data/lib/metanorma/html/templates/_formula.html.liquid +1 -1
  137. data/lib/metanorma/html/templates/_header.html.liquid +1 -1
  138. data/lib/metanorma/html/templates/_iso_cover.html.liquid +1 -1
  139. data/lib/metanorma/html/templates/document.html.liquid +0 -4
  140. data/lib/metanorma/html/theme.rb +107 -180
  141. data/lib/metanorma/html.rb +3 -14
  142. data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +25 -0
  143. data/lib/metanorma/ietf_document/metadata.rb +0 -2
  144. data/lib/metanorma/iso_document/metadata/iso_bib_data_extension_type.rb +48 -0
  145. data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +72 -0
  146. data/lib/metanorma/iso_document/metadata/iso_document_status.rb +30 -0
  147. data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +1 -4
  148. data/lib/metanorma/iso_document/metadata/structured_identifier.rb +17 -0
  149. data/lib/metanorma/iso_document/metadata/title_collection.rb +0 -1
  150. data/lib/metanorma/iso_document/metadata.rb +4 -9
  151. data/lib/metanorma/iso_document/terms/iso_term.rb +13 -0
  152. data/lib/metanorma/iso_document/terms.rb +0 -1
  153. data/lib/metanorma/itu_document/metadata/itu_bib_data_extension_type.rb +37 -0
  154. data/lib/metanorma/itu_document/metadata.rb +4 -3
  155. data/lib/metanorma/standard_document/block_attributes.rb +9 -5
  156. data/lib/metanorma/standard_document/blocks/block_source.rb +23 -0
  157. data/lib/metanorma/standard_document/blocks.rb +1 -1
  158. data/lib/metanorma/standard_document/terms/term_expression.rb +31 -0
  159. data/lib/metanorma/standard_document/terms.rb +0 -1
  160. data/metanorma-document.gemspec +35 -0
  161. metadata +13 -262
  162. data/CLAUDE.md +0 -26
  163. data/TODO.finalize/01-split-multi-class-files.md +0 -8
  164. data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +0 -6
  165. data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +0 -11
  166. data/TODO.finalize/04-theme-per-flavor-config-driven.md +0 -9
  167. data/TODO.finalize/05-migrate-all-html-to-liquid.md +0 -16
  168. data/TODO.finalize/06-integrate-pubid-library.md +0 -16
  169. data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +0 -39
  170. data/TODO.finalize/08-refactor-renderer-architecture.md +0 -25
  171. data/TODO.finalize/09-eliminate-code-smells.md +0 -14
  172. data/TODO.finalize/10-comprehensive-spec-coverage.md +0 -24
  173. data/TODO.finalize/11-config-driven-flavor-metadata.md +0 -20
  174. data/TODO.finalize/12-add-frozen-string-literal.md +0 -6
  175. data/TODO.finalize/13-extract-composition-from-god-class.md +0 -96
  176. data/TODO.finalize/14-config-driven-section-ordering.md +0 -31
  177. data/TODO.finalize/15-theme-directories-per-flavor.md +0 -46
  178. data/TODO.finalize/16-theme-lutaml-model-schema.md +0 -44
  179. data/data/javascripts/components/mn-footnotes.js +0 -68
  180. data/data/logos/oiml-logo-full-dark.svg +0 -1
  181. data/data/logos/oiml-logo-full-light.svg +0 -1
  182. data/data/logos/oiml-logo-icon-dark.svg +0 -1
  183. data/data/logos/oiml-logo-icon-light.svg +0 -1
  184. data/data/logos/oiml-logo.svg +0 -1
  185. data/data/themes/bipm.yaml +0 -60
  186. data/data/themes/cc.yaml +0 -43
  187. data/data/themes/icc.yaml +0 -39
  188. data/data/themes/iec.yaml +0 -44
  189. data/data/themes/ieee.yaml +0 -43
  190. data/data/themes/ietf.yaml +0 -45
  191. data/data/themes/iho.yaml +0 -46
  192. data/data/themes/iso.yaml +0 -40
  193. data/data/themes/itu.yaml +0 -45
  194. data/data/themes/ogc.yaml +0 -51
  195. data/data/themes/oiml.yaml +0 -56
  196. data/data/themes/pdfa.yaml +0 -44
  197. data/data/themes/ribose.yaml +0 -43
  198. data/exe/metanorma-document +0 -11
  199. data/frontend/e2e/sample-html.test.ts +0 -256
  200. data/frontend/index.html +0 -12
  201. data/frontend/package-lock.json +0 -4725
  202. data/frontend/package.json +0 -32
  203. data/frontend/postcss.config.js +0 -6
  204. data/frontend/src/App.vue +0 -79
  205. data/frontend/src/app.ts +0 -21
  206. data/frontend/src/components/AppSidebar.vue +0 -77
  207. data/frontend/src/components/DocumentReader.vue +0 -180
  208. data/frontend/src/components/MirrorRenderer.vue +0 -23
  209. data/frontend/src/components/ReadingProgressBar.vue +0 -29
  210. data/frontend/src/components/TextRenderer.vue +0 -131
  211. data/frontend/src/components/TocItem.vue +0 -57
  212. data/frontend/src/components/TopBar.vue +0 -49
  213. data/frontend/src/components/__tests__/MirrorRenderer.test.ts +0 -178
  214. data/frontend/src/components/blocks/AdmonitionBlock.vue +0 -74
  215. data/frontend/src/components/blocks/ClauseBlock.vue +0 -53
  216. data/frontend/src/components/blocks/ExampleBlock.vue +0 -21
  217. data/frontend/src/components/blocks/FallbackBlock.vue +0 -18
  218. data/frontend/src/components/blocks/FigureBlock.vue +0 -26
  219. data/frontend/src/components/blocks/FootnotesBlock.vue +0 -25
  220. data/frontend/src/components/blocks/ListBlocks.vue +0 -62
  221. data/frontend/src/components/blocks/NoteBlock.vue +0 -21
  222. data/frontend/src/components/blocks/ParagraphBlock.vue +0 -25
  223. data/frontend/src/components/blocks/QuoteBlock.vue +0 -25
  224. data/frontend/src/components/blocks/ReviewBlock.vue +0 -39
  225. data/frontend/src/components/blocks/SourcecodeBlock.vue +0 -52
  226. data/frontend/src/components/blocks/TableBlock.vue +0 -48
  227. data/frontend/src/components/blocks/index.ts +0 -36
  228. data/frontend/src/stores/__tests__/documentStore.fixture.test.ts +0 -272
  229. data/frontend/src/stores/__tests__/documentStore.test.ts +0 -143
  230. data/frontend/src/stores/__tests__/ebookStore.test.ts +0 -145
  231. data/frontend/src/stores/__tests__/uiStore.test.ts +0 -42
  232. data/frontend/src/stores/documentStore.ts +0 -153
  233. data/frontend/src/stores/ebookStore.ts +0 -179
  234. data/frontend/src/stores/uiStore.ts +0 -32
  235. data/frontend/src/styles.css +0 -156
  236. data/frontend/src/types/__tests__/rendering-contract.test.ts +0 -172
  237. data/frontend/src/types/rendering-contract.ts +0 -209
  238. data/frontend/src/utils/__tests__/typeMetadata.test.ts +0 -102
  239. data/frontend/src/utils/typeMetadata.ts +0 -121
  240. data/frontend/tailwind.config.js +0 -18
  241. data/frontend/test/fixtures/iso-document.json +0 -271
  242. data/frontend/tmp/debug_e2e.cjs +0 -46
  243. data/frontend/tsconfig.json +0 -25
  244. data/frontend/tsconfig.node.json +0 -11
  245. data/frontend/vite.config.ts +0 -37
  246. data/frontend/vitest.e2e.config.ts +0 -9
  247. data/lib/metanorma/bipm_document/metadata/depiction_element.rb +0 -18
  248. data/lib/metanorma/document/cli.rb +0 -116
  249. data/lib/metanorma/document/components/ancillary_blocks/callout_annotation.rb +0 -27
  250. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +0 -18
  251. data/lib/metanorma/document/components/blocks/classification_value.rb +0 -21
  252. data/lib/metanorma/document/components/blocks/permission_model.rb +0 -28
  253. data/lib/metanorma/document/components/blocks/recommendation_model.rb +0 -28
  254. data/lib/metanorma/document/components/blocks/requirement_base.rb +0 -30
  255. data/lib/metanorma/document/components/blocks/requirement_classification.rb +0 -20
  256. data/lib/metanorma/document/components/blocks/requirement_description.rb +0 -43
  257. data/lib/metanorma/document/components/blocks/requirement_inherit.rb +0 -24
  258. data/lib/metanorma/document/components/inline/location_element.rb +0 -24
  259. data/lib/metanorma/document/components/inline/rendered_display.rb +0 -23
  260. data/lib/metanorma/document/components/inline/rendered_math_element.rb +0 -21
  261. data/lib/metanorma/document/components/inline/semantic_content.rb +0 -51
  262. data/lib/metanorma/document/components/inline/semantic_math_element.rb +0 -20
  263. data/lib/metanorma/document/components/inline/vocabulary.rb +0 -184
  264. data/lib/metanorma/document/components/multi_paragraph/quote_author_element.rb +0 -20
  265. data/lib/metanorma/document/components/reference_elements/source_modification.rb +0 -21
  266. data/lib/metanorma/document/components/reference_elements/source_origin.rb +0 -28
  267. data/lib/metanorma/document/components/tables/col_element.rb +0 -18
  268. data/lib/metanorma/document/components/tables/col_group_element.rb +0 -18
  269. data/lib/metanorma/document/components/tables/table_body_section.rb +0 -16
  270. data/lib/metanorma/document/components/tables/table_foot_section.rb +0 -16
  271. data/lib/metanorma/document/components/tables/table_head_section.rb +0 -16
  272. data/lib/metanorma/document/relaton/copyright_owner.rb +0 -16
  273. data/lib/metanorma/document/relaton/formatted_address.rb +0 -29
  274. data/lib/metanorma/document/relaton/logo_element.rb +0 -18
  275. data/lib/metanorma/document/relaton/region_element.rb +0 -18
  276. data/lib/metanorma/html/drops/biblio_entry_drop.rb +0 -50
  277. data/lib/metanorma/html/renderers/block_renderer.rb +0 -372
  278. data/lib/metanorma/html/renderers/inline_renderer.rb +0 -655
  279. data/lib/metanorma/html/renderers/pubid_renderer.rb +0 -69
  280. data/lib/metanorma/html/renderers/section_renderer.rb +0 -193
  281. data/lib/metanorma/html/renderers.rb +0 -8
  282. data/lib/metanorma/html/templates/_audio.html.liquid +0 -1
  283. data/lib/metanorma/html/templates/_biblio_entry.html.liquid +0 -1
  284. data/lib/metanorma/html/templates/_bipm_cover.html.liquid +0 -27
  285. data/lib/metanorma/html/templates/_boilerplate.html.liquid +0 -1
  286. data/lib/metanorma/html/templates/_bookmark.html.liquid +0 -1
  287. data/lib/metanorma/html/templates/_br.html.liquid +0 -1
  288. data/lib/metanorma/html/templates/_definition_list.html.liquid +0 -6
  289. data/lib/metanorma/html/templates/_element.html.liquid +0 -1
  290. data/lib/metanorma/html/templates/_fn_marker.html.liquid +0 -1
  291. data/lib/metanorma/html/templates/_heading.html.liquid +0 -1
  292. data/lib/metanorma/html/templates/_image.html.liquid +0 -1
  293. data/lib/metanorma/html/templates/_inline_span.html.liquid +0 -1
  294. data/lib/metanorma/html/templates/_link.html.liquid +0 -1
  295. data/lib/metanorma/html/templates/_list.html.liquid +0 -3
  296. data/lib/metanorma/html/templates/_list_item.html.liquid +0 -1
  297. data/lib/metanorma/html/templates/_main_content.html.liquid +0 -1
  298. data/lib/metanorma/html/templates/_math_container.html.liquid +0 -1
  299. data/lib/metanorma/html/templates/_paragraph.html.liquid +0 -1
  300. data/lib/metanorma/html/templates/_prefatory_section.html.liquid +0 -1
  301. data/lib/metanorma/html/templates/_pubid_identifier.html.liquid +0 -1
  302. data/lib/metanorma/html/templates/_quote.html.liquid +0 -4
  303. data/lib/metanorma/html/templates/_ref_date.html.liquid +0 -1
  304. data/lib/metanorma/html/templates/_ref_title.html.liquid +0 -1
  305. data/lib/metanorma/html/templates/_section.html.liquid +0 -5
  306. data/lib/metanorma/html/templates/_standard_cover.html.liquid +0 -31
  307. data/lib/metanorma/html/templates/_standard_doc_title.html.liquid +0 -3
  308. data/lib/metanorma/html/templates/_stem_span.html.liquid +0 -1
  309. data/lib/metanorma/html/templates/_table.html.liquid +0 -9
  310. data/lib/metanorma/html/templates/_term_domain.html.liquid +0 -1
  311. data/lib/metanorma/html/templates/_term_example.html.liquid +0 -1
  312. data/lib/metanorma/html/templates/_term_note.html.liquid +0 -1
  313. data/lib/metanorma/html/templates/_term_number.html.liquid +0 -1
  314. data/lib/metanorma/html/templates/_term_source.html.liquid +0 -1
  315. data/lib/metanorma/html/templates/_term_text_note.html.liquid +0 -1
  316. data/lib/metanorma/html/templates/_video.html.liquid +0 -1
  317. data/lib/metanorma/html/templates/_wrapped_preface.html.liquid +0 -1
  318. data/lib/metanorma/ietf_document/metadata/pi_settings.rb +0 -32
  319. data/lib/metanorma/iso_document/metadata/doctype_element.rb +0 -20
  320. data/lib/metanorma/iso_document/metadata/language_element.rb +0 -18
  321. data/lib/metanorma/iso_document/metadata/project_number.rb +0 -22
  322. data/lib/metanorma/iso_document/metadata/script_element.rb +0 -18
  323. data/lib/metanorma/iso_document/metadata/stage_element.rb +0 -26
  324. data/lib/metanorma/iso_document/metadata/stagename_element.rb +0 -18
  325. data/lib/metanorma/iso_document/terms/term_domain_element.rb +0 -18
  326. data/lib/metanorma/itu_document/metadata/meeting_date.rb +0 -18
  327. data/lib/metanorma/itu_document/metadata/meeting_element.rb +0 -18
  328. data/lib/metanorma/itu_document/metadata/study_period.rb +0 -18
  329. data/lib/metanorma/mirror/default_registry.rb +0 -170
  330. data/lib/metanorma/mirror/handler_registry.rb +0 -60
  331. data/lib/metanorma/mirror/handler_result.rb +0 -37
  332. data/lib/metanorma/mirror/handlers/admonition.rb +0 -18
  333. data/lib/metanorma/mirror/handlers/example.rb +0 -21
  334. data/lib/metanorma/mirror/handlers/figure.rb +0 -53
  335. data/lib/metanorma/mirror/handlers/formula.rb +0 -35
  336. data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +0 -159
  337. data/lib/metanorma/mirror/handlers/inline/text_extractor.rb +0 -116
  338. data/lib/metanorma/mirror/handlers/inline.rb +0 -225
  339. data/lib/metanorma/mirror/handlers/list.rb +0 -110
  340. data/lib/metanorma/mirror/handlers/note.rb +0 -26
  341. data/lib/metanorma/mirror/handlers/paragraph.rb +0 -19
  342. data/lib/metanorma/mirror/handlers/quote.rb +0 -16
  343. data/lib/metanorma/mirror/handlers/review.rb +0 -19
  344. data/lib/metanorma/mirror/handlers/section.rb +0 -149
  345. data/lib/metanorma/mirror/handlers/sourcecode.rb +0 -27
  346. data/lib/metanorma/mirror/handlers/structural.rb +0 -68
  347. data/lib/metanorma/mirror/handlers/table.rb +0 -81
  348. data/lib/metanorma/mirror/handlers/term.rb +0 -100
  349. data/lib/metanorma/mirror/handlers.rb +0 -60
  350. data/lib/metanorma/mirror/id_strategy/positional.rb +0 -166
  351. data/lib/metanorma/mirror/id_strategy/preserve.rb +0 -12
  352. data/lib/metanorma/mirror/id_strategy.rb +0 -34
  353. data/lib/metanorma/mirror/math_util.rb +0 -53
  354. data/lib/metanorma/mirror/metadata.rb +0 -37
  355. data/lib/metanorma/mirror/metanorma_to_mirror.rb +0 -101
  356. data/lib/metanorma/mirror/model/container.rb +0 -47
  357. data/lib/metanorma/mirror/model/factory.rb +0 -52
  358. data/lib/metanorma/mirror/model/guide.rb +0 -25
  359. data/lib/metanorma/mirror/model/leaf.rb +0 -17
  360. data/lib/metanorma/mirror/model/mark.rb +0 -53
  361. data/lib/metanorma/mirror/model/node.rb +0 -47
  362. data/lib/metanorma/mirror/model/soft_break.rb +0 -33
  363. data/lib/metanorma/mirror/model/text.rb +0 -34
  364. data/lib/metanorma/mirror/model.rb +0 -16
  365. data/lib/metanorma/mirror/output/builder.rb +0 -39
  366. data/lib/metanorma/mirror/output/formats/base_format.rb +0 -90
  367. data/lib/metanorma/mirror/output/formats/inline_format.rb +0 -81
  368. data/lib/metanorma/mirror/output/formats.rb +0 -53
  369. data/lib/metanorma/mirror/output/html_renderer.rb +0 -95
  370. data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +0 -178
  371. data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +0 -61
  372. data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +0 -96
  373. data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +0 -64
  374. data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +0 -129
  375. data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +0 -80
  376. data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +0 -87
  377. data/lib/metanorma/mirror/output/html_renderers.rb +0 -76
  378. data/lib/metanorma/mirror/output/pipeline.rb +0 -92
  379. data/lib/metanorma/mirror/output/pipeline_context.rb +0 -22
  380. data/lib/metanorma/mirror/output.rb +0 -14
  381. data/lib/metanorma/mirror/rewriter.rb +0 -121
  382. data/lib/metanorma/mirror/safe_attr.rb +0 -16
  383. data/lib/metanorma/mirror/serialization/json_serializer.rb +0 -25
  384. data/lib/metanorma/mirror/serialization/yaml_serializer.rb +0 -20
  385. data/lib/metanorma/mirror/serialization.rb +0 -10
  386. data/lib/metanorma/mirror/transformer.rb +0 -22
  387. data/lib/metanorma/mirror.rb +0 -32
  388. data/lib/metanorma/standard_document/annotation.rb +0 -37
  389. data/lib/metanorma/standard_document/blocks/source_origin_element.rb +0 -23
  390. data/lib/metanorma/standard_document/terms/term_name_element.rb +0 -29
  391. data/script/render_both.rb +0 -18
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Metanorma
4
4
  module Html
5
+ # Renders StandardDocument components to HTML.
6
+ # Extends BaseRenderer with terms, bibliography, and standard sections.
5
7
  class StandardRenderer < BaseRenderer
6
8
  register_render Metanorma::StandardDocument::Root,
7
9
  :render_standard_document
@@ -29,32 +31,46 @@ module Metanorma
29
31
  register_render Metanorma::StandardDocument::Blocks::AmendBlock,
30
32
  :render_amend_block
31
33
 
34
+ # --- Top-level document rendering ---
35
+
32
36
  def render_standard_document(doc, **_opts)
33
- cover = render_coverpage(doc)
37
+ render_coverpage(doc)
38
+
39
+ @output << "<main class=\"main-section\">"
40
+
41
+ # Preface sections
42
+ render(doc.preface) if doc.preface
43
+
44
+ # Document title line
45
+ render_doc_title(doc)
46
+
47
+ # Main sections
48
+ render(doc.sections) if doc.sections
34
49
 
35
- content_parts = []
36
- content_parts << (render(doc.preface) || "") if doc.preface
37
- content_parts << (render_doc_title(doc) || "")
38
- content_parts << (render(doc.sections) || "") if doc.sections
39
- doc.annex&.each { |annex| content_parts << (render(annex) || "") }
40
- content_parts << (render(doc.bibliography) || "") if doc.bibliography
50
+ # Annexes
51
+ doc.annex&.each { |annex| render(annex) }
41
52
 
53
+ # Bibliography
54
+ render(doc.bibliography) if doc.bibliography
55
+
56
+ # Index section (from collected index terms)
42
57
  unless @index_term_collector.empty?
43
58
  index_component = Component::IndexSection.new(self)
44
- content_parts << (index_component.render(@index_term_collector) || "")
59
+ index_component.render(@index_term_collector)
45
60
  end
46
61
 
47
- content_parts << (render(doc.indexsect) || "") if doc.indexsect
48
- content_parts << (render_footnotes_section || "")
62
+ # Index section from indexsect element (presentation XML)
63
+ render(doc.indexsect) if doc.indexsect
64
+
65
+ # Footnotes section
66
+ render_footnotes_section
49
67
 
50
- cover + render_liquid("_main_content.html.liquid", {
51
- "content" => content_parts.join,
52
- })
68
+ @output << "</main>"
53
69
  end
54
70
 
55
71
  def render_coverpage(doc)
56
72
  bibdata = doc.bibdata
57
- return "" unless bibdata
73
+ return unless bibdata
58
74
 
59
75
  cover_id = nil
60
76
  bibdata.doc_identifier&.each do |di|
@@ -67,46 +83,63 @@ module Metanorma
67
83
  break
68
84
  end
69
85
 
70
- title_text = extract_display_title(bibdata)
86
+ title_text = nil
87
+ if bibdata.is_a?(Metanorma::IsoDocument::Metadata::IsoBibliographicItem)
88
+ en_title = bibdata.title_for("en")
89
+ title_text = en_title.to_s if en_title
90
+ elsif bibdata.is_a?(Metanorma::Document::Components::BibData::BibData)
91
+ titles = bibdata.title
92
+ if titles && !titles.empty?
93
+ en_title = titles.find { |t| t.language == "en" }
94
+ title_text = extract_text_value(en_title) if en_title
95
+ end
96
+ end
71
97
 
72
- render_liquid("_cover.html.liquid", {
73
- "doc_id" => cover_id,
74
- "title" => title_text,
75
- })
98
+ @output << render_liquid("_cover.html.liquid", {
99
+ "doc_id" => cover_id,
100
+ "title" => title_text,
101
+ })
76
102
  end
77
103
 
78
104
  def render_doc_title(doc)
79
105
  bibdata = doc.bibdata
80
- return nil unless bibdata
106
+ return unless bibdata
81
107
 
82
- title = extract_display_title(bibdata)
83
- return nil unless title
108
+ if bibdata.is_a?(Metanorma::IsoDocument::Metadata::IsoBibliographicItem)
109
+ en_title = bibdata.title_for("en")
110
+ return unless en_title
111
+ elsif bibdata.is_a?(Metanorma::Document::Components::BibData::BibData)
112
+ titles = bibdata.title
113
+ return unless titles && !titles.empty?
84
114
 
85
- render_liquid("_doc_title.html.liquid", {
86
- "title" => title,
87
- })
115
+ en_title = titles.find { |t| t.language == "en" }
116
+ return unless en_title
117
+
118
+ en_title = extract_text_value(en_title)
119
+ else
120
+ return
121
+ end
122
+
123
+ @output << render_liquid("_doc_title.html.liquid", {
124
+ "title" => en_title,
125
+ })
88
126
  end
89
127
 
128
+ # --- Section rendering ---
129
+
90
130
  def render_section(section, level: 1, title_class: nil,
91
- with_subsections: false, with_terms: false)
131
+ with_subsections: false, with_terms: false)
92
132
  attrs = element_attrs(id: safe_attr(section, :id))
93
- parts = []
94
- parts << if title_class
95
- render_standard_title(section, level,
96
- default_class: title_class) || ""
97
- else
98
- render_standard_title(section, level) || ""
99
- end
100
- parts << (render_standard_section_blocks(section, level) || "")
101
- parts << (render_subsections(section, level) || "") if with_subsections
102
- if with_terms
103
- section.terms&.each { |term| parts << (render_term(term) || "") }
133
+ tag("div", attrs) do
134
+ if title_class
135
+ render_standard_title(section, level, default_class: title_class)
136
+ else
137
+ render_standard_title(section, level)
138
+ end
139
+ render_standard_section_blocks(section, level)
140
+ render_subsections(section, level) if with_subsections
141
+ section.terms&.each { |term| render_term(term) } if with_terms
104
142
  end
105
- render_liquid("_element.html.liquid", {
106
- "tag" => "div",
107
- "extra_attrs" => attrs,
108
- "content" => parts.join,
109
- })
110
143
  end
111
144
 
112
145
  def render_clause_section(section, level: 1, **)
@@ -141,94 +174,70 @@ module Metanorma
141
174
  level = safe_attr(title_node, :level) || 1
142
175
  h = "h#{[[level, 6].min, 1].max}"
143
176
  attrs = element_attrs(id: safe_attr(title_node, :id))
144
- render_liquid("_heading.html.liquid", {
145
- "tag" => h,
146
- "class_attr" => attrs,
147
- "content" => escape_html(title_node.text.to_s),
148
- })
177
+ @output << "<#{h}#{attrs}>#{escape_html(title_node.text.to_s)}</#{h}>"
149
178
  end
150
179
 
151
180
  def render_amend_block(amend, **_opts)
152
181
  attrs = element_attrs(id: safe_attr(amend, :id))
153
- content = render_mixed_inline(amend)
154
- render_liquid("_element.html.liquid", {
155
- "tag" => "div",
156
- "extra_attrs" => attrs,
157
- "content" => content,
158
- })
182
+ tag("div", attrs) do
183
+ render_mixed_inline(amend)
184
+ end
159
185
  end
160
186
 
161
187
  # --- Term rendering ---
162
188
 
163
189
  def render_term(term, **_opts)
164
190
  attrs = element_attrs(id: safe_attr(term, :id))
165
- parts = []
166
- term.preferred&.each do |d|
167
- parts << (render_term_designation(d, "preferred") || "")
168
- end
169
- term.admitted&.each do |d|
170
- parts << (render_term_designation(d, "admitted") || "")
171
- end
172
- term.deprecates&.each do |d|
173
- parts << (render_term_designation(d, "deprecated") || "")
174
- end
175
-
176
- if term.domain
177
- domain_text = if term.domain.is_a?(String)
178
- term.domain
179
- else
180
- safe_attr(term.domain, :text).to_s
181
- end
182
- unless domain_text.to_s.empty?
183
- parts << render_liquid("_term_domain.html.liquid", {
184
- "text" => escape_html(domain_text),
185
- }).to_s
191
+ tag("div", attrs) do
192
+ term.preferred&.each { |d| render_term_designation(d, "preferred") }
193
+ term.admitted&.each { |d| render_term_designation(d, "admitted") }
194
+ term.deprecates&.each { |d| render_term_designation(d, "deprecated") }
195
+
196
+ # Domain
197
+ if term.domain
198
+ domain_text = if term.domain.is_a?(String)
199
+ term.domain
200
+ else
201
+ safe_attr(
202
+ term.domain, :text
203
+ ).to_s
204
+ end
205
+ @output << "<p class=\"term-domain\">&lt;#{escape_html(domain_text)}&gt;</p>" unless domain_text.to_s.empty?
186
206
  end
187
- end
188
207
 
189
- if term.definition
190
- Array(term.definition).each do |defn|
191
- parts << (render_term_definition(defn) || "")
208
+ # Definitions
209
+ if term.definition
210
+ Array(term.definition).each do |defn|
211
+ render_term_definition(defn)
212
+ end
192
213
  end
193
- end
194
214
 
195
- term.note&.each_with_index do |note, i|
196
- if note.is_a?(String)
197
- label = "Note #{i + 1} to entry: "
198
- parts << render_liquid("_term_text_note.html.liquid", {
199
- "label" => label,
200
- "content" => escape_html(note),
201
- }).to_s
202
- else
203
- parts << (render_note(note) || "")
215
+ # Notes (mapped from <termnote>)
216
+ term.note&.each_with_index do |note, i|
217
+ if note.is_a?(String)
218
+ @output << "<div class=\"note-block\"><p><span class=\"term-note-label\">Note #{i + 1} to entry: </span>#{escape_html(note)}</p></div>"
219
+ else
220
+ render_note(note)
221
+ end
204
222
  end
205
- end
206
223
 
207
- term.example&.each { |ex| parts << (render_paragraph(ex) || "") }
208
- term.source&.each { |src| parts << (render_term_source(src) || "") }
209
- render_liquid("_element.html.liquid", {
210
- "tag" => "div",
211
- "extra_attrs" => attrs,
212
- "content" => parts.join,
213
- })
224
+ # Examples (mapped from <termexample>)
225
+ term.example&.each { |ex| render_paragraph(ex) }
226
+
227
+ # Source references
228
+ term.source&.each { |src| render_term_source(src) }
229
+ end
214
230
  end
215
231
 
216
232
  def render_term_designation(designation, _type)
217
233
  name = extract_designation_name(designation)
218
- return nil unless name
219
-
220
- inner = escape_html(name)
221
- dfn = render_liquid("_element.html.liquid",
222
- { "tag" => "dfn", "extra_attrs" => "",
223
- "content" => inner })
224
- bold = render_liquid("_element.html.liquid",
225
- { "tag" => "b", "extra_attrs" => "",
226
- "content" => dfn })
227
- render_liquid("_element.html.liquid", {
228
- "tag" => "p",
229
- "extra_attrs" => " class=\"term-name\" style=\"text-align:left;\"",
230
- "content" => bold,
231
- })
234
+ return unless name
235
+
236
+ tag("p", " class=\"term-name\" style=\"text-align:left;\"") do
237
+ tag("b") do
238
+ tag("dfn") { @output << escape_html(name) }
239
+ end
240
+ end
232
241
  end
233
242
 
234
243
  def extract_designation_name(designation)
@@ -245,222 +254,143 @@ module Metanorma
245
254
  end
246
255
 
247
256
  def render_term_definition(definition)
248
- return nil unless definition
249
- return nil unless definition.is_a?(Metanorma::StandardDocument::Terms::TermDefinition)
257
+ return unless definition
258
+ return unless definition.is_a?(Metanorma::StandardDocument::Terms::TermDefinition)
250
259
 
251
260
  ve = definition.verbalexpression
252
- return nil unless ve
261
+ return unless ve
253
262
 
254
- parts = []
255
- ve.paragraph&.each { |para| parts << (render_paragraph(para) || "") }
256
- parts.join
263
+ ve.paragraph&.each { |para| render_paragraph(para) }
257
264
  end
258
265
 
259
266
  def render_term_note(note)
260
267
  attrs = element_attrs(id: safe_attr(note, :id), class: "note-block")
261
- label = extract_termnote_label(note)
262
- parts = []
263
- note_content_parts = []
264
- note.p&.each do |para|
265
- note_content_parts << (render_mixed_inline(para) || "")
268
+ tag("div", attrs) do
269
+ label = extract_termnote_label(note)
270
+ @output << "<p><span class=\"term-note-label\">#{escape_html(label)}: </span>"
271
+ note.p&.each { |para| render_mixed_inline(para) }
272
+ @output << "</p>"
273
+ note.ul&.each { |ul| render_unordered_list(ul) }
274
+ note.ol&.each { |ol| render_ordered_list(ol) }
275
+ note.dl&.then { |dl| render_definition_list(dl) }
266
276
  end
267
- note_content = note_content_parts.join
268
- parts << render_liquid("_term_note.html.liquid", {
269
- "label" => escape_html(label),
270
- "content" => note_content,
271
- })
272
- note.ul&.each { |ul| parts << (render_unordered_list(ul) || "") }
273
- note.ol&.each { |ol| parts << (render_ordered_list(ol) || "") }
274
- note.dl&.then { |dl| parts << (render_definition_list(dl) || "") }
275
- render_liquid("_element.html.liquid", {
276
- "tag" => "div",
277
- "extra_attrs" => attrs,
278
- "content" => parts.join,
279
- })
280
277
  end
281
278
 
282
279
  def render_term_example(example)
283
280
  attrs = element_attrs(id: safe_attr(example, :id), class: "example")
284
- label = extract_block_label(example, "EXAMPLE")
285
- parts = []
286
- ex_content_parts = []
287
- example.p&.each do |para|
288
- ex_content_parts << (render_mixed_inline(para) || "")
281
+ tag("div", attrs) do
282
+ label = extract_block_label(example, "EXAMPLE")
283
+ @output << "<p><span class=\"example-label\">#{escape_html(label)}</span>&nbsp;"
284
+ example.p&.each { |para| render_mixed_inline(para) }
285
+ @output << "</p>"
286
+ example.ul&.each { |ul| render_unordered_list(ul) }
287
+ example.ol&.each { |ol| render_ordered_list(ol) }
288
+ example.dl&.then { |dl| render_definition_list(dl) }
289
289
  end
290
- ex_content = ex_content_parts.join
291
- parts << render_liquid("_term_example.html.liquid", {
292
- "label" => escape_html(label),
293
- "content" => ex_content,
294
- })
295
- example.ul&.each { |ul| parts << (render_unordered_list(ul) || "") }
296
- example.ol&.each { |ol| parts << (render_ordered_list(ol) || "") }
297
- example.dl&.then { |dl| parts << (render_definition_list(dl) || "") }
298
- render_liquid("_element.html.liquid", {
299
- "tag" => "div",
300
- "extra_attrs" => attrs,
301
- "content" => parts.join,
302
- })
303
290
  end
304
291
 
305
292
  def render_term_source(source)
306
- return nil unless source
293
+ return unless source
307
294
 
308
- parts = []
295
+ @output << "<p class=\"term-source\">[SOURCE: "
309
296
  termsource = safe_attr(source, :termsource)
310
297
  origin = safe_attr(source, :origin)
311
298
 
312
299
  if termsource
313
- parts << (render_mixed_inline(termsource) || "")
300
+ render_mixed_inline(termsource)
314
301
  elsif origin
315
302
  citeas = safe_attr(origin, :citeas)
316
303
  bibitemid = safe_attr(origin, :bibitemid)
317
304
 
318
- parts << if citeas && !citeas.to_s.empty?
319
- if bibitemid && !bibitemid.to_s.empty?
320
- render_liquid("_link.html.liquid", {
321
- "attrs" => element_attrs(
322
- href: "##{escape_html(bibitemid.to_s)}", class: "bibref",
323
- ),
324
- "content" => escape_html(citeas.to_s),
325
- })
326
- else
327
- escape_html(citeas.to_s)
328
- end
329
- else
330
- render_mixed_inline(origin) || ""
331
- end
305
+ if citeas && !citeas.to_s.empty?
306
+ @output << if bibitemid && !bibitemid.to_s.empty?
307
+ "<a href=\"##{escape_html(bibitemid.to_s)}\" class=\"bibref\">#{escape_html(citeas.to_s)}</a>"
308
+ else
309
+ escape_html(citeas.to_s)
310
+ end
311
+ else
312
+ render_mixed_inline(origin)
313
+ end
332
314
 
333
315
  modification = safe_attr(source, :modification)
334
316
  if modification && !modification.to_s.empty?
335
- parts << ", modified — #{escape_html(modification.to_s)}"
317
+ @output << ", modified — #{escape_html(modification.to_s)}"
336
318
  end
337
319
  else
338
- parts << (render_mixed_inline(source) || "")
320
+ render_mixed_inline(source)
339
321
  end
340
-
341
- render_liquid("_term_source.html.liquid", {
342
- "content" => parts.join,
343
- })
322
+ @output << "]</p>"
344
323
  end
345
324
 
346
325
  def render_term_source_element(element)
347
- return nil unless element
326
+ return unless element
348
327
 
349
- content = render_mixed_inline(element)
350
- render_liquid("_paragraph.html.liquid", {
351
- "attrs" => "",
352
- "content" => content,
353
- })
328
+ @output << "<p>"
329
+ render_mixed_inline(element)
330
+ @output << "</p>"
354
331
  end
355
332
 
356
333
  # --- Bibliography / References ---
357
334
 
358
335
  def render_bibliography(bib, level: 1, **_opts)
359
- parts = []
360
- bib.references&.each do |ref|
361
- parts << (render_references_section(ref, level: level) || "")
336
+ tag("div", "") do
337
+ bib.references&.each do |ref|
338
+ render_references_section(ref, level: level)
339
+ end
340
+ bib.clause&.each { |cl| render(cl, level: level) }
362
341
  end
363
- bib.clause&.each { |cl| parts << (render(cl, level: level) || "") }
364
- render_liquid("_element.html.liquid", {
365
- "tag" => "div",
366
- "extra_attrs" => "",
367
- "content" => parts.join,
368
- })
369
342
  end
370
343
 
371
344
  def render_references_section(section, level: 1, **_opts)
372
345
  is_normative = safe_attr(section, :normative) == "true"
373
346
  attrs = element_attrs(id: safe_attr(section, :id))
374
- parts = []
375
- parts << (render_standard_title(section, level,
376
- default_class: is_normative ? "" : "section-sub") || "")
377
- section.p&.each { |para| parts << (render_paragraph(para) || "") }
378
- section.note&.each { |note| parts << (render_paragraph(note) || "") }
379
- section.references&.each_with_index do |bibitem, i|
380
- parts << (render_bibitem(bibitem, i + 1,
381
- normative: is_normative) || "")
347
+ tag("div", attrs) do
348
+ render_standard_title(section, level,
349
+ default_class: is_normative ? "" : "section-sub")
350
+ section.p&.each { |para| render_paragraph(para) }
351
+ section.note&.each { |note| render_paragraph(note) }
352
+ section.references&.each_with_index do |bibitem, i|
353
+ render_bibitem(bibitem, i + 1, normative: is_normative)
354
+ end
355
+ section.table&.each { |t| render_table(t) }
382
356
  end
383
- section.table&.each { |t| parts << (render_table(t) || "") }
384
- render_liquid("_element.html.liquid", {
385
- "tag" => "div",
386
- "extra_attrs" => attrs,
387
- "content" => parts.join,
388
- })
389
357
  end
390
358
 
391
359
  def render_bibitem(item, index, normative: false)
392
360
  css_class = normative ? "norm-ref-entry" : "biblio-entry"
393
- item_id = safe_attr(item, :id)
361
+ attrs = element_attrs(id: safe_attr(item, :id), class: css_class)
394
362
  url = bibitem_url(item)
395
363
 
396
- if item.biblio_tag
397
- prefix, rest = split_biblio_tag(item.biblio_tag)
398
- ordinal_html = prefix.empty? ? nil : escape_html(prefix)
399
- pubid_html = rest&.filter_map do |child|
400
- render_inline_element(child)
401
- end&.join
402
- else
403
- ordinal_html = "[#{index}]"
404
- pubid_html = nil
405
- end
406
-
407
- content_html = render_bibitem_content(item)
408
-
409
- drop = Drops::BiblioEntryDrop.new(
410
- id: item_id,
411
- css_class: css_class,
412
- ordinal_html: ordinal_html,
413
- pubid_html: pubid_html,
414
- url: url ? escape_html(url) : nil,
415
- content_html: content_html,
416
- )
417
- render_liquid("_biblio_entry.html.liquid", { "entry" => drop })
418
- end
364
+ tag("p", attrs) do
365
+ if url
366
+ @output << "<a href=\"#{escape_html(url)}\" target=\"_blank\" rel=\"noopener\" class=\"biblio-link\">"
367
+ end
419
368
 
420
- def split_biblio_tag(tag)
421
- children = []
422
- tag.each_mixed_content { |c| children << c }
369
+ # Use biblio-tag from presentation XML if available
370
+ if item.biblio_tag
371
+ render_mixed_inline(item.biblio_tag)
372
+ @output << "&nbsp;"
373
+ else
374
+ @output << "[#{index}]&nbsp;"
375
+ end
423
376
 
424
- prefix = +""
425
- rest = []
426
- found_boundary = false
377
+ render_bibitem_content(item)
427
378
 
428
- children.each do |child|
429
- if found_boundary
430
- rest << child
431
- else
432
- case child
433
- when Metanorma::Document::Components::Inline::TabElement
434
- found_boundary = true
435
- next
436
- when String
437
- stripped = child.strip
438
- if stripped.match?(/\A\[\d+\]\z/)
439
- prefix << child
440
- elsif child.match?(/\A\s*\z/)
441
- prefix << child
442
- else
443
- found_boundary = true
444
- rest << child
445
- end
446
- else
447
- found_boundary = true
448
- rest << child
449
- end
379
+ if url
380
+ @output << "</a>"
450
381
  end
451
382
  end
452
-
453
- prefix_text = prefix.strip
454
- [prefix_text, rest.empty? ? nil : rest]
455
383
  end
456
384
 
457
385
  def bibitem_url(item)
458
386
  links = Array(item.link)
459
387
  return nil if links.empty?
460
388
 
389
+ # Prefer src or citation type, skip RSS feeds
461
390
  preferred = links.find { |l| ["src", "citation"].include?(l.type) }
462
391
  return preferred.content.to_s if preferred && !preferred.content.to_s.empty?
463
392
 
393
+ # Fallback: first non-RSS link
464
394
  non_rss = links.find do |l|
465
395
  !l.content.to_s.include?(".rss") && !l.content.to_s.empty?
466
396
  end
@@ -468,15 +398,25 @@ module Metanorma
468
398
  end
469
399
 
470
400
  def render_bibitem_content(item)
471
- parts = []
401
+ # Use formatted reference if available (presentation XML)
472
402
  if item.formatted_ref
473
- parts << (render_mixed_inline(item.formatted_ref) || "")
474
- return parts.join
403
+ render_mixed_inline(item.formatted_ref)
404
+ return
475
405
  end
476
406
 
477
- rendered_pubid = render_pubid_identifier(item)
478
- unless rendered_pubid
479
- render_docidentifier_fallback_into(parts, item)
407
+ # Fallback: construct from parts
408
+ if item.docidentifier && !item.docidentifier.empty?
409
+ docids = Array(item.docidentifier)
410
+ # Skip bracket-number identifiers (e.g. "[1]") and iso-reference/URN variants;
411
+ # render only the primary doc identifier
412
+ primary = docids.find do |di|
413
+ val = extract_text_value(di).to_s
414
+ val.match?(/\A\[?\d+\]?\z/) ? false : !val.match?(/\A(?:iso-reference|URN)\s/)
415
+ end
416
+ if primary
417
+ id_val = extract_text_value(primary)
418
+ @output << "<span class=\"ref-doc-number\">#{escape_html(id_val)}</span>" unless id_val.to_s.empty?
419
+ end
480
420
  end
481
421
 
482
422
  if item.date && !item.date.empty?
@@ -484,10 +424,7 @@ module Metanorma
484
424
  date_on = date.is_a?(Metanorma::Document::Relaton::BibliographicDate) ? date.on : nil
485
425
  date_val = extract_text_value(date_on || safe_attr(date, :text))
486
426
  if date_val && !date_val.to_s.empty?
487
- parts << render_liquid("_ref_date.html.liquid", {
488
- "prefix" => ":",
489
- "year" => escape_html(date_val.to_s),
490
- })
427
+ @output << ":<span class=\"ref-year\">#{escape_html(date_val.to_s)}</span>"
491
428
  end
492
429
  end
493
430
  end
@@ -498,51 +435,11 @@ module Metanorma
498
435
  safe_attr(t, :type) == "main"
499
436
  end || titles.first
500
437
  if main_title
501
- title_content = render_mixed_inline(main_title)
502
- parts << render_liquid("_ref_title.html.liquid", {
503
- "content" => title_content,
504
- })
438
+ @output << ", <i>"
439
+ render_mixed_inline(main_title)
440
+ @output << "</i>"
505
441
  end
506
442
  end
507
- parts.join
508
- end
509
-
510
- def render_pubid_identifier(item)
511
- return nil unless item.docidentifier && !item.docidentifier.empty?
512
-
513
- docids = Array(item.docidentifier)
514
- primary = docids.find do |di|
515
- val = extract_text_value(di).to_s
516
- val.match?(/\A\[?\d+\]?\z/) ? false : !val.match?(/\A(?:iso-reference|URN)\s/)
517
- end
518
- return nil unless primary
519
-
520
- id_string = extract_text_value(primary).to_s
521
- return nil if id_string.empty?
522
-
523
- identifier = parse_pubid(id_string)
524
- return nil unless identifier
525
-
526
- pubid_to_html(identifier)
527
- end
528
-
529
- def render_docidentifier_fallback_into(parts, item)
530
- return unless item.docidentifier && !item.docidentifier.empty?
531
-
532
- docids = Array(item.docidentifier)
533
- primary = docids.find do |di|
534
- val = extract_text_value(di).to_s
535
- val.match?(/\A\[?\d+\]?\z/) ? false : !val.match?(/\A(?:iso-reference|URN)\s/)
536
- end
537
- return unless primary
538
-
539
- id_val = extract_text_value(primary)
540
- unless id_val.to_s.empty?
541
- parts << render_liquid("_inline_span.html.liquid", {
542
- "attrs" => " class=\"ref-doc-number\"",
543
- "content" => escape_html(id_val),
544
- })
545
- end
546
443
  end
547
444
 
548
445
  # --- Standard section helpers ---
@@ -550,10 +447,9 @@ module Metanorma
550
447
  def render_standard_title(section, level, default_class: "")
551
448
  title_element = safe_attr(section,
552
449
  :fmt_title) || safe_attr(section, :title)
553
- return nil unless title_element
450
+ return unless title_element
554
451
 
555
452
  section_id = safe_attr(section, :id)
556
- title_content = render_mixed_inline(title_element)
557
453
  title_text = extract_plain_text(title_element)
558
454
  register_toc_entry(id: section_id, level: level, text: title_text)
559
455
 
@@ -562,67 +458,58 @@ module Metanorma
562
458
 
563
459
  h = "h#{[[level, 6].min, 1].max}"
564
460
  title_class = default_class.empty? ? "" : " class=\"#{default_class}\""
565
- render_liquid("_heading.html.liquid", {
566
- "tag" => h,
567
- "class_attr" => title_class,
568
- "content" => title_content,
569
- })
461
+ @output << "<#{h}#{title_class}>"
462
+ render_mixed_inline(title_element)
463
+ @output << "</#{h}>"
570
464
  end
571
465
 
572
466
  def render_standard_section_blocks(section, level)
573
467
  if section.is_a?(Lutaml::Model::Serializable) && section.mixed?
574
- parts = []
575
468
  section.each_mixed_content do |node|
576
469
  next if node.is_a?(String)
577
470
  next if is_title_element?(node, section)
578
471
 
579
- parts << (render(node, level: level + 1) || "")
472
+ render(node, level: level + 1)
580
473
  end
581
- parts.join
582
474
  else
583
475
  render_section_block_collections(section, level)
584
476
  end
585
477
  end
586
478
 
587
479
  def render_section_block_collections(section, level)
588
- parts = []
480
+ # Paragraphs
589
481
  paragraphs = safe_attr(section, :paragraphs) || safe_attr(section, :p)
590
- if paragraphs
591
- Array(paragraphs).each do |p|
592
- parts << (render_paragraph(p) || "")
593
- end
594
- end
482
+ Array(paragraphs).each { |p| render_paragraph(p) } if paragraphs
595
483
 
484
+ # Lists
596
485
  %i[unordered_lists ordered_lists definition_lists].each do |attr|
597
486
  values = safe_attr(section, attr)
598
- if values
599
- Array(values).each do |v|
600
- parts << (render(v, level: level + 1) || "")
601
- end
602
- end
487
+ Array(values).each { |v| render(v, level: level + 1) } if values
603
488
  end
604
489
 
490
+ # Block elements
605
491
  %i[tables figures formulas examples notes admonitions sourcecode_blocks
606
492
  quote_blocks].each do |attr|
607
493
  values = safe_attr(section, attr)
608
- if values
609
- Array(values).each do |v|
610
- parts << (render(v, level: level + 1) || "")
611
- end
612
- end
494
+ Array(values).each { |v| render(v, level: level + 1) } if values
613
495
  end
614
- parts.join
615
496
  end
616
497
 
617
498
  def render_subsections(section, level)
618
499
  clauses = safe_attr(section,
619
500
  :clause) || safe_attr(section, :subsections)
620
- return nil unless clauses
501
+ Array(clauses).each { |cl| render(cl, level: level + 1) } if clauses
502
+ end
503
+
504
+ def is_title_element?(node, section)
505
+ title = safe_attr(section, :title)
506
+ return false unless title
621
507
 
622
- clauses.filter_map { |cl| render(cl, level: level + 1) }.join
508
+ node.equal?(title)
623
509
  end
624
510
 
625
511
  def extract_termnote_label(note)
512
+ # Presentation XML: <name>Note 1 to entry</name>
626
513
  names = safe_attr(note, :name)
627
514
  if names && !names.empty?
628
515
  name = names.is_a?(Array) ? names.first : names
@@ -630,6 +517,7 @@ module Metanorma
630
517
  return text unless text.to_s.strip.empty?
631
518
  end
632
519
 
520
+ # Fallback: autonum attribute
633
521
  autonum = safe_attr(note, :autonum)
634
522
  return "Note #{autonum} to entry" if autonum && !autonum.to_s.empty?
635
523