metanorma-document 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e710334041f766fc137b7ee644dd8ea468df08e44b6f14861814d6ba82af00af
4
- data.tar.gz: 226cafd839311d7e71beb173682d9579c9f17fe2fa5d43a8d1cf51197ed96c59
3
+ metadata.gz: 4c66a8c91095adeaaa7d4cde6aacda4cbeae30670484c0dbb28a85d663d4d5dd
4
+ data.tar.gz: 6287b7a61c71833682c54f94e35e4d8dd423db10a5fc6c2086f00c50d865a185
5
5
  SHA512:
6
- metadata.gz: 3b5ca51582a6300114f12e9fe083cc8affbc3a10c782dc6eeadbfe5f5adef568c72c1c01e5a9dd90dd9cf1275778e0eddbc52634695e669c615faa92f2cc2f4d
7
- data.tar.gz: cfc53a641db3f0ccdf2fcab42fd9b50ab16358e7446025a83ff0928ffb88f8abadd8ee3748092df727a5622da9e88f9bbf9ec5de79a058b8b665f4734818f67e
6
+ metadata.gz: ed0522009ebcffc3b73c0717ff518d7fc3d422cc8e7be88ade3aa6c893b6569a07db035cd40ba6738cc1602261e588307b5264c0139a122d35d65ae86e2c7a81
7
+ data.tar.gz: 6456bc28350855d30cbeed7e6b807220b390560d030e5ae1f85733d4672df15e834badc1e07cdeee5af59a804a0ac96fc12830e1bee2a3e74836a9f8b0cce349
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-05-21 05:48:57 UTC using RuboCop version 1.86.1.
3
+ # on 2026-05-21 09:20:40 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
@@ -11,251 +11,28 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'metanorma-document.gemspec'
13
13
 
14
- # Offense count: 155
14
+ # Offense count: 9
15
15
  # This cop supports safe autocorrection (--autocorrect).
16
16
  # Configuration parameters: EnforcedStyle, IndentationWidth.
17
17
  # SupportedStyles: with_first_argument, with_fixed_indentation
18
18
  Layout/ArgumentAlignment:
19
- Enabled: false
20
-
21
- # Offense count: 1
22
- # This cop supports safe autocorrection (--autocorrect).
23
- # Configuration parameters: EnforcedStyle, IndentationWidth.
24
- # SupportedStyles: with_first_element, with_fixed_indentation
25
- Layout/ArrayAlignment:
26
- Exclude:
27
- - 'lib/metanorma/html/standard_renderer.rb'
28
-
29
- # Offense count: 2
30
- # This cop supports safe autocorrection (--autocorrect).
31
- # Configuration parameters: IndentationWidth.
32
- Layout/AssignmentIndentation:
33
- Exclude:
34
- - 'lib/metanorma/html/iso_renderer.rb'
35
-
36
- # Offense count: 59
37
- # This cop supports safe autocorrection (--autocorrect).
38
- # Configuration parameters: EnforcedStyleAlignWith.
39
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
40
- Layout/BlockAlignment:
41
- Enabled: false
42
-
43
- # Offense count: 51
44
- # This cop supports safe autocorrection (--autocorrect).
45
- Layout/BlockEndNewline:
46
- Enabled: false
47
-
48
- # Offense count: 14
49
- # This cop supports safe autocorrection (--autocorrect).
50
- Layout/ClosingParenthesisIndentation:
51
- Exclude:
52
- - 'lib/metanorma/html.rb'
53
- - 'lib/metanorma/html/base_renderer.rb'
54
- - 'lib/metanorma/html/bipm_renderer.rb'
55
- - 'lib/metanorma/html/drops/figure_drop.rb'
56
- - 'lib/metanorma/html/drops/formula_drop.rb'
57
- - 'lib/metanorma/html/drops/sourcecode_drop.rb'
58
- - 'lib/metanorma/html/iso_renderer.rb'
59
- - 'lib/metanorma/html/standard_renderer.rb'
60
- - 'spec/metanorma/html/renderer/architecture_spec.rb'
61
- - 'spec/metanorma/html/renderer/dead_code_removal_spec.rb'
62
-
63
- # Offense count: 1
64
- # This cop supports safe autocorrection (--autocorrect).
65
- # Configuration parameters: EnforcedStyleAlignWith.
66
- # SupportedStylesAlignWith: start_of_line, def
67
- Layout/DefEndAlignment:
68
19
  Exclude:
69
- - 'lib/metanorma/html/component/base.rb'
70
-
71
- # Offense count: 1
72
- # This cop supports safe autocorrection (--autocorrect).
73
- Layout/ElseAlignment:
74
- Exclude:
75
- - 'lib/metanorma/html/standard_renderer.rb'
76
-
77
- # Offense count: 6
78
- # This cop supports safe autocorrection (--autocorrect).
79
- Layout/EmptyLineAfterGuardClause:
80
- Exclude:
81
- - 'lib/metanorma/html/base_renderer.rb'
82
- - 'lib/metanorma/html/generator.rb'
83
- - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
84
-
85
- # Offense count: 1
86
- # This cop supports safe autocorrection (--autocorrect).
87
- # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
88
- Layout/EmptyLineBetweenDefs:
89
- Exclude:
90
- - 'lib/metanorma/html/component/base.rb'
91
-
92
- # Offense count: 7
93
- # This cop supports safe autocorrection (--autocorrect).
94
- Layout/EmptyLines:
95
- Exclude:
96
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
97
-
98
- # Offense count: 4
99
- # This cop supports safe autocorrection (--autocorrect).
100
- # Configuration parameters: EnforcedStyle.
101
- # SupportedStyles: empty_lines, no_empty_lines
102
- Layout/EmptyLinesAroundBlockBody:
103
- Exclude:
104
- - 'lib/metanorma/ieee_document/root.rb'
105
- - 'lib/metanorma/ietf_document/root.rb'
106
- - 'lib/metanorma/nist_document/root.rb'
20
+ - 'lib/metanorma/standard_document.rb'
107
21
  - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
108
22
 
109
- # Offense count: 11
110
- # This cop supports safe autocorrection (--autocorrect).
111
- # Configuration parameters: EnforcedStyle.
112
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
113
- Layout/EmptyLinesAroundClassBody:
114
- Exclude:
115
- - 'lib/metanorma/html/bipm_renderer.rb'
116
- - 'lib/metanorma/html/cc_renderer.rb'
117
- - 'lib/metanorma/html/iec_renderer.rb'
118
- - 'lib/metanorma/html/ieee_renderer.rb'
119
- - 'lib/metanorma/html/ietf_renderer.rb'
120
- - 'lib/metanorma/html/iho_renderer.rb'
121
- - 'lib/metanorma/html/itu_renderer.rb'
122
- - 'lib/metanorma/html/ogc_renderer.rb'
123
- - 'lib/metanorma/html/oiml_renderer.rb'
124
- - 'lib/metanorma/html/pdfa_renderer.rb'
125
- - 'lib/metanorma/html/ribose_renderer.rb'
126
-
127
- # Offense count: 1
128
- # This cop supports safe autocorrection (--autocorrect).
129
- # Configuration parameters: EnforcedStyleAlignWith.
130
- # SupportedStylesAlignWith: keyword, variable, start_of_line
131
- Layout/EndAlignment:
132
- Exclude:
133
- - 'lib/metanorma/html/standard_renderer.rb'
134
-
135
- # Offense count: 9
136
- # This cop supports safe autocorrection (--autocorrect).
137
- # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
138
- Layout/ExtraSpacing:
139
- Exclude:
140
- - 'lib/metanorma/html/bipm_renderer.rb'
141
- - 'lib/metanorma/html/generator.rb'
142
- - 'lib/metanorma/html/iho_renderer.rb'
143
- - 'lib/metanorma/html/theme.rb'
144
- - 'lib/metanorma/iso_document/sections/iso_preface.rb'
145
- - 'lib/metanorma/iso_document/sections/iso_sections.rb'
146
- - 'lib/metanorma/standard_document/root_attributes.rb'
147
- - 'lib/metanorma/standard_document/sections/preface.rb'
148
-
149
- # Offense count: 13
150
- # This cop supports safe autocorrection (--autocorrect).
151
- # Configuration parameters: EnforcedStyle, IndentationWidth.
152
- # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
153
- Layout/FirstArgumentIndentation:
154
- Exclude:
155
- - 'lib/metanorma/html.rb'
156
- - 'lib/metanorma/html/base_renderer.rb'
157
- - 'lib/metanorma/html/bipm_renderer.rb'
158
- - 'lib/metanorma/html/drops/figure_drop.rb'
159
- - 'lib/metanorma/html/drops/formula_drop.rb'
160
- - 'lib/metanorma/html/drops/sourcecode_drop.rb'
161
- - 'lib/metanorma/html/iso_renderer.rb'
162
- - 'lib/metanorma/html/standard_renderer.rb'
163
- - 'spec/metanorma/html/renderer/architecture_spec.rb'
164
- - 'spec/metanorma/html/renderer/dead_code_removal_spec.rb'
165
-
166
- # Offense count: 51
167
- # This cop supports safe autocorrection (--autocorrect).
168
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
169
- # SupportedHashRocketStyles: key, separator, table
170
- # SupportedColonStyles: key, separator, table
171
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
172
- Layout/HashAlignment:
173
- Exclude:
174
- - 'lib/metanorma/html/base_renderer.rb'
175
- - 'lib/metanorma/html/component/index_section.rb'
176
- - 'lib/metanorma/html/component/index_term_collector.rb'
177
- - 'lib/metanorma/html/drops/figure_drop.rb'
178
- - 'lib/metanorma/registers/setup.rb'
179
- - 'lib/metanorma/standard_document/block_attributes.rb'
180
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
181
- - 'spec/metanorma/html/renderer/index_term_collector_spec.rb'
182
-
183
- # Offense count: 1
184
- # This cop supports safe autocorrection (--autocorrect).
185
- Layout/HeredocIndentation:
186
- Exclude:
187
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
188
-
189
- # Offense count: 4
190
- # This cop supports safe autocorrection (--autocorrect).
191
- # Configuration parameters: EnforcedStyle.
192
- # SupportedStyles: normal, indented_internal_methods
193
- Layout/IndentationConsistency:
194
- Exclude:
195
- - 'lib/metanorma/html/generator.rb'
196
-
197
- # Offense count: 106
198
- # This cop supports safe autocorrection (--autocorrect).
199
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
200
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
201
- Layout/IndentationWidth:
202
- Enabled: false
203
-
204
- # Offense count: 853
23
+ # Offense count: 666
205
24
  # This cop supports safe autocorrection (--autocorrect).
206
25
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
207
26
  # URISchemes: http, https
208
27
  Layout/LineLength:
209
28
  Enabled: false
210
29
 
211
- # Offense count: 4
212
- # This cop supports safe autocorrection (--autocorrect).
213
- Layout/MultilineBlockLayout:
214
- Exclude:
215
- - 'lib/metanorma/html/component/index_section.rb'
216
- - 'lib/metanorma/html/iso_renderer.rb'
217
-
218
- # Offense count: 12
219
- # This cop supports safe autocorrection (--autocorrect).
220
- # Configuration parameters: EnforcedStyle.
221
- # SupportedStyles: symmetrical, new_line, same_line
222
- Layout/MultilineMethodCallBraceLayout:
223
- Exclude:
224
- - 'lib/metanorma/html.rb'
225
- - 'lib/metanorma/html/base_renderer.rb'
226
- - 'lib/metanorma/html/bipm_renderer.rb'
227
- - 'lib/metanorma/html/drops/figure_drop.rb'
228
- - 'lib/metanorma/html/drops/formula_drop.rb'
229
- - 'lib/metanorma/html/drops/sourcecode_drop.rb'
230
- - 'lib/metanorma/html/iso_renderer.rb'
231
- - 'lib/metanorma/html/standard_renderer.rb'
232
- - 'spec/metanorma/html/renderer/architecture_spec.rb'
233
- - 'spec/metanorma/html/renderer/dead_code_removal_spec.rb'
234
-
235
30
  # Offense count: 1
236
31
  # This cop supports safe autocorrection (--autocorrect).
237
- # Configuration parameters: EnforcedStyle, IndentationWidth.
238
- # SupportedStyles: aligned, indented
239
- Layout/MultilineOperationIndentation:
240
- Exclude:
241
- - 'lib/metanorma/html/base_renderer.rb'
242
-
243
- # Offense count: 3
244
- # This cop supports safe autocorrection (--autocorrect).
245
- # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
246
- # SupportedStylesForExponentOperator: space, no_space
247
- # SupportedStylesForRationalLiterals: space, no_space
248
- Layout/SpaceAroundOperators:
249
- Exclude:
250
- - 'lib/metanorma/html/bipm_renderer.rb'
251
- - 'lib/metanorma/html/iho_renderer.rb'
252
- - 'lib/metanorma/html/theme.rb'
253
-
254
- # Offense count: 146
255
- # This cop supports safe autocorrection (--autocorrect).
256
32
  # Configuration parameters: AllowInHeredoc.
257
33
  Layout/TrailingWhitespace:
258
- Enabled: false
34
+ Exclude:
35
+ - 'lib/metanorma/standard_document.rb'
259
36
 
260
37
  # Offense count: 1
261
38
  # Configuration parameters: AllowedMethods.
@@ -291,22 +68,6 @@ Lint/StructNewOverride:
291
68
  Exclude:
292
69
  - 'lib/metanorma/html/component/index_term_collector.rb'
293
70
 
294
- # Offense count: 2
295
- # This cop supports safe autocorrection (--autocorrect).
296
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
297
- # NotImplementedExceptions: NotImplementedError
298
- Lint/UnusedMethodArgument:
299
- Exclude:
300
- - 'lib/metanorma/html/component/index_section.rb'
301
- - 'lib/metanorma/html/generator.rb'
302
-
303
- # Offense count: 4
304
- # This cop supports safe autocorrection (--autocorrect).
305
- Lint/UselessAssignment:
306
- Exclude:
307
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
308
- - 'spec/metanorma/standard_document/sections_spec.rb'
309
-
310
71
  # Offense count: 80
311
72
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
312
73
  Metrics/AbcSize:
@@ -340,7 +101,7 @@ Metrics/CyclomaticComplexity:
340
101
  - 'lib/metanorma/html/theme.rb'
341
102
  - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
342
103
 
343
- # Offense count: 100
104
+ # Offense count: 101
344
105
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
345
106
  Metrics/MethodLength:
346
107
  Max: 95
@@ -367,15 +128,6 @@ Metrics/PerceivedComplexity:
367
128
  - 'lib/metanorma/html/theme.rb'
368
129
  - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
369
130
 
370
- # Offense count: 4
371
- # This cop supports safe autocorrection (--autocorrect).
372
- # Configuration parameters: EnforcedStyle, BlockForwardingName.
373
- # SupportedStyles: anonymous, explicit
374
- Naming/BlockForwarding:
375
- Exclude:
376
- - 'lib/metanorma/html/base_renderer.rb'
377
- - 'lib/metanorma/html/component/footnote_collector.rb'
378
-
379
131
  # Offense count: 28
380
132
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
381
133
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
@@ -410,18 +162,6 @@ Performance/MapMethodChain:
410
162
  Exclude:
411
163
  - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
412
164
 
413
- # Offense count: 1
414
- # This cop supports unsafe autocorrection (--autocorrect-all).
415
- Performance/StringInclude:
416
- Exclude:
417
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
418
-
419
- # Offense count: 1
420
- # This cop supports unsafe autocorrection (--autocorrect-all).
421
- RSpec/BeEq:
422
- Exclude:
423
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
424
-
425
165
  # Offense count: 7
426
166
  RSpec/BeforeAfterAll:
427
167
  Exclude:
@@ -432,31 +172,11 @@ RSpec/BeforeAfterAll:
432
172
  RSpec/DescribeClass:
433
173
  Enabled: false
434
174
 
435
- # Offense count: 11
436
- # This cop supports unsafe autocorrection (--autocorrect-all).
437
- # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
438
- # SupportedStyles: described_class, explicit
439
- RSpec/DescribedClass:
440
- Exclude:
441
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
442
-
443
- # Offense count: 7
444
- # This cop supports safe autocorrection (--autocorrect).
445
- RSpec/EmptyLineAfterSubject:
446
- Exclude:
447
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
448
-
449
- # Offense count: 92
175
+ # Offense count: 95
450
176
  # Configuration parameters: CountAsOne.
451
177
  RSpec/ExampleLength:
452
178
  Max: 29
453
179
 
454
- # Offense count: 7
455
- # This cop supports safe autocorrection (--autocorrect).
456
- RSpec/LeadingSubject:
457
- Exclude:
458
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
459
-
460
180
  # Offense count: 1
461
181
  RSpec/LeakyConstantDeclaration:
462
182
  Exclude:
@@ -480,7 +200,7 @@ RSpec/NamedSubject:
480
200
  Exclude:
481
201
  - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
482
202
 
483
- # Offense count: 595
203
+ # Offense count: 599
484
204
  # Configuration parameters: AllowedPatterns.
485
205
  # AllowedPatterns: ^expect_, ^assert_
486
206
  RSpec/NoExpectationExample:
@@ -492,27 +212,6 @@ RSpec/NoExpectationExample:
492
212
  RSpec/SpecFilePathFormat:
493
213
  Enabled: false
494
214
 
495
- # Offense count: 4
496
- # This cop supports safe autocorrection (--autocorrect).
497
- # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
498
- # RedundantRestArgumentNames: args, arguments
499
- # RedundantKeywordRestArgumentNames: kwargs, options, opts
500
- # RedundantBlockArgumentNames: blk, block, proc
501
- Style/ArgumentsForwarding:
502
- Exclude:
503
- - 'lib/metanorma/html/base_renderer.rb'
504
- - 'lib/metanorma/html/component/footnote_collector.rb'
505
-
506
- # Offense count: 81
507
- # This cop supports safe autocorrection (--autocorrect).
508
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
509
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
510
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
511
- # FunctionalMethods: let, let!, subject, watch
512
- # AllowedMethods: lambda, proc, it
513
- Style/BlockDelimiters:
514
- Enabled: false
515
-
516
215
  # Offense count: 5
517
216
  # This cop supports safe autocorrection (--autocorrect).
518
217
  Style/ComparableClamp:
@@ -521,36 +220,6 @@ Style/ComparableClamp:
521
220
  - 'lib/metanorma/html/iso_renderer.rb'
522
221
  - 'lib/metanorma/html/standard_renderer.rb'
523
222
 
524
- # Offense count: 1
525
- # This cop supports safe autocorrection (--autocorrect).
526
- # Configuration parameters: EnforcedStyle.
527
- # SupportedStyles: allow_single_line, allow_always, disallow, require_single_line, require_always
528
- Style/EndlessMethod:
529
- Exclude:
530
- - 'lib/metanorma/html/component/base.rb'
531
-
532
- # Offense count: 1
533
- # This cop supports unsafe autocorrection (--autocorrect-all).
534
- # Configuration parameters: InverseMethods, InverseBlocks.
535
- Style/InverseMethods:
536
- Exclude:
537
- - 'lib/metanorma/html/component/index_term_collector.rb'
538
-
539
- # Offense count: 9
540
- # This cop supports safe autocorrection (--autocorrect).
541
- Style/MultilineIfModifier:
542
- Exclude:
543
- - 'lib/metanorma/html/component/index_section.rb'
544
- - 'lib/metanorma/html/component/index_term_collector.rb'
545
- - 'lib/metanorma/html/iso_renderer.rb'
546
- - 'lib/metanorma/html/standard_renderer.rb'
547
-
548
- # Offense count: 1
549
- # This cop supports safe autocorrection (--autocorrect).
550
- Style/MultilineTernaryOperator:
551
- Exclude:
552
- - 'lib/metanorma/html/standard_renderer.rb'
553
-
554
223
  # Offense count: 1
555
224
  # This cop supports unsafe autocorrection (--autocorrect-all).
556
225
  # Configuration parameters: EnforcedStyle.
@@ -558,75 +227,3 @@ Style/MultilineTernaryOperator:
558
227
  Style/MutableConstant:
559
228
  Exclude:
560
229
  - 'lib/metanorma/html/base_renderer.rb'
561
-
562
- # Offense count: 1
563
- # This cop supports safe autocorrection (--autocorrect).
564
- Style/NegatedIfElseCondition:
565
- Exclude:
566
- - 'lib/metanorma/iso_document/metadata/iso_localized_title.rb'
567
-
568
- # Offense count: 2
569
- # This cop supports unsafe autocorrection (--autocorrect-all).
570
- Style/RedundantInterpolation:
571
- Exclude:
572
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
573
-
574
- # Offense count: 1
575
- # This cop supports safe autocorrection (--autocorrect).
576
- Style/RedundantRegexpArgument:
577
- Exclude:
578
- - 'lib/metanorma/html/bipm_renderer.rb'
579
-
580
- # Offense count: 2
581
- # This cop supports safe autocorrection (--autocorrect).
582
- Style/RescueModifier:
583
- Exclude:
584
- - 'lib/metanorma/html/generator.rb'
585
-
586
- # Offense count: 2
587
- # This cop supports safe autocorrection (--autocorrect).
588
- # Configuration parameters: EnforcedStyle.
589
- # SupportedStyles: implicit, explicit
590
- Style/RescueStandardError:
591
- Exclude:
592
- - 'lib/metanorma/html/generator.rb'
593
-
594
- # Offense count: 1
595
- # This cop supports unsafe autocorrection (--autocorrect-all).
596
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
597
- # AllowedMethods: present?, blank?, presence, try, try!
598
- Style/SafeNavigation:
599
- Exclude:
600
- - 'lib/metanorma/html/bipm_renderer.rb'
601
-
602
- # Offense count: 1
603
- # This cop supports safe autocorrection (--autocorrect).
604
- # Configuration parameters: AllowModifier.
605
- Style/SoleNestedConditional:
606
- Exclude:
607
- - 'lib/metanorma/html/base_renderer.rb'
608
-
609
- # Offense count: 3
610
- # This cop supports safe autocorrection (--autocorrect).
611
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
612
- # SupportedStyles: single_quotes, double_quotes
613
- Style/StringLiterals:
614
- Exclude:
615
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
616
-
617
- # Offense count: 15
618
- # This cop supports safe autocorrection (--autocorrect).
619
- # Configuration parameters: EnforcedStyleForMultiline.
620
- # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
621
- Style/TrailingCommaInArguments:
622
- Exclude:
623
- - 'lib/metanorma/html/component/footnote_collector.rb'
624
- - 'lib/metanorma/html/component/index_term_collector.rb'
625
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
626
-
627
- # Offense count: 3
628
- # This cop supports safe autocorrection (--autocorrect).
629
- # Configuration parameters: AllowNamedUnderscoreVariables.
630
- Style/TrailingUnderscoreVariable:
631
- Exclude:
632
- - 'spec/metanorma/flavor_roots/flavor_roots_spec.rb'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Metanorma
4
4
  module Document
5
- VERSION = "0.2.7"
5
+ VERSION = "0.2.8"
6
6
  Version = VERSION
7
7
  end
8
8
  end
@@ -161,7 +161,7 @@ module Metanorma
161
161
 
162
162
  # --- Document Assembly ---
163
163
 
164
- TEMPLATE_CACHE = {}
164
+ TEMPLATE_CACHE = {} # rubocop:disable Style/MutableConstant
165
165
  TEMPLATE_CACHE_MUTEX = Mutex.new
166
166
 
167
167
  def render_liquid(template_name, assigns)
@@ -1554,14 +1554,13 @@ module Metanorma
1554
1554
  # TextElements::StemElement — block math (no fmt- counterpart for display formulas)
1555
1555
  if stem.is_a?(Metanorma::Document::Components::TextElements::StemElement)
1556
1556
  if stem.math
1557
- begin
1558
- return stem.math.to_xml
1559
- rescue StandardError
1560
- math_items = Array(stem.math)
1561
- return math_items.join
1562
- end
1563
- end
1564
- if stem.asciimath
1557
+ math_val = stem.math
1558
+ return math_val.to_xml if math_val.is_a?(Nokogiri::XML::Node)
1559
+ return math_val.to_xml if defined?(Moxml::Document) && math_val.is_a?(Moxml::Document)
1560
+
1561
+ math_items = Array(math_val)
1562
+ math_items.join
1563
+ elsif stem.asciimath
1565
1564
  text = extract_text_value(stem.asciimath)
1566
1565
  return %(<span class="stem">#{escape_html(text)}</span>)
1567
1566
  end
@@ -56,29 +56,22 @@ module Metanorma
56
56
  contributors = bibdata.contributor
57
57
  return false unless contributors
58
58
 
59
- begin
60
- contributors.any? do |c|
61
- begin
62
- next false unless c.role&.any? do |r|
63
- r&.type == "author"
64
- end
65
- rescue StandardError
66
- false
67
- end
68
- org = c.organization
69
- next false unless org
70
-
71
- org_abbrev = org.abbreviation
72
- if org_abbrev.is_a?(String)
73
- org_abbrev == abbrev
74
- elsif org_abbrev.is_a?(Lutaml::Model::Serializable)
75
- safe_attr(org_abbrev, :content) == abbrev
76
- else
77
- org_abbrev.to_s == abbrev
78
- end
59
+ contributors.any? do |c|
60
+ roles = c.role
61
+ next false unless roles.is_a?(Array)
62
+ next false unless roles.any? { |r| r&.type == "author" }
63
+
64
+ org = c.organization
65
+ next false unless org
66
+
67
+ org_abbrev = org.abbreviation
68
+ if org_abbrev.is_a?(String)
69
+ org_abbrev == abbrev
70
+ elsif org_abbrev.is_a?(Lutaml::Model::Serializable)
71
+ safe_attr(org_abbrev, :content) == abbrev
72
+ else
73
+ org_abbrev.to_s == abbrev
79
74
  end
80
- rescue StandardError
81
- false
82
75
  end
83
76
  end
84
77
 
@@ -11,19 +11,8 @@ module Metanorma
11
11
  element "foreword"
12
12
  ordered
13
13
 
14
- map_attribute "id", to: :id
15
- map_attribute "anchor", to: :anchor
16
- map_attribute "obligation", to: :obligation
17
- map_attribute "semx-id", to: :semx_id
18
- map_attribute "displayorder", to: :displayorder
19
-
20
- map_element "title", to: :title
21
- map_element "fmt-title", to: :fmt_title
22
-
23
- Metanorma::StandardDocument::BlockXmlMapping.apply_block_mappings(self)
24
-
25
- map_element "fmt-annotation-start", to: :fmt_annotation_start
26
- map_element "fmt-annotation-end", to: :fmt_annotation_end
14
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
15
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_elements(self)
27
16
  end
28
17
 
29
18
  json do
@@ -6,8 +6,9 @@ module Metanorma
6
6
  # Terms section specific to ISO/IEC documents.
7
7
  # Maps <terms> element with <title>, <p>, <ul>, <term> children.
8
8
  class IsoTermsSection < Lutaml::Model::Serializable
9
+ include Metanorma::StandardDocument::PresentationAttributes
10
+
9
11
  attribute :id, :string
10
- attribute :anchor, :string
11
12
  attribute :type, :string
12
13
  attribute :number, :string
13
14
  attribute :obligation, :string
@@ -46,18 +47,6 @@ module Metanorma
46
47
 
47
48
  # Nested clause sections inside terms
48
49
  attribute :clause, IsoClauseSection, collection: true
49
- attribute :semx_id, :string
50
- attribute :autonum, :string
51
- attribute :displayorder, :integer
52
- attribute :fmt_title, Metanorma::Document::Components::Inline::FmtTitleElement
53
- attribute :fmt_xref_label,
54
- Metanorma::Document::Components::Inline::FmtXrefLabelElement, collection: true
55
- attribute :fmt_annotation_start,
56
- Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
57
- collection: true
58
- attribute :fmt_annotation_end,
59
- Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
60
- collection: true
61
50
 
62
51
  xml do
63
52
  element "terms"
@@ -65,6 +54,7 @@ module Metanorma
65
54
  Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
66
55
 
67
56
  map_element "title", to: :title
57
+ map_element "variant-title", to: :variant_title
68
58
  map_element "fmt-title", to: :fmt_title
69
59
  map_element "fmt-xref-label", to: :fmt_xref_label
70
60
  map_element "p", to: :p
@@ -51,6 +51,48 @@ module Metanorma
51
51
  end
52
52
  end
53
53
 
54
+ # Provides `blocks` method for ordered-content section types.
55
+ # Returns child nodes in document order via `each_mixed_content`.
56
+ module OrderedContent
57
+ def blocks
58
+ @blocks ||=
59
+ begin
60
+ result = []
61
+ each_mixed_content do |node|
62
+ result << node unless node.is_a?(String)
63
+ end
64
+ result
65
+ end
66
+ end
67
+ end
68
+
69
+ # Presentation/formatting attributes shared by all section types.
70
+ # Include in any section class that supports presentation metadata.
71
+ module PresentationAttributes
72
+ def self.included(base)
73
+ base.class_eval do
74
+ attribute :anchor, :string
75
+ attribute :semx_id, :string
76
+ attribute :autonum, :string
77
+ attribute :displayorder, :integer
78
+ attribute :fmt_title,
79
+ Metanorma::Document::Components::Inline::FmtTitleElement
80
+ attribute :fmt_xref_label,
81
+ Metanorma::Document::Components::Inline::FmtXrefLabelElement,
82
+ collection: true
83
+ attribute :variant_title,
84
+ Metanorma::Document::Components::Inline::VariantTitleElement,
85
+ collection: true
86
+ attribute :fmt_annotation_start,
87
+ Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
88
+ collection: true
89
+ attribute :fmt_annotation_end,
90
+ Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
91
+ collection: true
92
+ end
93
+ end
94
+ end
95
+
54
96
  # Adds XML element mappings for block-level content to a mapping builder.
55
97
  # Call inside an `xml do` block:
56
98
  #
@@ -12,6 +12,8 @@ module Metanorma
12
12
  # Uses `ordered` to enable `each_mixed_content` for document-order iteration.
13
13
  class AnnexSection < Lutaml::Model::Serializable
14
14
  include Metanorma::StandardDocument::BlockAttributes
15
+ include Metanorma::StandardDocument::PresentationAttributes
16
+ include Metanorma::StandardDocument::OrderedContent
15
17
 
16
18
  # Section identity and classification
17
19
  attribute :id, :string
@@ -23,6 +25,10 @@ module Metanorma
23
25
  attribute :title,
24
26
  Metanorma::Document::Components::Inline::TitleWithAnnotationElement
25
27
 
28
+ # Language/script (unique to annex)
29
+ attribute :language, :string
30
+ attribute :script, :string
31
+
26
32
  # Sub-clauses within annex (recursive)
27
33
  attribute :clause, AnnexSection, collection: true
28
34
 
@@ -50,28 +56,6 @@ module Metanorma
50
56
  Metanorma::Document::Components::EmptyElements::PageBreakElement,
51
57
  collection: true
52
58
 
53
- # Presentation-specific attributes
54
- attribute :anchor, :string
55
- attribute :semx_id, :string
56
- attribute :autonum, :string
57
- attribute :displayorder, :integer
58
- attribute :language, :string
59
- attribute :script, :string
60
- attribute :fmt_title,
61
- Metanorma::Document::Components::Inline::FmtTitleElement
62
- attribute :fmt_xref_label,
63
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
64
- collection: true
65
- attribute :variant_title,
66
- Metanorma::Document::Components::Inline::VariantTitleElement,
67
- collection: true
68
- attribute :fmt_annotation_start,
69
- Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
70
- collection: true
71
- attribute :fmt_annotation_end,
72
- Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
73
- collection: true
74
-
75
59
  xml do
76
60
  element "annex"
77
61
  ordered
@@ -79,18 +63,6 @@ module Metanorma
79
63
  Metanorma::StandardDocument::SectionXmlMapping.apply_annex_attributes(self)
80
64
  Metanorma::StandardDocument::SectionXmlMapping.apply_annex_elements(self)
81
65
  end
82
-
83
- # Blocks in document order, used by JSON serialization
84
- def blocks
85
- @blocks ||=
86
- begin
87
- result = []
88
- each_mixed_content do |node|
89
- result << node unless node.is_a?(String)
90
- end
91
- result
92
- end
93
- end
94
66
  end
95
67
  end
96
68
  end
@@ -12,6 +12,8 @@ module Metanorma
12
12
  # Uses `ordered` to enable `each_mixed_content` for document-order iteration.
13
13
  class ClauseSection < Lutaml::Model::Serializable
14
14
  include Metanorma::StandardDocument::BlockAttributes
15
+ include Metanorma::StandardDocument::PresentationAttributes
16
+ include Metanorma::StandardDocument::OrderedContent
15
17
 
16
18
  # Section identity and classification
17
19
  attribute :id, :string
@@ -76,26 +78,6 @@ module Metanorma
76
78
  Metanorma::Document::Components::IdElements::Bookmark,
77
79
  collection: true
78
80
 
79
- # Presentation-specific attributes
80
- attribute :anchor, :string
81
- attribute :semx_id, :string
82
- attribute :autonum, :string
83
- attribute :displayorder, :integer
84
- attribute :fmt_title,
85
- Metanorma::Document::Components::Inline::FmtTitleElement
86
- attribute :fmt_xref_label,
87
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
88
- collection: true
89
- attribute :variant_title,
90
- Metanorma::Document::Components::Inline::VariantTitleElement,
91
- collection: true
92
- attribute :fmt_annotation_start,
93
- Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
94
- collection: true
95
- attribute :fmt_annotation_end,
96
- Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
97
- collection: true
98
-
99
81
  xml do
100
82
  element "clause"
101
83
  ordered
@@ -103,18 +85,6 @@ module Metanorma
103
85
  Metanorma::StandardDocument::SectionXmlMapping.apply_clause_attributes(self)
104
86
  Metanorma::StandardDocument::SectionXmlMapping.apply_clause_elements(self)
105
87
  end
106
-
107
- # Blocks in document order, used by JSON serialization
108
- def blocks
109
- @blocks ||=
110
- begin
111
- result = []
112
- each_mixed_content do |node|
113
- result << node unless node.is_a?(String)
114
- end
115
- result
116
- end
117
- end
118
88
  end
119
89
  end
120
90
  end
@@ -14,8 +14,9 @@ module Metanorma
14
14
  # definitions*
15
15
  # }
16
16
  class DefinitionSection < Lutaml::Model::Serializable
17
+ include Metanorma::StandardDocument::PresentationAttributes
18
+
17
19
  attribute :id, :string
18
- attribute :anchor, :string
19
20
  attribute :type, :string
20
21
  attribute :number, :string
21
22
  attribute :obligation, :string
@@ -46,31 +47,24 @@ module Metanorma
46
47
  # Recursive definitions
47
48
  attribute :definitions, DefinitionSection, collection: true
48
49
 
49
- # Presentation-specific attributes
50
- attribute :semx_id, :string
51
- attribute :autonum, :string
52
- attribute :displayorder, :integer
53
- attribute :fmt_title,
54
- Metanorma::Document::Components::Inline::FmtTitleElement
55
- attribute :fmt_xref_label,
56
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
57
- collection: true
58
-
59
50
  xml do
60
51
  element "definitions"
61
52
  ordered
62
53
 
63
54
  Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
64
55
 
65
- map_element "title", to: :title
66
- map_element "p", to: :paragraphs
67
- map_element "ul", to: :unordered_lists
68
- map_element "table", to: :tables
69
- map_element "dl", to: :definition_lists
70
- map_element "example", to: :examples
71
- map_element "definitions", to: :definitions
72
- map_element "fmt-title", to: :fmt_title
56
+ map_element "title", to: :title
57
+ map_element "variant-title", to: :variant_title
58
+ map_element "p", to: :paragraphs
59
+ map_element "ul", to: :unordered_lists
60
+ map_element "table", to: :tables
61
+ map_element "dl", to: :definition_lists
62
+ map_element "example", to: :examples
63
+ map_element "definitions", to: :definitions
64
+ map_element "fmt-title", to: :fmt_title
73
65
  map_element "fmt-xref-label", to: :fmt_xref_label
66
+ map_element "fmt-annotation-start", to: :fmt_annotation_start
67
+ map_element "fmt-annotation-end", to: :fmt_annotation_end
74
68
  end
75
69
  end
76
70
  end
@@ -11,6 +11,7 @@ module Metanorma
11
11
  # ( BasicBlock*, content-subsection* )
12
12
  class ContentSection < Lutaml::Model::Serializable
13
13
  include Metanorma::StandardDocument::BlockAttributes
14
+ include Metanorma::StandardDocument::PresentationAttributes
14
15
 
15
16
  # Section identity
16
17
  attribute :id, :string
@@ -27,26 +28,6 @@ module Metanorma
27
28
  # Nested content subsections (recursive)
28
29
  attribute :subsection, ContentSection, collection: true
29
30
 
30
- # Presentation-specific attributes
31
- attribute :anchor, :string
32
- attribute :semx_id, :string
33
- attribute :autonum, :string
34
- attribute :displayorder, :integer
35
- attribute :fmt_title,
36
- Metanorma::Document::Components::Inline::FmtTitleElement
37
- attribute :fmt_xref_label,
38
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
39
- collection: true
40
- attribute :variant_title,
41
- Metanorma::Document::Components::Inline::VariantTitleElement,
42
- collection: true
43
- attribute :fmt_annotation_start,
44
- Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
45
- collection: true
46
- attribute :fmt_annotation_end,
47
- Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
48
- collection: true
49
-
50
31
  xml do
51
32
  element "clause"
52
33
  ordered
@@ -13,8 +13,9 @@ module Metanorma
13
13
  # term+
14
14
  # }
15
15
  class TermsSection < Lutaml::Model::Serializable
16
+ include Metanorma::StandardDocument::PresentationAttributes
17
+
16
18
  attribute :id, :string
17
- attribute :anchor, :string
18
19
  attribute :type, :string
19
20
  attribute :number, :string
20
21
  attribute :obligation, :string
@@ -38,19 +39,6 @@ module Metanorma
38
39
  Metanorma::StandardDocument::Terms::Term,
39
40
  collection: true
40
41
 
41
- # Presentation-specific attributes
42
- attribute :semx_id, :string
43
- attribute :autonum, :string
44
- attribute :displayorder, :integer
45
- attribute :fmt_title,
46
- Metanorma::Document::Components::Inline::FmtTitleElement
47
- attribute :fmt_xref_label,
48
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
49
- collection: true
50
- attribute :variant_title,
51
- Metanorma::Document::Components::Inline::VariantTitleElement,
52
- collection: true
53
-
54
42
  xml do
55
43
  element "terms"
56
44
  ordered
@@ -64,6 +52,8 @@ module Metanorma
64
52
  map_element "p", to: :paragraphs
65
53
  map_element "ul", to: :unordered_lists
66
54
  map_element "term", to: :terms
55
+ map_element "fmt-annotation-start", to: :fmt_annotation_start
56
+ map_element "fmt-annotation-end", to: :fmt_annotation_end
67
57
  end
68
58
  end
69
59
  end
@@ -7,6 +7,9 @@ module Metanorma
7
7
  autoload :BlockAttributes, "metanorma/standard_document/block_attributes"
8
8
  autoload :BlockXmlMapping, "metanorma/standard_document/block_attributes"
9
9
  autoload :SectionXmlMapping, "metanorma/standard_document/block_attributes"
10
+ autoload :PresentationAttributes,
11
+ "metanorma/standard_document/block_attributes"
12
+ autoload :OrderedContent, "metanorma/standard_document/block_attributes"
10
13
  autoload :Blocks, "metanorma/standard_document/blocks"
11
14
  autoload :Boilerplate, "metanorma/standard_document/boilerplate"
12
15
  autoload :Elements, "metanorma/standard_document/elements"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-document
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.