metanorma-document 0.3.0 → 0.5.0

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 (197) hide show
  1. checksums.yaml +4 -4
  2. data/BUGS.sts/08-list-items-duplicate-bullets.md +45 -0
  3. data/CLAUDE.md +3 -2
  4. data/Rakefile +30 -5
  5. data/data/stylesheets/components/header.css +3 -5
  6. data/data/stylesheets/components/lists.css +14 -0
  7. data/frontend/dist/app.css +1 -0
  8. data/frontend/dist/app.iife.js +24 -0
  9. data/frontend/package-lock.json +7 -505
  10. data/frontend/tailwind.config.js +5 -0
  11. data/lib/metanorma/{oiml_document → csa_document}/root.rb +2 -2
  12. data/lib/metanorma/csa_document.rb +9 -0
  13. data/lib/metanorma/document/cli.rb +52 -0
  14. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +14 -0
  15. data/lib/metanorma/document/components/inline/comma_element.rb +3 -0
  16. data/lib/metanorma/document/components/inline/enum_comma_element.rb +3 -0
  17. data/lib/metanorma/document/components/inline/eref_element.rb +4 -1
  18. data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +4 -2
  19. data/lib/metanorma/document/components/inline/math_element.rb +13 -7
  20. data/lib/metanorma/document/components/inline/vocabulary.rb +4 -0
  21. data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +6 -1
  22. data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +3 -0
  23. data/lib/metanorma/document/components/reference_elements/callout.rb +3 -2
  24. data/lib/metanorma/document/components/tables/table_cell.rb +3 -0
  25. data/lib/metanorma/document/elements/input.rb +44 -0
  26. data/lib/metanorma/document/elements.rb +1 -0
  27. data/lib/metanorma/document/relaton/address.rb +5 -0
  28. data/lib/metanorma/document/relaton/affiliation.rb +3 -0
  29. data/lib/metanorma/document/relaton/bib_item_size.rb +8 -9
  30. data/lib/metanorma/document/relaton/bib_item_type.rb +3 -0
  31. data/lib/metanorma/document/relaton/bibliographic_date.rb +5 -0
  32. data/lib/metanorma/document/relaton/contact_method.rb +5 -0
  33. data/lib/metanorma/document/relaton/contribution_info.rb +6 -2
  34. data/lib/metanorma/document/relaton/contributor.rb +4 -0
  35. data/lib/metanorma/document/relaton/contributor_role.rb +3 -0
  36. data/lib/metanorma/document/relaton/copyright_association.rb +3 -0
  37. data/lib/metanorma/document/relaton/copyright_owner.rb +3 -0
  38. data/lib/metanorma/document/relaton/date_time.rb +3 -0
  39. data/lib/metanorma/document/relaton/document_identifier.rb +4 -0
  40. data/lib/metanorma/document/relaton/document_relation.rb +8 -0
  41. data/lib/metanorma/document/relaton/document_status.rb +4 -0
  42. data/lib/metanorma/document/relaton/formatted_address.rb +4 -0
  43. data/lib/metanorma/document/relaton/full_name.rb +14 -3
  44. data/lib/metanorma/document/relaton/keyword_type.rb +3 -0
  45. data/lib/metanorma/document/relaton/locality_stack.rb +6 -9
  46. data/lib/metanorma/document/relaton/localized_name.rb +8 -5
  47. data/lib/metanorma/document/relaton/logo_element.rb +5 -0
  48. data/lib/metanorma/document/relaton/medium_type.rb +5 -16
  49. data/lib/metanorma/document/relaton/org_identifier.rb +2 -0
  50. data/lib/metanorma/document/relaton/org_subdivision.rb +2 -0
  51. data/lib/metanorma/document/relaton/org_subdivision_identifier.rb +2 -0
  52. data/lib/metanorma/document/relaton/organization.rb +3 -0
  53. data/lib/metanorma/document/relaton/person.rb +7 -1
  54. data/lib/metanorma/document/relaton/person_identifier.rb +3 -0
  55. data/lib/metanorma/document/relaton/place_type.rb +5 -0
  56. data/lib/metanorma/document/relaton/region_element.rb +3 -9
  57. data/lib/metanorma/document/relaton/relaton_collection.rb +2 -0
  58. data/lib/metanorma/document/relaton/series_type.rb +7 -0
  59. data/lib/metanorma/document/relaton/typed_note.rb +4 -0
  60. data/lib/metanorma/document/relaton/typed_title_string.rb +4 -0
  61. data/lib/metanorma/document/relaton/typed_uri.rb +3 -8
  62. data/lib/metanorma/document/relaton/validity_type.rb +8 -10
  63. data/lib/metanorma/document/relaton/variant_full_name.rb +3 -0
  64. data/lib/metanorma/document/relaton/variant_org_name.rb +3 -0
  65. data/lib/metanorma/document/relaton/version_info.rb +5 -0
  66. data/lib/metanorma/document/relaton/vocab_id_type.rb +6 -12
  67. data/lib/metanorma/document/relaton.rb +0 -14
  68. data/lib/metanorma/document/version.rb +1 -1
  69. data/lib/metanorma/document.rb +2 -1
  70. data/lib/metanorma/html/asset_pipeline.rb +1 -0
  71. data/lib/metanorma/html/base_renderer.rb +106 -236
  72. data/lib/metanorma/html/concerns/metadata_extraction.rb +61 -0
  73. data/lib/metanorma/html/concerns/presentation_validation.rb +61 -0
  74. data/lib/metanorma/html/concerns/svg_processing.rb +32 -0
  75. data/lib/metanorma/html/concerns/text_extraction.rb +93 -0
  76. data/lib/metanorma/html/concerns/toc_registry.rb +47 -0
  77. data/lib/metanorma/html/csa_renderer.rb +9 -0
  78. data/lib/metanorma/html/drops/figure_drop.rb +33 -10
  79. data/lib/metanorma/html/drops/sourcecode_drop.rb +3 -6
  80. data/lib/metanorma/html/flavor.rb +6 -1
  81. data/lib/metanorma/html/generator.rb +8 -8
  82. data/lib/metanorma/html/iso_renderer.rb +0 -142
  83. data/lib/metanorma/html/renderers/block_renderer.rb +41 -5
  84. data/lib/metanorma/html/renderers/element_order_traversal.rb +15 -1
  85. data/lib/metanorma/html/renderers/inline_renderer.rb +16 -76
  86. data/lib/metanorma/html/standard_renderer.rb +195 -35
  87. data/lib/metanorma/html/templates/_list_item.html.liquid +1 -1
  88. data/lib/metanorma/html/theme.rb +38 -11
  89. data/lib/metanorma/html.rb +1 -52
  90. data/lib/metanorma/iso_document/sections/iso_preface.rb +27 -13
  91. data/lib/metanorma/mirror/default_registry.rb +21 -0
  92. data/lib/metanorma/mirror/handlers/inline/catalog.rb +7 -12
  93. data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +2 -3
  94. data/lib/metanorma/mirror/handlers/sourcecode.rb +1 -1
  95. data/lib/metanorma/mirror/model/guide.rb +3 -2
  96. data/lib/metanorma/mirror/output/formats/inline_format.rb +64 -3
  97. data/lib/metanorma/mirror/output/pipeline.rb +1 -0
  98. data/lib/metanorma/mirror/output.rb +0 -2
  99. data/lib/metanorma/mirror/rewriter.rb +3 -1
  100. data/lib/metanorma/registers/setup.rb +6 -2
  101. data/lib/metanorma/standard_document/annotation_container.rb +2 -0
  102. data/lib/metanorma/standard_document/elements/input.rb +4 -25
  103. data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +12 -2
  104. data/lib/metanorma/standard_document/metadata/presentation_metadata.rb +107 -0
  105. data/lib/metanorma/standard_document/metadata/semantic_metadata.rb +18 -0
  106. data/lib/metanorma/standard_document/metadata/unitsml/amount_of_substance.rb +19 -0
  107. data/lib/metanorma/standard_document/metadata/unitsml/base_quantity.rb +34 -0
  108. data/lib/metanorma/standard_document/metadata/unitsml/dimension.rb +39 -0
  109. data/lib/metanorma/standard_document/metadata/unitsml/dimension_set.rb +19 -0
  110. data/lib/metanorma/standard_document/metadata/unitsml/electric_current.rb +19 -0
  111. data/lib/metanorma/standard_document/metadata/unitsml/enumerated_root_unit.rb +23 -0
  112. data/lib/metanorma/standard_document/metadata/unitsml/length.rb +19 -0
  113. data/lib/metanorma/standard_document/metadata/unitsml/luminous_intensity.rb +19 -0
  114. data/lib/metanorma/standard_document/metadata/unitsml/mass.rb +19 -0
  115. data/lib/metanorma/standard_document/metadata/unitsml/namespace.rb +17 -0
  116. data/lib/metanorma/standard_document/metadata/unitsml/plane_angle.rb +19 -0
  117. data/lib/metanorma/standard_document/metadata/unitsml/prefix.rb +30 -0
  118. data/lib/metanorma/standard_document/metadata/unitsml/prefix_name.rb +21 -0
  119. data/lib/metanorma/standard_document/metadata/unitsml/prefix_set.rb +19 -0
  120. data/lib/metanorma/standard_document/metadata/unitsml/prefix_symbol.rb +21 -0
  121. data/lib/metanorma/standard_document/metadata/unitsml/quantity.rb +28 -0
  122. data/lib/metanorma/standard_document/metadata/unitsml/quantity_name.rb +21 -0
  123. data/lib/metanorma/standard_document/metadata/unitsml/quantity_set.rb +19 -0
  124. data/lib/metanorma/standard_document/metadata/unitsml/root_units.rb +19 -0
  125. data/lib/metanorma/standard_document/metadata/unitsml/thermodynamic_temperature.rb +19 -0
  126. data/lib/metanorma/standard_document/metadata/unitsml/time.rb +19 -0
  127. data/lib/metanorma/standard_document/metadata/unitsml/unit.rb +32 -0
  128. data/lib/metanorma/standard_document/metadata/unitsml/unit_name.rb +21 -0
  129. data/lib/metanorma/standard_document/metadata/unitsml/unit_set.rb +19 -0
  130. data/lib/metanorma/standard_document/metadata/unitsml/unit_symbol.rb +36 -0
  131. data/lib/metanorma/standard_document/metadata/unitsml/unit_system.rb +23 -0
  132. data/lib/metanorma/standard_document/metadata/unitsml/unitsml_root.rb +28 -0
  133. data/lib/metanorma/standard_document/metadata/unitsml.rb +39 -0
  134. data/lib/metanorma/standard_document/metadata.rb +4 -0
  135. data/lib/metanorma/standard_document/sections/misc_container.rb +8 -6
  136. data/lib/metanorma/standard_document/sections/sections.rb +7 -0
  137. data/lib/metanorma/un_document/blocks/un_admonition_block.rb +86 -0
  138. data/lib/metanorma/un_document/blocks.rb +9 -0
  139. data/lib/metanorma/un_document/root.rb +8 -0
  140. data/lib/metanorma/un_document/sections/un_abstract_section.rb +48 -0
  141. data/lib/metanorma/un_document/sections/un_preface.rb +19 -2
  142. data/lib/metanorma/un_document/sections.rb +1 -0
  143. data/lib/metanorma/un_document/un_text_element.rb +116 -0
  144. data/lib/metanorma/un_document.rb +2 -0
  145. data/script/benchmark_render.rb +35 -0
  146. data/tasks/roundtrip_samples.rake +2 -2
  147. metadata +65 -54
  148. data/.rubocop_todo.yml +0 -220
  149. data/TODO.finalize/01-split-multi-class-files.md +0 -8
  150. data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +0 -6
  151. data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +0 -11
  152. data/TODO.finalize/04-theme-per-flavor-config-driven.md +0 -9
  153. data/TODO.finalize/05-migrate-all-html-to-liquid.md +0 -16
  154. data/TODO.finalize/06-integrate-pubid-library.md +0 -16
  155. data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +0 -39
  156. data/TODO.finalize/08-refactor-renderer-architecture.md +0 -25
  157. data/TODO.finalize/09-eliminate-code-smells.md +0 -14
  158. data/TODO.finalize/10-comprehensive-spec-coverage.md +0 -24
  159. data/TODO.finalize/11-config-driven-flavor-metadata.md +0 -20
  160. data/TODO.finalize/12-add-frozen-string-literal.md +0 -6
  161. data/TODO.finalize/13-extract-composition-from-god-class.md +0 -96
  162. data/TODO.finalize/14-config-driven-section-ordering.md +0 -31
  163. data/TODO.finalize/15-theme-directories-per-flavor.md +0 -46
  164. data/TODO.finalize/16-theme-lutaml-model-schema.md +0 -44
  165. data/data/logos/oiml-logo-full-dark.svg +0 -1
  166. data/data/logos/oiml-logo-full-light.svg +0 -1
  167. data/data/logos/oiml-logo-icon-dark.svg +0 -1
  168. data/data/logos/oiml-logo-icon-light.svg +0 -1
  169. data/data/logos/oiml-logo.svg +0 -1
  170. data/data/themes/oiml.yaml +0 -56
  171. data/docs/html-renderer.adoc +0 -261
  172. data/lib/data/dist/iso_document/frontend/assets/index-mwzbzmnK.js +0 -22
  173. data/lib/data/dist/iso_document/frontend/assets/index-pGvKTNid.css +0 -1
  174. data/lib/data/dist/iso_document/frontend/assets/iso-red.svg +0 -53
  175. data/lib/data/dist/iso_document/frontend/index.html +0 -13
  176. data/lib/metanorma/document/relaton/bib_item_size_type.rb +0 -21
  177. data/lib/metanorma/document/relaton/bibliographic_date_type.rb +0 -22
  178. data/lib/metanorma/document/relaton/document_relation_type.rb +0 -31
  179. data/lib/metanorma/document/relaton/iso4217_code.rb +0 -17
  180. data/lib/metanorma/document/relaton/iso8601_date.rb +0 -17
  181. data/lib/metanorma/document/relaton/personal_identifier_type.rb +0 -21
  182. data/lib/metanorma/document/relaton/region_type.rb +0 -20
  183. data/lib/metanorma/document/relaton/series_type_type.rb +0 -21
  184. data/lib/metanorma/document/relaton/specific_locality_type.rb +0 -25
  185. data/lib/metanorma/document/relaton/title_type.rb +0 -21
  186. data/lib/metanorma/html/oiml_renderer.rb +0 -33
  187. data/lib/metanorma/mirror/output/html_renderer.rb +0 -95
  188. data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +0 -178
  189. data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +0 -61
  190. data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +0 -96
  191. data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +0 -41
  192. data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +0 -129
  193. data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +0 -80
  194. data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +0 -87
  195. data/lib/metanorma/mirror/output/html_renderers.rb +0 -76
  196. data/lib/metanorma/oiml_document.rb +0 -9
  197. data/lib/metanorma/standard_document/annotation.rb +0 -37
data/.rubocop_todo.yml DELETED
@@ -1,220 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2026-07-18 16:00:24 UTC using RuboCop version 1.86.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- Gemspec/RequiredRubyVersion:
11
- Exclude:
12
- - 'metanorma-document.gemspec'
13
-
14
- # Offense count: 703
15
- # This cop supports safe autocorrection (--autocorrect).
16
- # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
- # URISchemes: http, https
18
- Layout/LineLength:
19
- Enabled: false
20
-
21
- # Offense count: 2
22
- # Configuration parameters: AllowedMethods.
23
- # AllowedMethods: enums
24
- Lint/ConstantDefinitionInBlock:
25
- Exclude:
26
- - 'spec/metanorma/html/renderer/class_ownership_spec.rb'
27
- - 'spec/metanorma/html/renderer/liquid_templates_spec.rb'
28
-
29
- # Offense count: 3
30
- # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
31
- Lint/DuplicateBranch:
32
- Exclude:
33
- - 'lib/metanorma/html/base_renderer.rb'
34
- - 'lib/metanorma/html/renderers/inline_renderer.rb'
35
- - 'lib/metanorma/html/standard_renderer.rb'
36
-
37
- # Offense count: 2
38
- # Configuration parameters: AllowComments, AllowEmptyLambdas.
39
- Lint/EmptyBlock:
40
- Exclude:
41
- - 'spec/metanorma/iso_document/metadata/title_roundtrip_spec.rb'
42
-
43
- # Offense count: 4
44
- # Configuration parameters: AllowedParentClasses.
45
- Lint/MissingSuper:
46
- Exclude:
47
- - 'lib/metanorma/html/drops/figure_drop.rb'
48
- - 'lib/metanorma/html/drops/formula_drop.rb'
49
- - 'lib/metanorma/html/drops/sourcecode_drop.rb'
50
- - 'lib/metanorma/mirror/id_strategy/positional.rb'
51
-
52
- # Offense count: 1
53
- Lint/StructNewOverride:
54
- Exclude:
55
- - 'lib/metanorma/html/component/index_term_collector.rb'
56
-
57
- # Offense count: 23
58
- # This cop supports safe autocorrection (--autocorrect).
59
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
60
- # NotImplementedExceptions: NotImplementedError
61
- Lint/UnusedMethodArgument:
62
- Exclude:
63
- - 'lib/metanorma/mirror/handlers/formula.rb'
64
- - 'lib/metanorma/mirror/handlers/sourcecode.rb'
65
- - 'lib/metanorma/mirror/output/html_renderers/block_renderers.rb'
66
- - 'lib/metanorma/mirror/output/html_renderers/list_renderers.rb'
67
- - 'lib/metanorma/mirror/output/html_renderers/section_renderers.rb'
68
- - 'lib/metanorma/mirror/output/html_renderers/structural_renderers.rb'
69
- - 'lib/metanorma/mirror/output/html_renderers/table_renderers.rb'
70
- - 'spec/metanorma/mirror/handler_registry_spec.rb'
71
- - 'spec/metanorma/mirror/html_renderer_spec.rb'
72
-
73
- # Offense count: 114
74
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
75
- Metrics/AbcSize:
76
- Enabled: false
77
-
78
- # Offense count: 12
79
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
80
- # AllowedMethods: refine
81
- Metrics/BlockLength:
82
- Max: 76
83
-
84
- # Offense count: 3
85
- # Configuration parameters: CountBlocks, CountModifierForms.
86
- Metrics/BlockNesting:
87
- Max: 4
88
-
89
- # Offense count: 84
90
- # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
91
- Metrics/CyclomaticComplexity:
92
- Enabled: false
93
-
94
- # Offense count: 149
95
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
96
- Metrics/MethodLength:
97
- Max: 102
98
-
99
- # Offense count: 3
100
- # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
101
- Metrics/ParameterLists:
102
- Max: 7
103
-
104
- # Offense count: 68
105
- # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
106
- Metrics/PerceivedComplexity:
107
- Enabled: false
108
-
109
- # Offense count: 52
110
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
111
- # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
112
- Naming/MethodParameterName:
113
- Exclude:
114
- - 'lib/metanorma/html/base_renderer.rb'
115
- - 'lib/metanorma/html/component/footnote_collector.rb'
116
- - 'lib/metanorma/html/drops/sourcecode_drop.rb'
117
- - 'lib/metanorma/html/iso_renderer.rb'
118
- - 'lib/metanorma/html/renderers/block_renderer.rb'
119
- - 'lib/metanorma/html/renderers/inline_renderer.rb'
120
- - 'spec/metanorma/html/renderer/footnote_collector_spec.rb'
121
-
122
- # Offense count: 4
123
- # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
124
- # AllowedMethods: call
125
- # WaywardPredicates: infinite?, nonzero?
126
- Naming/PredicateMethod:
127
- Exclude:
128
- - 'lib/metanorma/html/base_renderer.rb'
129
- - 'lib/metanorma/html/drops/biblio_entry_drop.rb'
130
- - 'lib/metanorma/html/renderers/inline_renderer.rb'
131
-
132
- # Offense count: 3
133
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
134
- # NamePrefix: is_, has_, have_, does_
135
- # ForbiddenPrefixes: is_, has_, have_, does_
136
- # AllowedMethods: is_a?
137
- # MethodDefinitionMacros: define_method, define_singleton_method
138
- Naming/PredicatePrefix:
139
- Exclude:
140
- - 'spec/**/*'
141
- - 'lib/metanorma/html/base_renderer.rb'
142
- - 'lib/metanorma/html/drops/biblio_entry_drop.rb'
143
-
144
- # Offense count: 1
145
- Performance/MapMethodChain:
146
- Exclude:
147
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
148
-
149
- # Offense count: 7
150
- RSpec/BeforeAfterAll:
151
- Exclude:
152
- - '**/spec/spec_helper.rb'
153
- - '**/spec/rails_helper.rb'
154
- - '**/spec/support/**/*.rb'
155
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
156
-
157
- # Offense count: 14
158
- # Configuration parameters: Prefixes, AllowedPatterns.
159
- # Prefixes: when, with, without
160
- RSpec/ContextWording:
161
- Exclude:
162
- - 'spec/metanorma/html/renderer/theme_spec.rb'
163
- - 'spec/metanorma/mirror/html_renderer_spec.rb'
164
-
165
- # Offense count: 32
166
- # Configuration parameters: IgnoredMetadata.
167
- RSpec/DescribeClass:
168
- Enabled: false
169
-
170
- # Offense count: 234
171
- # Configuration parameters: CountAsOne.
172
- RSpec/ExampleLength:
173
- Max: 37
174
-
175
- # Offense count: 2
176
- RSpec/LeakyConstantDeclaration:
177
- Exclude:
178
- - 'spec/metanorma/html/renderer/class_ownership_spec.rb'
179
- - 'spec/metanorma/html/renderer/liquid_templates_spec.rb'
180
-
181
- # Offense count: 5
182
- RSpec/MultipleDescribes:
183
- Exclude:
184
- - 'spec/metanorma/document_spec.rb'
185
- - 'spec/metanorma/html/flavor_registry_spec.rb'
186
- - 'spec/metanorma/mirror/handlers/remaining_handlers_spec.rb'
187
- - 'spec/metanorma/mirror/serialization_spec.rb'
188
- - 'spec/metanorma/standard_document/sections_spec.rb'
189
-
190
- # Offense count: 1
191
- # Configuration parameters: AllowSubject.
192
- RSpec/MultipleMemoizedHelpers:
193
- Max: 7
194
-
195
- # Offense count: 30
196
- # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
197
- # SupportedStyles: always, named_only
198
- RSpec/NamedSubject:
199
- Exclude:
200
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
201
-
202
- # Offense count: 1076
203
- # Configuration parameters: AllowedPatterns.
204
- # AllowedPatterns: ^expect_, ^assert_
205
- RSpec/NoExpectationExample:
206
- Enabled: false
207
-
208
- # Offense count: 29
209
- # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
210
- # SupportedInflectors: default, active_support
211
- RSpec/SpecFilePathFormat:
212
- Enabled: false
213
-
214
- # Offense count: 5
215
- # This cop supports safe autocorrection (--autocorrect).
216
- Style/ComparableClamp:
217
- Exclude:
218
- - 'lib/metanorma/html/iso_renderer.rb'
219
- - 'lib/metanorma/html/renderers/section_renderer.rb'
220
- - 'lib/metanorma/html/standard_renderer.rb'
@@ -1,8 +0,0 @@
1
- # 01 — Split multi-class files into one-class-per-file — DONE
2
-
3
- All model files now contain exactly one class per file. Verified: every file under `lib/metanorma/document/`, `lib/metanorma/standard_document/`, `lib/metanorma/iso_document/`, `lib/metanorma/bipm_document/`, `lib/metanorma/itu_document/`, `lib/metanorma/ietf_document/`, `lib/metanorma/cc_document/` is single-class.
4
-
5
- Nested classes that are only used internally by their parent (e.g. `AnnotationContainer::Annotation`) are legitimate and NOT split.
6
-
7
- ## Code quality requirements
8
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,6 +0,0 @@
1
- # 02 — Remove misplaced `data/dist/iso_document/frontend/` artifacts — DONE
2
-
3
- `data/dist/iso_document/frontend/` directory no longer exists. Frontend build artifacts are correctly placed in `frontend/dist/` and included in gemspec via `Dir.glob("frontend/dist/*")`.
4
-
5
- ## Code quality requirements
6
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,11 +0,0 @@
1
- # 03 — Align frontend IIFE build and GHA gem release with docbook pattern — DONE
2
-
3
- Aligned with docbook project:
4
- - `Rakefile` has `build_frontend` task + release hook
5
- - `gemspec` includes `frontend/dist/*`
6
- - `.github/workflows/rake.yml` has `after-setup-ruby: cd frontend && npm install && npm run build`
7
- - `frontend/vite.config.ts` produces `app.iife.js` + `app.css`
8
- - `.gitignore` has `frontend/node_modules/` and `frontend/dist/`
9
-
10
- ## Code quality requirements
11
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,9 +0,0 @@
1
- # 04 — Data-centric theme system: config files per flavor — DONE
2
-
3
- All 13 flavor themes extracted to `data/themes/{flavor}.yaml`. `Theme.load(:iso)` reads YAML and applies overrides. BaseRenderer provides default `Theme.new`. Every flavor renderer uses `Theme.load(:flavor_name)`.
4
-
5
- ### Remaining enhancement
6
- Publisher metadata (publishers, publisher_name, logo_map, font_url) still hardcoded in flavor renderers. These should move into theme YAML config so flavor renderers can be auto-generated from config alone.
7
-
8
- ## Code quality requirements
9
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,16 +0,0 @@
1
- # 05 — Migrate all HTML generation to Liquid templates — DONE
2
-
3
- All HTML element generation uses Liquid templates. Zero raw HTML string injection via `@output <<` remains. The `tag()` helper has been removed from `base_renderer.rb`. All remaining `@output <<` calls are text streaming (`escape_html`, whitespace, raw content passthrough) — not HTML element generation.
4
-
5
- 32+ Liquid templates exist in `lib/metanorma/html/templates/`. The generic `_element.html.liquid` handles most tag wrapping. Specialized templates exist for tables, lists, figures, headings, math, links, etc.
6
-
7
- ### OOP Liquid pattern
8
- All rendering uses the `capture_output` + `render_liquid` pattern:
9
- 1. Capture child content into a Ruby string via `capture_output`
10
- 2. Pass captured content to `render_liquid("_template.html.liquid", assigns)`
11
- 3. Result is appended to `@output` by the caller
12
-
13
- Drop classes (`Drops::*`) are used for complex objects that need pre-rendered HTML fields (e.g. `BiblioEntryDrop`, `FigureDrop`).
14
-
15
- ## Code quality requirements
16
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,16 +0,0 @@
1
- # 06 — Integrate pubid library for publication identifier handling — DONE
2
-
3
- ## What was done
4
- 1. Added `pubid ~> 2.0` to gemspec dependency
5
- 2. Added `gem "pubid", path: "../../mn/pubid"` to Gemfile for local dev
6
- 3. Created `lib/metanorma/html/concerns/pubid_rendering.rb` — `PubidRendering` module with:
7
- - `FLAVOR_PUBID_MAP` mapping document class names to pubid modules
8
- - `parse_pubid(docidentifier_string)` — flavor-aware pubid parsing
9
- - `pubid_to_html(identifier)` — renders to semantic HTML with CSS classes
10
- - `resolve_pubid_module` — auto-detects flavor from renderer class
11
- 4. Wired into `BaseRenderer` via `include PubidRendering`
12
- 5. Refactored `render_bibitem_content` in `standard_renderer.rb` to try pubid first
13
- 6. Created specs in `pubid_rendering_spec.rb`
14
-
15
- ## Code quality requirements
16
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,39 +0,0 @@
1
- # 07 — Integrate relaton-bib library (partially complete)
2
-
3
- ## Status
4
- - **Done**: relaton-bib dependency added, 4 models replaced via inheritance, `require` at module level
5
- - **Blocked**: Most models have incompatible XML schemas (different attribute names/types, different XML mappings)
6
-
7
- ## What was done
8
- 1. Added `relaton-bib ~> 2.1` to gemspec dependency
9
- 2. Added `require "relaton/bib"` to `lib/metanorma/document/relaton.rb`
10
- 3. Replaced 4 models with inheritance from relaton-bib:
11
- - `Phone` < `::Relaton::Bib::Phone` (exact match)
12
- - `PriceType` < `::Relaton::Bib::Price` (exact match)
13
- - `BibItemLocality` < `::Relaton::Bib::Locality` (exact match)
14
- - `Edition` < `::Relaton::Bib::Edition` (inherits + adds `language` attribute)
15
-
16
- ## Why most models can't be directly replaced
17
- The 53 relaton models in our project have different XML schemas from relaton-bib's models:
18
-
19
- | Difference | Our models | relaton-bib |
20
- |---|---|---|
21
- | Attribute names | `on` (BibliographicDate), `bib_locality` (LocalityStack), `validity_begins` (ValidityType) | `at`, `locality`, `begins` |
22
- | Attribute types | `Components::DataTypes::*` throughout | `LocalizedString`, `LocalizedMarkedUpString` |
23
- | XML mapping | `map_attribute` for medium, `map_all_content` for logo | `map_element` for medium, `map_element "image"` for logo |
24
- | Extra attributes | `language` on Edition, `id` on DocumentIdentifier, `stage_abbreviation` on DocumentStatus | Not present |
25
- | Mixed content | Used in TypedTitleString (em/fn/stem/strong/sub/sup/tt/variant) | Plain content |
26
- | Model nesting | `CopyrightOwner` wraps `Organization` | `Contributor` as owner |
27
-
28
- A full replacement requires updating all 86 consuming references and adapting to relaton-bib's API. This is a separate project-level migration.
29
-
30
- ## Remaining work for full migration
31
- 1. Update consuming code (86 references) to use relaton-bib attribute names
32
- 2. For models with extra attributes: inherit from relaton-bib and add extras
33
- 3. For models with structural differences: create adapter classes
34
- 4. Remove `lib/metanorma/document/relaton/` once fully migrated
35
- 5. Update autoload configuration
36
- 6. Integration specs for relaton-bib model usage
37
-
38
- ## Code quality requirements
39
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,25 +0,0 @@
1
- # 08 — Refactor renderer architecture for OCP and DRY — DONE
2
-
3
- ### Completed decomposition (Phase 1)
4
- BaseRenderer originally included three concern modules:
5
- - `InlineRendering` (~590 lines, 39 methods)
6
- - `BlockRendering` (~295 lines, 24 methods)
7
- - `SectionRendering` (~90 lines, 8 methods)
8
-
9
- ### Completed composition (Phase 2 — TODO 13)
10
- Module includes replaced with composition. Each module became a standalone class:
11
- - `Renderers::InlineRenderer` at `lib/metanorma/html/renderers/inline_renderer.rb`
12
- - `Renderers::BlockRenderer` at `lib/metanorma/html/renderers/block_renderer.rb`
13
- - `Renderers::SectionRenderer` at `lib/metanorma/html/renderers/section_renderer.rb`
14
- - `Renderers::PubidRenderer` at `lib/metanorma/html/renderers/pubid_renderer.rb`
15
-
16
- BaseRenderer is now a thin coordinator with delegation wrappers for backward compatibility.
17
- Old concern modules at `lib/metanorma/html/concerns/` are no longer referenced and can be removed.
18
-
19
- ### Remaining enhancements
20
- - Publisher metadata (flavor_publishers, flavor_publisher_name, publisher_logo_map) duplicated across 12+ flavor renderers. See TODO 11 for config-driven migration.
21
- - Config-driven section ordering. See TODO 14.
22
- - Theme directories per flavor. See TODO 15.
23
-
24
- ## Code quality requirements
25
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,14 +0,0 @@
1
- # 09 — Eliminate code smells and enforce project constraints — DONE
2
-
3
- ## Fixed
4
- - `respond_to?` duck-typing eliminated from inline_rendering.rb (replaced with `is_a?`)
5
- - `tag()` helper removed from base_renderer (replaced with Liquid `_element.html.liquid`)
6
- - All `@output <<` raw HTML generation eliminated
7
- - `method_missing` + `respond_to_missing?` eliminated from RendererContext (replaced with explicit `def` methods)
8
- - `public_send(attr)` in boilerplate_to_xml replaced with explicit `collect_boilerplate_part` helper
9
- - `public_send(setter)` in Theme.load is acceptable — setter list validated via `VALID_KEYS`/`SETTERS` constants
10
- - `instance_variable_get`/`instance_variable_set` eliminated from Drops and Component::Base (replaced with `OutputProxy` wrapper)
11
- - `# frozen_string_literal: true` added to all 48 inline component files
12
-
13
- ## Code quality requirements
14
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,24 +0,0 @@
1
- # 10 — Comprehensive spec coverage for HTML rendering pipeline — DONE
2
-
3
- ## Status
4
- All HTML renderer specs use real model instances (zero doubles). Coverage spans theme loading, config-driven ordering, composition, pubid, metadata, CSS generation, and Liquid templates.
5
-
6
- ## Spec count
7
- - Current: 159+ examples passing (0 failures) — ~40 pre-existing moxml failures excluded (upstream lutaml-model issue)
8
-
9
- ## Spec files
10
- 1. `theme_spec.rb` — 111 specs: defaults, all 13 flavor loading, publisher metadata, directory-based themes, lutaml-model schema validation
11
- 2. `config_metadata_spec.rb` — 8 specs: theme auto-resolution, publisher/logo config from YAML
12
- 3. `config_preface_spec.rb` — 8 specs: config-driven preface ordering (ordered mode, wrapped mode, clause filtering, delegation) using real IsoPreface models
13
- 4. `composition_spec.rb` — 10 specs: sub-renderer composition, delegation wrappers, theme resolution using real IsoClauseSection models
14
- 5. `pubid_rendering_spec.rb` — 3 specs: pubid parsing and HTML generation via composition using real IsoDocument::Root
15
- 6. `base_renderer_spec.rb` — 19 specs: escape_html, element_attrs, utility methods
16
- 7. `liquid_templates_spec.rb` — 62 specs: all 48 templates + 12 individual template tests
17
- 8. `relaton_bib_spec.rb` — relaton-bib model inheritance verification
18
-
19
- ## Key decisions
20
- - **Zero doubles**: All specs use real lutaml-model instances (IsoPreface, IsoClauseSection, IsoForewordSection, IsoDocument::Root, Theme)
21
- - **Zero instance_variable_set**: Only used in pubid_rendering_spec for setting @document (coordinator's required state) — acceptable for test setup
22
-
23
- ## Code quality requirements
24
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. Never use private send methods (breaks encapsulation), instance_variable_set/get, never use respond_to? (poor typing). NEVER use RSpec doubles — use real model instances.
@@ -1,20 +0,0 @@
1
- # 11 — Config-driven flavor metadata: eliminate boilerplate renderers — DONE
2
-
3
- ## What was done
4
- All 13 theme YAML files contain publisher metadata:
5
- ```yaml
6
- publishers:
7
- - "ISO"
8
- publisher_name: "ISO"
9
- logos:
10
- "ISO": "iso-logo.svg"
11
- ```
12
-
13
- BaseRenderer reads publishers/logos from theme via `theme.publishers`, `theme.publisher_name`, `theme.logos`. No renderer code overrides these.
14
-
15
- 10 flavor renderers are empty shells (0 methods, just inherit IsoRenderer). They exist because `Generator` maps document classes to renderer classes, but all customization comes from theme YAML config.
16
-
17
- Theme auto-resolves from document type via `FLAVOR_MAP` — no manual `theme` override needed in any renderer.
18
-
19
- ## Code quality requirements
20
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,6 +0,0 @@
1
- # 12 — Add frozen_string_literal to all Ruby files — DONE
2
-
3
- All `lib/` and `spec/` Ruby files already have `# frozen_string_literal: true` on line 1. No changes needed.
4
-
5
- ## Code quality requirements
6
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,96 +0,0 @@
1
- # 13 — Extract module includes into composition — DONE
2
-
3
- ## Problem
4
- BaseRenderer is a God class with 180+ public methods from 4 mixed-in modules:
5
- - `InlineRendering` (~590 lines, 39 methods)
6
- - `BlockRendering` (~295 lines, 24 methods)
7
- - `SectionRendering` (~90 lines, 8 methods)
8
- - `PubidRendering` (~55 lines, 2 methods)
9
-
10
- Module includes break OCP and encapsulation — all module methods become public on the single class, making it impossible to reason about responsibilities in isolation.
11
-
12
- ## Architecture
13
-
14
- Replace `include` with composition. Each module becomes a standalone class that receives a reference to the coordinator for cross-concern calls:
15
-
16
- ```
17
- BaseRenderer (coordinator, ~50 methods)
18
- ├── InlineRenderer (inline elements, 39 methods)
19
- ├── BlockRenderer (block elements, 24 methods)
20
- ├── SectionRenderer (sections, 8 methods)
21
- └── PubidRenderer (pubid parsing, 2 methods)
22
- ```
23
-
24
- ### Cross-concern dependencies (one-way, clean extraction)
25
-
26
- InlineRenderer needs from coordinator:
27
- - `escape_html`, `safe_attr`, `element_attrs`, `capture_output`, `render_liquid`
28
- - `render_paragraph`, `render_inline_element` (recursive dispatch)
29
- - `@output`, `@footnote_collector`, `@index_term_collector`
30
-
31
- BlockRenderer needs from coordinator:
32
- - `escape_html`, `safe_attr`, `element_attrs`, `capture_output`, `render_liquid`
33
- - `render_mixed_inline`, `render_inline_element`, `render_mixed_content_in_order`
34
- - `walk_ordered`, `block_element?`, `render` (recursive dispatch)
35
- - `@output`, `renderer_context`
36
-
37
- SectionRenderer needs from coordinator:
38
- - `escape_html`, `safe_attr`, `element_attrs`, `capture_output`, `render_liquid`
39
- - `walk_ordered`, `render`, `render_note`, `extract_plain_text`
40
- - `@output`
41
-
42
- PubidRenderer needs from coordinator:
43
- - `escape_html`, `flavor_name`
44
-
45
- ### Implementation plan
46
-
47
- 1. Create `InlineRenderer` class at `lib/metanorma/html/renderers/inline_renderer.rb`
48
- - Receives `coordinator` in constructor
49
- - Moves all methods from `InlineRendering` module
50
- - Delegates shared utility calls to coordinator
51
- 2. Create `BlockRenderer` class at `lib/metanorma/html/renderers/block_renderer.rb`
52
- - Same pattern
53
- 3. Create `SectionRenderer` class at `lib/metanorma/html/renderers/section_renderer.rb`
54
- - Same pattern
55
- 4. Create `PubidRenderer` class at `lib/metanorma/html/renderers/pubid_renderer.rb`
56
- - Same pattern
57
- 5. Update `BaseRenderer` to instantiate sub-renderers and delegate
58
- 6. Update `RendererContext` to delegate through coordinator's sub-renderers
59
- 7. Update all flavor renderers (IsoRenderer, StandardRenderer, etc.) for new API
60
- 8. Update all Drop classes that call `renderer.method_name`
61
- 9. Ensure all existing specs pass
62
-
63
- ### Delegation pattern
64
-
65
- ```ruby
66
- class BaseRenderer
67
- attr_reader :inline_renderer, :block_renderer, :section_renderer, :pubid_renderer
68
-
69
- def initialize
70
- @inline_renderer = InlineRenderer.new(self)
71
- @block_renderer = BlockRenderer.new(self)
72
- @section_renderer = SectionRenderer.new(self)
73
- @pubid_renderer = PubidRenderer.new(self)
74
- # ...
75
- end
76
-
77
- # Delegate for backward compatibility during migration
78
- def render_paragraph(...) = @block_renderer.render_paragraph(...)
79
- def render_em(...) = @inline_renderer.render_em(...)
80
- # etc.
81
- end
82
- ```
83
-
84
- ### Flavor renderers
85
-
86
- Sub-renderers can be extended per flavor:
87
- ```ruby
88
- class IsoSectionRenderer < SectionRenderer
89
- def render_preface(preface, **)
90
- # ISO-specific preface ordering
91
- end
92
- end
93
- ```
94
-
95
- ## Code quality requirements
96
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,31 +0,0 @@
1
- # 14 — Config-driven preface and clause ordering — DONE
2
-
3
- ## What was done
4
-
5
- ### Theme config attributes added:
6
- - `preface_order` — array of section names, controls rendering order (default: `foreword introduction abstract clause acknowledgements executivesummary`)
7
- - `preface_wrap` — boolean, wraps preface content in a container div with heading (default: `false`)
8
- - `clause_order` — array of section names for clause ordering (default: `sections annex bibliography indexsect`)
9
- - `toc_filter_types` — array of clause types to exclude from preface rendering (default: `[]`)
10
-
11
- ### All 13 theme YAML files updated:
12
- - ISO, IEC, IEEE, IETF, ITU, IHO, CC, BIPM, OIML, PDFA, Ribose, ICC: default ordering
13
- - OGC: `preface_order: [clause]`, `preface_wrap: true`, `toc_filter_types: [toc]`
14
-
15
- ### Code changes:
16
- - `Theme` — added `preface_order`, `preface_wrap`, `clause_order`, `toc_filter_types` to VALID_KEYS, attr_accessor, and defaults
17
- - `SectionRenderer` — config-driven `render_preface` reads from theme, delegates to `render_ordered_preface` or `render_wrapped_preface` based on `preface_wrap`
18
- - `BaseRenderer` — added `render_preface` delegation to section_renderer
19
- - `IsoRenderer` — deleted hardcoded `render_preface` method (config-driven version replaces it)
20
- - `OgcRenderer` — deleted hardcoded `render_preface` override (now empty shell, all behavior from YAML)
21
- - Template `_ogc_preface.html.liquid` renamed to `_wrapped_preface.html.liquid` (generic name)
22
-
23
- ### Specs added:
24
- - `config_preface_spec.rb` — 8 specs covering ordered mode, wrapped mode, clause filtering, and delegation
25
- - `theme_spec.rb` — 4 specs for section ordering defaults and OGC overrides
26
-
27
- ### Key principle enforced:
28
- No flavor-specific knowledge (no "ogc", no hardcoded ordering) in generic renderer code. All behavior comes from theme YAML config.
29
-
30
- ## Code quality requirements
31
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).
@@ -1,46 +0,0 @@
1
- # 15 — Theme directories per flavor with data-centric config — DONE
2
-
3
- ## What was done
4
-
5
- ### Theme class changes:
6
- - Added `theme_dir` attribute (set when loaded from directory, nil for flat file themes)
7
- - `Theme.load(flavor)` now checks for directory format first (`data/themes/{flavor}/theme.yaml`), falls back to flat file (`data/themes/{flavor}.yaml`)
8
- - Extracted `from_file`, `from_directory`, `apply_overrides` class methods for clean separation
9
- - Added `theme_templates_dir` — returns `{theme_dir}/templates/` if it exists
10
- - Added `theme_assets_dir` — returns `{theme_dir}/assets/` if it exists
11
- - Added `theme_css_path` — returns `{theme_dir}/custom.css` if it exists
12
- - Added `resolve_template(template_name)` — checks flavor templates dir first, falls back to shared templates
13
- - Added `resolve_asset(filename)` — checks flavor assets dir, returns nil if not found
14
-
15
- ### BaseRenderer changes:
16
- - `render_liquid` uses `theme.resolve_template(template_name)` instead of hardcoded `File.join(TEMPLATES_ROOT, ...)`
17
- - `load_logo_svg` checks `theme.resolve_asset(filename)` before shared `LOGO_DIR`
18
- - `build_styles` appends `theme.theme_css_path` content if present
19
-
20
- ### Directory-based theme structure (opt-in):
21
- ```
22
- data/themes/
23
- iso.yaml # flat file — still works as before
24
- ogc.yaml # flat file — still works as before
25
- {flavor}/ # directory format — new support
26
- theme.yaml # palette, fonts, layout, ordering, publisher metadata
27
- custom.css # per-flavor CSS overrides (optional)
28
- templates/ # per-flavor Liquid template overrides (optional)
29
- _cover.html.liquid
30
- assets/ # per-flavor assets: logos, images (optional)
31
- {flavor}-logo.svg
32
- ```
33
-
34
- ### Backward compatibility:
35
- - All 13 existing flat YAML theme files continue to work unchanged
36
- - `theme_dir` is nil for flat-file themes, so resolution always falls through to shared paths
37
- - No migration needed — directory format is opt-in
38
-
39
- ### Specs added:
40
- - 12 new specs in `theme_spec.rb` covering directory loading, template/asset/CSS resolution, backward compat
41
-
42
- ### Future consideration:
43
- When theme config moves to per-flavor gems, `Theme.load` can be extended to search gem data directories. The API (`theme.resolve_template`, `theme.resolve_asset`, etc.) stays the same — only the path resolution changes.
44
-
45
- ## Code quality requirements
46
- Ensure code cleanliness and OOP and MECE and fully model-driven, semantically-driven and open/closed principle, DRY, performance. ultrathink. Always think about what can we improve here in architecture and code? Make sure we have good specs throughout. Never use private send methods (breaks encapsulation), instance_variable_set/get, and never use respond_to? (poor typing).