metanorma-document 0.2.0 → 0.2.2

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +231 -53
  3. data/README.adoc +59 -18
  4. data/data/stylesheets/components/bibliography.css +2 -2
  5. data/data/stylesheets/components/inline.css +11 -12
  6. data/docs/html-renderer.adoc +261 -0
  7. data/lib/metanorma/document/version.rb +1 -1
  8. data/lib/metanorma/html/base_renderer.rb +210 -257
  9. data/lib/metanorma/html/bipm_renderer.rb +0 -1
  10. data/lib/metanorma/html/cc_renderer.rb +0 -1
  11. data/lib/metanorma/html/drops/admonition_drop.rb +26 -0
  12. data/lib/metanorma/html/drops/block_element_drop.rb +20 -0
  13. data/lib/metanorma/html/drops/example_drop.rb +35 -0
  14. data/lib/metanorma/html/drops/figure_drop.rb +53 -0
  15. data/lib/metanorma/html/drops/formula_drop.rb +44 -0
  16. data/lib/metanorma/html/drops/note_drop.rb +32 -0
  17. data/lib/metanorma/html/drops/sourcecode_drop.rb +37 -0
  18. data/lib/metanorma/html/drops.rb +7 -0
  19. data/lib/metanorma/html/iec_renderer.rb +0 -1
  20. data/lib/metanorma/html/ieee_renderer.rb +0 -1
  21. data/lib/metanorma/html/ietf_renderer.rb +0 -1
  22. data/lib/metanorma/html/iho_renderer.rb +0 -1
  23. data/lib/metanorma/html/iso_renderer.rb +77 -209
  24. data/lib/metanorma/html/itu_renderer.rb +0 -1
  25. data/lib/metanorma/html/ogc_renderer.rb +5 -6
  26. data/lib/metanorma/html/oiml_renderer.rb +0 -1
  27. data/lib/metanorma/html/pdfa_renderer.rb +0 -1
  28. data/lib/metanorma/html/ribose_renderer.rb +0 -1
  29. data/lib/metanorma/html/standard_renderer.rb +63 -82
  30. data/lib/metanorma/html/templates/_admonition.html.liquid +4 -0
  31. data/lib/metanorma/html/templates/_doc_title.html.liquid +1 -1
  32. data/lib/metanorma/html/templates/_example.html.liquid +3 -0
  33. data/lib/metanorma/html/templates/_figure.html.liquid +6 -0
  34. data/lib/metanorma/html/templates/_formula.html.liquid +6 -0
  35. data/lib/metanorma/html/templates/_iso_doc_title.html.liquid +2 -2
  36. data/lib/metanorma/html/templates/_note.html.liquid +3 -0
  37. data/lib/metanorma/html/templates/_sourcecode.html.liquid +4 -0
  38. data/lib/metanorma/html.rb +0 -1
  39. metadata +16 -3
  40. data/lib/metanorma/html/component_registry.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc7125fd4984bbedebb8d471fc29d0d34d5b56b7de1ec518570bc27f8e0671d5
4
- data.tar.gz: bc63e4f58ba6053d66df6a2671737c0ce051057ef4e0b14fc51154d050ca0c67
3
+ metadata.gz: d03f7b4977f3220a59c871eb1e62e2f00042fd2b56164a41ed6361b18ddb1fd2
4
+ data.tar.gz: 274a96e49ab7923362edbcf4733214f7fdca6aa75699623da8c065c8958d5cb3
5
5
  SHA512:
6
- metadata.gz: 45e13915f1b88579d06b94968c5a7f469fdbf77b6980cf3cb68d6747bb9fd1a87d111c8388d2f0f337ba5ccde71aa96c7f755ca6d0080f8ccafa154a15ed7075
7
- data.tar.gz: 1a6ab72e96afe880682ffb9646273e794dec60ce1a2e208d794054fe99ea38c6adf09672678a8234ebf805b800ab491bfa01332efcd663b65c403e8cd617712c
6
+ metadata.gz: 06a95eb083a619c0eb43c0acd394e171fa812d2e9eb9b592fa0f551568f6eae25f5ec824e787354d8e1c2bb95ad10aedaa10615e0bcb31b2a022bde8f212025a
7
+ data.tar.gz: da8eb0c5a86def7f9cd05e173957404a1ca047270d4ee12043cf696687e9ae9a38b01c91fbec7097af074ed3df697e75bf46d934d9a22d1ed0b74a957ee29b1d
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-04-22 12:28:09 UTC using RuboCop version 1.86.1.
3
+ # on 2026-05-06 04:06:53 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -13,114 +13,220 @@ Gemspec/RequiredRubyVersion:
13
13
 
14
14
  # Offense count: 1
15
15
  # This cop supports safe autocorrection (--autocorrect).
16
- Layout/ClosingParenthesisIndentation:
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
17
19
  Exclude:
18
- - 'lib/metanorma/html/renderer.rb'
20
+ - 'lib/metanorma/html/component/index_term_collector.rb'
19
21
 
20
- # Offense count: 1
22
+ # Offense count: 5
21
23
  # This cop supports safe autocorrection (--autocorrect).
22
- # Configuration parameters: EnforcedStyle, IndentationWidth.
23
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
24
- Layout/FirstArgumentIndentation:
24
+ Layout/EmptyLineAfterGuardClause:
25
25
  Exclude:
26
- - 'lib/metanorma/html/renderer.rb'
26
+ - 'lib/metanorma/html/generator.rb'
27
+ - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
27
28
 
28
- # Offense count: 580
29
+ # Offense count: 11
30
+ # This cop supports safe autocorrection (--autocorrect).
31
+ # Configuration parameters: EnforcedStyle.
32
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
33
+ Layout/EmptyLinesAroundClassBody:
34
+ Exclude:
35
+ - 'lib/metanorma/html/bipm_renderer.rb'
36
+ - 'lib/metanorma/html/cc_renderer.rb'
37
+ - 'lib/metanorma/html/iec_renderer.rb'
38
+ - 'lib/metanorma/html/ieee_renderer.rb'
39
+ - 'lib/metanorma/html/ietf_renderer.rb'
40
+ - 'lib/metanorma/html/iho_renderer.rb'
41
+ - 'lib/metanorma/html/itu_renderer.rb'
42
+ - 'lib/metanorma/html/ogc_renderer.rb'
43
+ - 'lib/metanorma/html/oiml_renderer.rb'
44
+ - 'lib/metanorma/html/pdfa_renderer.rb'
45
+ - 'lib/metanorma/html/ribose_renderer.rb'
46
+
47
+ # Offense count: 5
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
50
+ Layout/ExtraSpacing:
51
+ Exclude:
52
+ - 'lib/metanorma/html/bipm_renderer.rb'
53
+ - 'lib/metanorma/html/generator.rb'
54
+ - 'lib/metanorma/html/iho_renderer.rb'
55
+ - 'lib/metanorma/html/theme.rb'
56
+
57
+ # Offense count: 718
29
58
  # This cop supports safe autocorrection (--autocorrect).
30
59
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
31
60
  # URISchemes: http, https
32
61
  Layout/LineLength:
33
62
  Enabled: false
34
63
 
35
- # Offense count: 1
64
+ # Offense count: 3
36
65
  # This cop supports safe autocorrection (--autocorrect).
37
- # Configuration parameters: EnforcedStyle.
38
- # SupportedStyles: symmetrical, new_line, same_line
39
- Layout/MultilineMethodCallBraceLayout:
66
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
67
+ # SupportedStylesForExponentOperator: space, no_space
68
+ # SupportedStylesForRationalLiterals: space, no_space
69
+ Layout/SpaceAroundOperators:
40
70
  Exclude:
41
- - 'lib/metanorma/html/renderer.rb'
71
+ - 'lib/metanorma/html/bipm_renderer.rb'
72
+ - 'lib/metanorma/html/iho_renderer.rb'
73
+ - 'lib/metanorma/html/theme.rb'
42
74
 
43
- # Offense count: 2
75
+ # Offense count: 1
76
+ # Configuration parameters: AllowedMethods.
77
+ # AllowedMethods: enums
78
+ Lint/ConstantDefinitionInBlock:
79
+ Exclude:
80
+ - 'spec/metanorma/html/renderer/class_ownership_spec.rb'
81
+
82
+ # Offense count: 4
44
83
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
45
84
  Lint/DuplicateBranch:
46
85
  Exclude:
47
- - 'lib/metanorma/html/index_generator.rb'
48
- - 'lib/metanorma/html/renderer.rb'
86
+ - 'lib/metanorma/html/base_renderer.rb'
49
87
 
50
- # Offense count: 2
88
+ # Offense count: 3
51
89
  # Configuration parameters: AllowComments, AllowEmptyLambdas.
52
90
  Lint/EmptyBlock:
53
91
  Exclude:
92
+ - 'lib/metanorma/html/drops/formula_drop.rb'
54
93
  - 'spec/metanorma/iso_document/metadata/title_roundtrip_spec.rb'
55
94
 
95
+ # Offense count: 2
96
+ # Configuration parameters: AllowedParentClasses.
97
+ Lint/MissingSuper:
98
+ Exclude:
99
+ - 'lib/metanorma/html/drops/block_element_drop.rb'
100
+ - 'lib/metanorma/html/drops/footnote_drop.rb'
101
+
56
102
  # Offense count: 1
57
- # Configuration parameters: AllowedPatterns.
58
- # AllowedPatterns: (?-mix:(exactly|at_least|at_most)\(\d+\)\.times)
59
- Lint/UnreachableLoop:
103
+ Lint/StructNewOverride:
104
+ Exclude:
105
+ - 'lib/metanorma/html/component/index_term_collector.rb'
106
+
107
+ # Offense count: 2
108
+ # This cop supports safe autocorrection (--autocorrect).
109
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
110
+ # NotImplementedExceptions: NotImplementedError
111
+ Lint/UnusedMethodArgument:
60
112
  Exclude:
61
- - 'lib/metanorma/html/renderer.rb'
113
+ - 'lib/metanorma/html/component/index_section.rb'
114
+ - 'lib/metanorma/html/generator.rb'
62
115
 
63
116
  # Offense count: 1
64
117
  Lint/UselessConstantScoping:
65
118
  Exclude:
66
- - 'lib/metanorma/html/renderer.rb'
119
+ - 'lib/metanorma/html/base_renderer.rb'
67
120
 
68
- # Offense count: 26
121
+ # Offense count: 85
69
122
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
70
123
  Metrics/AbcSize:
71
- Exclude:
72
- - 'lib/metanorma/document/components/lists/list_item.rb'
73
- - 'lib/metanorma/html/index_generator.rb'
74
- - 'lib/metanorma/html/renderer.rb'
75
- - 'lib/metanorma/html/transformer.rb'
124
+ Enabled: false
76
125
 
77
- # Offense count: 11
126
+ # Offense count: 22
78
127
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
79
128
  # AllowedMethods: refine
80
129
  Metrics/BlockLength:
81
- Max: 139
130
+ Max: 66
82
131
 
83
132
  # Offense count: 2
84
133
  # Configuration parameters: CountBlocks, CountModifierForms.
85
134
  Metrics/BlockNesting:
86
135
  Max: 4
87
136
 
88
- # Offense count: 31
137
+ # Offense count: 64
89
138
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
90
139
  Metrics/CyclomaticComplexity:
91
140
  Exclude:
92
141
  - 'lib/metanorma/document/components/lists/list_item.rb'
93
- - 'lib/metanorma/html/index_generator.rb'
94
- - 'lib/metanorma/html/renderer.rb'
95
- - 'lib/metanorma/html/transformer.rb'
142
+ - 'lib/metanorma/html/base_renderer.rb'
143
+ - 'lib/metanorma/html/bipm_renderer.rb'
144
+ - 'lib/metanorma/html/component/index_term_collector.rb'
145
+ - 'lib/metanorma/html/drops/example_drop.rb'
146
+ - 'lib/metanorma/html/drops/figure_drop.rb'
147
+ - 'lib/metanorma/html/drops/formula_drop.rb'
148
+ - 'lib/metanorma/html/drops/note_drop.rb'
149
+ - 'lib/metanorma/html/generator.rb'
150
+ - 'lib/metanorma/html/iso_renderer.rb'
151
+ - 'lib/metanorma/html/ogc_renderer.rb'
152
+ - 'lib/metanorma/html/standard_renderer.rb'
153
+ - 'lib/metanorma/html/theme.rb'
96
154
  - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
97
155
 
98
- # Offense count: 33
156
+ # Offense count: 89
99
157
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
100
158
  Metrics/MethodLength:
101
- Max: 141
159
+ Max: 104
102
160
 
103
- # Offense count: 24
161
+ # Offense count: 1
162
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
163
+ Metrics/ParameterLists:
164
+ Max: 7
165
+
166
+ # Offense count: 55
104
167
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
105
168
  Metrics/PerceivedComplexity:
106
169
  Exclude:
107
170
  - 'lib/metanorma/document/components/lists/list_item.rb'
108
- - 'lib/metanorma/html/index_generator.rb'
109
- - 'lib/metanorma/html/renderer.rb'
110
- - 'lib/metanorma/html/transformer.rb'
171
+ - 'lib/metanorma/html/base_renderer.rb'
172
+ - 'lib/metanorma/html/bipm_renderer.rb'
173
+ - 'lib/metanorma/html/component/index_term_collector.rb'
174
+ - 'lib/metanorma/html/drops/example_drop.rb'
175
+ - 'lib/metanorma/html/drops/figure_drop.rb'
176
+ - 'lib/metanorma/html/drops/formula_drop.rb'
177
+ - 'lib/metanorma/html/drops/note_drop.rb'
178
+ - 'lib/metanorma/html/generator.rb'
179
+ - 'lib/metanorma/html/iso_renderer.rb'
180
+ - 'lib/metanorma/html/ogc_renderer.rb'
181
+ - 'lib/metanorma/html/standard_renderer.rb'
182
+ - 'lib/metanorma/html/theme.rb'
183
+ - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
111
184
 
112
- # Offense count: 1
185
+ # Offense count: 2
186
+ # This cop supports safe autocorrection (--autocorrect).
187
+ # Configuration parameters: EnforcedStyle, BlockForwardingName.
188
+ # SupportedStyles: anonymous, explicit
189
+ Naming/BlockForwarding:
190
+ Exclude:
191
+ - 'lib/metanorma/html/component/footnote_collector.rb'
192
+
193
+ # Offense count: 22
113
194
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
114
195
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
115
196
  Naming/MethodParameterName:
116
197
  Exclude:
117
- - 'lib/metanorma/html/renderer.rb'
198
+ - 'lib/metanorma/html/base_renderer.rb'
199
+ - 'lib/metanorma/html/component/footnote_collector.rb'
200
+ - 'lib/metanorma/html/drops/sourcecode_drop.rb'
201
+ - 'lib/metanorma/html/iso_renderer.rb'
202
+ - 'spec/metanorma/html/renderer/footnote_collector_spec.rb'
203
+
204
+ # Offense count: 2
205
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
206
+ # AllowedMethods: call
207
+ # WaywardPredicates: infinite?, nonzero?
208
+ Naming/PredicateMethod:
209
+ Exclude:
210
+ - 'lib/metanorma/html/base_renderer.rb'
118
211
 
119
- # Offense count: 10
212
+ # Offense count: 1
213
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
214
+ # NamePrefix: is_, has_, have_, does_
215
+ # ForbiddenPrefixes: is_, has_, have_, does_
216
+ # AllowedMethods: is_a?
217
+ # MethodDefinitionMacros: define_method, define_singleton_method
218
+ Naming/PredicatePrefix:
219
+ Exclude:
220
+ - 'lib/metanorma/html/standard_renderer.rb'
221
+
222
+ # Offense count: 13
120
223
  # Configuration parameters: IgnoredMetadata.
121
224
  RSpec/DescribeClass:
122
225
  Exclude:
123
226
  - 'spec/metanorma/document_spec.rb'
227
+ - 'spec/metanorma/html/renderer/class_ownership_spec.rb'
228
+ - 'spec/metanorma/html/renderer/dead_code_removal_spec.rb'
229
+ - 'spec/metanorma/html/renderer/section_rendering_spec.rb'
124
230
  - 'spec/metanorma/iso_document/metadata/title_roundtrip_spec.rb'
125
231
  - 'spec/metanorma/iso_document/roundtrip/bipm_roundtrip_spec.rb'
126
232
  - 'spec/metanorma/iso_document/roundtrip/cc_roundtrip_spec.rb'
@@ -131,36 +237,108 @@ RSpec/DescribeClass:
131
237
  - 'spec/metanorma/iso_document/roundtrip/oiml_collection_roundtrip_spec.rb'
132
238
  - 'spec/metanorma/iso_document/roundtrip/oiml_roundtrip_spec.rb'
133
239
 
134
- # Offense count: 1
240
+ # Offense count: 4
135
241
  # Configuration parameters: CountAsOne.
136
242
  RSpec/ExampleLength:
137
- Max: 6
243
+ Max: 8
244
+
245
+ # Offense count: 1
246
+ RSpec/LeakyConstantDeclaration:
247
+ Exclude:
248
+ - 'spec/metanorma/html/renderer/class_ownership_spec.rb'
138
249
 
139
250
  # Offense count: 1
140
251
  RSpec/MultipleDescribes:
141
252
  Exclude:
142
253
  - 'spec/metanorma/document_spec.rb'
143
254
 
144
- # Offense count: 279
255
+ # Offense count: 286
145
256
  # Configuration parameters: AllowedPatterns.
146
257
  # AllowedPatterns: ^expect_, ^assert_
147
258
  RSpec/NoExpectationExample:
148
259
  Enabled: false
149
260
 
150
- # Offense count: 16
261
+ # Offense count: 25
151
262
  # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
152
263
  # SupportedInflectors: default, active_support
153
264
  RSpec/SpecFilePathFormat:
154
265
  Enabled: false
155
266
 
156
267
  # Offense count: 2
268
+ # This cop supports safe autocorrection (--autocorrect).
269
+ # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
270
+ # RedundantRestArgumentNames: args, arguments
271
+ # RedundantKeywordRestArgumentNames: kwargs, options, opts
272
+ # RedundantBlockArgumentNames: blk, block, proc
273
+ Style/ArgumentsForwarding:
274
+ Exclude:
275
+ - 'lib/metanorma/html/component/footnote_collector.rb'
276
+
277
+ # Offense count: 1
278
+ # This cop supports safe autocorrection (--autocorrect).
279
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
280
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
281
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
282
+ # FunctionalMethods: let, let!, subject, watch
283
+ # AllowedMethods: lambda, proc, it
284
+ Style/BlockDelimiters:
285
+ Exclude:
286
+ - 'lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb'
287
+
288
+ # Offense count: 5
289
+ # This cop supports safe autocorrection (--autocorrect).
290
+ Style/ComparableClamp:
291
+ Exclude:
292
+ - 'lib/metanorma/html/base_renderer.rb'
293
+ - 'lib/metanorma/html/iso_renderer.rb'
294
+ - 'lib/metanorma/html/standard_renderer.rb'
295
+
296
+ # Offense count: 1
157
297
  # This cop supports unsafe autocorrection (--autocorrect-all).
158
- Style/IdenticalConditionalBranches:
298
+ # Configuration parameters: InverseMethods, InverseBlocks.
299
+ Style/InverseMethods:
159
300
  Exclude:
160
- - 'lib/metanorma/html/index_generator.rb'
301
+ - 'lib/metanorma/html/component/index_term_collector.rb'
161
302
 
162
303
  # Offense count: 1
163
- # Configuration parameters: Max.
164
- Style/SafeNavigationChainLength:
304
+ # This cop supports unsafe autocorrection (--autocorrect-all).
305
+ # Configuration parameters: EnforcedStyle.
306
+ # SupportedStyles: literals, strict
307
+ Style/MutableConstant:
308
+ Exclude:
309
+ - 'lib/metanorma/html/base_renderer.rb'
310
+
311
+ # Offense count: 1
312
+ # This cop supports safe autocorrection (--autocorrect).
313
+ Style/NegatedIfElseCondition:
314
+ Exclude:
315
+ - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
316
+
317
+ # Offense count: 1
318
+ # This cop supports safe autocorrection (--autocorrect).
319
+ Style/RedundantRegexpArgument:
320
+ Exclude:
321
+ - 'lib/metanorma/html/bipm_renderer.rb'
322
+
323
+ # Offense count: 2
324
+ # This cop supports safe autocorrection (--autocorrect).
325
+ Style/RescueModifier:
326
+ Exclude:
327
+ - 'lib/metanorma/html/generator.rb'
328
+
329
+ # Offense count: 1
330
+ # This cop supports unsafe autocorrection (--autocorrect-all).
331
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
332
+ # AllowedMethods: present?, blank?, presence, try, try!
333
+ Style/SafeNavigation:
334
+ Exclude:
335
+ - 'lib/metanorma/html/bipm_renderer.rb'
336
+
337
+ # Offense count: 2
338
+ # This cop supports safe autocorrection (--autocorrect).
339
+ # Configuration parameters: EnforcedStyleForMultiline.
340
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
341
+ Style/TrailingCommaInArguments:
165
342
  Exclude:
166
- - 'lib/metanorma/html/renderer.rb'
343
+ - 'lib/metanorma/html/component/footnote_collector.rb'
344
+ - 'lib/metanorma/html/component/index_term_collector.rb'
data/README.adoc CHANGED
@@ -75,6 +75,34 @@ BaseRenderer # Core HTML rendering, document assembly, CSS/JS p
75
75
  └── RiboseRenderer # Ribose-specific formatting
76
76
  ....
77
77
 
78
+ ===== Drop Pattern
79
+
80
+ Block elements (notes, examples, sourcecode, formulas, figures, admonitions) use the Drop pattern:
81
+
82
+ [source,ruby]
83
+ # A Drop captures rendered content via RendererContext, then passes
84
+ # data to a Liquid template. The renderer never emits HTML directly.
85
+ def render_note(note, **_opts)
86
+ drop = Drops::NoteDrop.from_model(note, renderer: renderer_context)
87
+ @output << render_liquid("_note.html.liquid", { "block" => drop })
88
+ end
89
+
90
+ Each Drop class inherits from `BlockElementDrop` and implements `.from_model(model, renderer:)` which:
91
+
92
+ . Captures child content via `renderer.capture_output { ... }`
93
+ . Returns a new Drop instance with pre-rendered HTML strings
94
+ . The Liquid template reads Drop attributes and outputs final HTML
95
+
96
+ `RendererContext` is a facade that exposes only the rendering methods Drops need, maintaining encapsulation.
97
+
98
+ ===== Class Name Ownership
99
+
100
+ The HTML renderer owns its class names entirely. **No XML-originated class names appear in the HTML output.**
101
+
102
+ * Block-level classes (`note-block`, `formula`, `figure`, etc.) are assigned by the renderer based on what it's rendering
103
+ * Inline span classes use `SPAN_ROLE_CLASSES` to map XML span roles to HTML-specific names (e.g., `boldtitle` → `title-text`, `citesec` → `xref-section`)
104
+ * The XML's `class_attr` is read as **input only** to determine semantic role, never emitted directly
105
+
78
106
  ==== Presentation XML
79
107
 
80
108
  The HTML renderer expects **presentation XML** (not source XML). Presentation XML contains `fmt-*` display elements (`fmt-title`, `fmt-xref`, `fmt-link`, `fmt-concept`, `fmt-definition`, `fmt-preferred`, etc.) alongside semantic elements. The renderer prioritizes `fmt-*` elements for rendering, falling back to semantic elements when display elements are absent.
@@ -107,8 +135,15 @@ HTML structure is defined in `.liquid` templates under `lib/metanorma/html/templ
107
135
  `_header.html.liquid` :: Sticky header with publisher logos
108
136
  `_footer.html.liquid` :: Footer with copyright
109
137
  `_cover.html.liquid` :: Cover page layout
138
+ `_iso_cover.html.liquid` :: ISO-specific cover page
110
139
  `_footnotes.html.liquid` :: Footnotes section
111
140
  `_doc_title.html.liquid` :: Document title rendering
141
+ `_note.html.liquid` :: Note block
142
+ `_example.html.liquid` :: Example block
143
+ `_sourcecode.html.liquid` :: Source code block
144
+ `_formula.html.liquid` :: Formula block
145
+ `_figure.html.liquid` :: Figure block
146
+ `_admonition.html.liquid` :: Admonition block
112
147
 
113
148
  Templates use `Liquid::LocalFileSystem` for partials (prefixed with `_`). The `render_liquid` method handles template caching via `TEMPLATE_CACHE`.
114
149
 
@@ -151,26 +186,32 @@ Renderer instance methods:
151
186
  `theme` :: Returns the `Theme` instance (override in subclasses).
152
187
  `render_liquid(template_name, assigns)` :: Renders a Liquid template with caching.
153
188
 
154
- == Document Flavors
189
+ == Document Flavors
190
+
191
+ The gem provides a hierarchy of document flavors:
192
+
193
+ * BasicDocument - Basic document model
194
+ * StandardDocument - Standard document model (extends BasicDocument)
195
+ * IsoDocument - ISO standard document model (extends StandardDocument)
196
+ * IecDocument - IEC standard document model
197
+ * IeeeDocument - IEEE standard document model
198
+ * IetfDocument - IETF standard document model
199
+ * IhoDocument - IHO standard document model
200
+ * OimlDocument - OIML standard document model
201
+ * BipmDocument - BIPM standard document model
202
+ * ItuDocument - ITU standard document model
203
+ * OgcDocument - OGC standard document model
204
+ * CcDocument - CC standard document model
205
+ * RiboseDocument - Ribose standard document model
206
+
207
+ == Supported XML Formats
155
208
 
156
- The gem provides a hierarchy of document flavors:
209
+ This library targets the modern Metanorma XML format which uses `<metanorma>` as the root element.
157
210
 
158
- * BasicDocument - Basic document model
159
- * StandardDocument - Standard document model (extends BasicDocument)
160
- * IsoDocument - ISO standard document model (extends StandardDocument)
161
- * IecDocument - IEC standard document model
162
- * IeeeDocument - IEEE standard document model
163
- * IetfDocument - IETF standard document model
164
- * IhoDocument - IHO standard document model
165
- * OimlDocument - OIML standard document model
166
- * BipmDocument - BIPM standard document model
167
- * ItuDocument - ITU standard document model
168
- * OgcDocument - OGC standard document model
169
- * CcDocument - CC standard document model
170
- * RiboseDocument - Ribose standard document model
211
+ Legacy XML formats that use flavor-specific root elements (e.g. `<iso-standard>`, `<m3d-standard>`, `<csa-standard>`, `<un-standard>`) are *not supported*.
171
212
 
172
- == Supported XML Formats
213
+ == Documentation
173
214
 
174
- This library targets the modern Metanorma XML format which uses `<metanorma>` as the root element.
215
+ Detailed architecture documentation is in the `docs/` directory:
175
216
 
176
- Legacy XML formats that use flavor-specific root elements (e.g. `<iso-standard>`, `<m3d-standard>`, `<csa-standard>`, `<un-standard>`) are *not supported*.
217
+ * xref:docs/html-renderer.adoc[HTML Renderer Architecture] renderer pipeline, drop pattern, class name ownership, template system
@@ -12,7 +12,7 @@
12
12
  border-bottom: 1px solid var(--color-border);
13
13
  }
14
14
  .norm-ref-entry:last-child { border-bottom-color: transparent; }
15
- .std-doc-number { font-weight: 500; color: var(--mn-primary); font-family: var(--font-sans); }
16
- .std-year { font-weight: 500; }
15
+ .ref-doc-number { font-weight: 500; color: var(--mn-primary); font-family: var(--font-sans); }
16
+ .ref-year { font-weight: 500; }
17
17
  .biblio-link { color: inherit; text-decoration: none; }
18
18
  .biblio-link:hover { color: var(--mn-primary); text-decoration: underline; }
@@ -1,8 +1,8 @@
1
1
  /* === Inline Elements === */
2
2
  .fn-marker { vertical-align: super; font-size: 0.78em; color: var(--mn-primary); font-family: var(--font-sans); }
3
3
  .small-caps { font-variant: small-caps; letter-spacing: 0.03em; }
4
- .obligation { font-style: italic; color: var(--mn-accent); }
5
- .bold-title { font-weight: 700; }
4
+ .obligation-text { font-style: italic; color: var(--mn-accent); }
5
+ .title-text { font-weight: 700; }
6
6
 
7
7
  /* Math container — hover dropdown for source formats */
8
8
  .math-container { position: relative; display: inline; }
@@ -30,28 +30,27 @@
30
30
  border-radius: 2px; transition: background 0.15s, color 0.15s;
31
31
  }
32
32
  .stem-copy-btn:hover { background: var(--mn-primary-light); color: var(--mn-primary); }
33
- .nonboldtitle { font-weight: 400; }
33
+ .subtitle-text { font-weight: 400; }
34
34
 
35
- .citesec, .citefig, .citetbl, .citeapp {
35
+ .xref-section, .xref-fig, .xref-table, .xref-app {
36
36
  color: var(--mn-primary);
37
37
  text-decoration: underline;
38
38
  text-decoration-color: rgba(40,56,138,0.2);
39
39
  cursor: pointer;
40
40
  }
41
- .citesec:hover, .citefig:hover, .citetbl:hover, .citeapp:hover {
41
+ .xref-section:hover, .xref-fig:hover, .xref-table:hover, .xref-app:hover {
42
42
  color: var(--mn-accent);
43
43
  }
44
44
 
45
- .doc-subtitle { font-weight: 400; }
46
- .doc-part-number { font-weight: 500; }
47
- .doc-part-title { font-style: italic; }
48
- .doc-publisher, .doc-publisher-name { font-weight: 500; }
49
- .std-doc-number { font-weight: 500; }
50
- .std-year { font-weight: 500; }
45
+ .ref-part-number { font-weight: 500; }
46
+ .ref-title { font-style: italic; }
47
+ .ref-publisher, .ref-publisher-name { font-weight: 500; }
48
+ .ref-doc-number { font-weight: 500; }
49
+ .ref-year { font-weight: 500; }
51
50
  .xref-label { font-weight: 600; }
52
51
  a.xref { color: var(--mn-primary); text-decoration: none; border-bottom: 1px solid var(--mn-primary-light); }
53
52
  a.xref:hover { border-bottom-color: var(--mn-primary); }
54
- .doc-content a.xref .element-name { font-style: italic; }
53
+ .doc-content a.xref .element-label { font-style: italic; }
55
54
 
56
55
  .kbd-hint {
57
56
  display: inline-block;