coradoc 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +82 -36
- data/coradoc-adoc/lib/coradoc/asciidoc/model/document.rb +2 -2
- data/coradoc-adoc/lib/coradoc/asciidoc/model/include.rb +2 -2
- data/coradoc-adoc/lib/coradoc/asciidoc/model.rb +6 -4
- data/coradoc-adoc/lib/coradoc/asciidoc/parser/block.rb +5 -4
- data/coradoc-adoc/lib/coradoc/asciidoc/parser/content.rb +4 -2
- data/coradoc-adoc/lib/coradoc/asciidoc/transform/from_core_model.rb +84 -13
- data/coradoc-adoc/lib/coradoc/asciidoc/transform/to_core_model.rb +94 -25
- data/coradoc-adoc/lib/coradoc/asciidoc/transform/to_core_model_registrations.rb +42 -18
- data/coradoc-adoc/lib/coradoc/asciidoc/transformer/structural_rules.rb +2 -1
- data/coradoc-adoc/lib/coradoc/asciidoc.rb +7 -2
- data/coradoc-adoc/spec/coradoc/asciidoc/integration_pipeline_spec.rb +1 -3
- data/coradoc-adoc/spec/coradoc/asciidoc/round_trip_spec.rb +0 -1
- data/coradoc-adoc/spec/coradoc/asciidoc/transform/from_core_model_spec.rb +3 -2
- data/coradoc-adoc/spec/coradoc/developer_experience_spec.rb +0 -1
- data/coradoc-adoc/spec/transform/from_core_model_spec.rb +3 -3
- data/coradoc-adoc/spec/transform/to_core_model_spec.rb +1 -0
- data/coradoc-html/lib/coradoc/html/converters/base.rb +41 -17
- data/coradoc-html/lib/coradoc/html/converters/example.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/listing.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/literal.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/open.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/quote.rb +2 -3
- data/coradoc-html/lib/coradoc/html/converters/sidebar.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/source.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/source_code.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/term.rb +1 -2
- data/coradoc-html/lib/coradoc/html/converters/verse.rb +2 -3
- data/coradoc-html/lib/coradoc/html/input/converters/aside.rb +1 -1
- data/coradoc-html/lib/coradoc/html/input/converters/audio.rb +1 -1
- data/coradoc-html/lib/coradoc/html/input/converters/blockquote.rb +2 -3
- data/coradoc-html/lib/coradoc/html/input/converters/div.rb +1 -2
- data/coradoc-html/lib/coradoc/html/input/converters/figure.rb +2 -3
- data/coradoc-html/lib/coradoc/html/input/converters/hr.rb +1 -1
- data/coradoc-html/lib/coradoc/html/input/converters/p.rb +2 -1
- data/coradoc-html/lib/coradoc/html/input/converters/pre.rb +14 -10
- data/coradoc-html/lib/coradoc/html/input/converters/video.rb +1 -1
- data/coradoc-html/lib/coradoc/html/renderer.rb +50 -2
- data/coradoc-html/lib/coradoc/html/spa.rb +2 -2
- data/coradoc-html/lib/coradoc/html/static.rb +2 -2
- data/coradoc-html/lib/coradoc/html/templates/core_model/definition_list.liquid +11 -0
- data/coradoc-html/lib/coradoc/html/theme/modern/javascript_generator.rb +2 -2
- data/coradoc-html/lib/coradoc/html/theme/modern/serializers/document_serializer.rb +7 -11
- data/coradoc-html/lib/coradoc/html/theme/modern_renderer.rb +6 -7
- data/coradoc-html/lib/coradoc/html.rb +5 -15
- data/coradoc-html/spec/input/converters/converters_spec.rb +1 -1
- data/coradoc-markdown/lib/coradoc/markdown/model/attribute_list.rb +0 -3
- data/coradoc-markdown/lib/coradoc/markdown/model/definition_list.rb +0 -3
- data/coradoc-markdown/lib/coradoc/markdown/model/extension.rb +0 -2
- data/coradoc-markdown/lib/coradoc/markdown/model/highlight.rb +0 -1
- data/coradoc-markdown/lib/coradoc/markdown/model/math.rb +0 -1
- data/coradoc-markdown/lib/coradoc/markdown/model/strikethrough.rb +0 -1
- data/coradoc-markdown/lib/coradoc/markdown/parser/ast_processor.rb +2 -2
- data/coradoc-markdown/lib/coradoc/markdown/parser/block_parser.rb +2 -2
- data/coradoc-markdown/lib/coradoc/markdown/parser/inline_parser.rb +3 -3
- data/coradoc-markdown/lib/coradoc/markdown/parser.rb +9 -3
- data/coradoc-markdown/lib/coradoc/markdown/toc_generator.rb +6 -4
- data/coradoc-markdown/lib/coradoc/markdown/transform/from_core_model.rb +27 -6
- data/coradoc-markdown/lib/coradoc/markdown/transform/to_core_model.rb +5 -9
- data/coradoc-markdown/lib/coradoc/markdown/transformer.rb +2 -1
- data/coradoc-markdown/spec/transform/to_core_model_spec.rb +6 -8
- data/exe/coradoc +1 -0
- data/lib/coradoc/coradoc.rb +6 -7
- data/lib/coradoc/core_model/annotation_block.rb +0 -2
- data/lib/coradoc/core_model/block.rb +92 -32
- data/lib/coradoc/core_model/builder/block_builder.rb +20 -2
- data/lib/coradoc/core_model/builder/detection.rb +0 -8
- data/lib/coradoc/core_model/builder.rb +6 -7
- data/lib/coradoc/core_model/example_block.rb +12 -0
- data/lib/coradoc/core_model/listing_block.rb +15 -0
- data/lib/coradoc/core_model/literal_block.rb +12 -0
- data/lib/coradoc/core_model/open_block.rb +12 -0
- data/lib/coradoc/core_model/pass_block.rb +12 -0
- data/lib/coradoc/core_model/quote_block.rb +14 -0
- data/lib/coradoc/core_model/reviewer_block.rb +12 -0
- data/lib/coradoc/core_model/sidebar_block.rb +12 -0
- data/lib/coradoc/core_model/source_block.rb +22 -0
- data/lib/coradoc/core_model/verse_block.rb +14 -0
- data/lib/coradoc/core_model.rb +10 -0
- data/lib/coradoc/processor_registry.rb +0 -2
- data/lib/coradoc/version.rb +1 -1
- metadata +12 -34
- data/coradoc-markdown/coverage/.last_run.json +0 -5
- data/coradoc-markdown/coverage/.resultset.json +0 -6322
- data/coradoc-markdown/coverage/.resultset.json.lock +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/application.css +0 -1
- data/coradoc-markdown/coverage/assets/0.13.2/application.js +0 -7
- data/coradoc-markdown/coverage/assets/0.13.2/colorbox/border.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/colorbox/controls.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/colorbox/loading.gif +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/colorbox/loading_background.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/favicon_green.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/favicon_red.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/favicon_yellow.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-icons_222222_256x240.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-icons_454545_256x240.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-icons_888888_256x240.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/loading.gif +0 -0
- data/coradoc-markdown/coverage/assets/0.13.2/magnify.png +0 -0
- data/coradoc-markdown/coverage/index.html +0 -66032
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e11ee6694907b37fdbd6fd3e19fcb999f418a7e651ad75905e4a1624cb4b90f
|
|
4
|
+
data.tar.gz: 52d69f86c727cbd25531a0849f5ac45df26c22d7adeb7d3cf7af6dcd6ec04cbb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5b89c11f9d99a1a5791e8c2cad44437dbb9af3adad2d5c5600b64d6d0cd222282e577367c2a09035baa69095a43468535cf93092759d788439a65ad33ae3d15
|
|
7
|
+
data.tar.gz: 26174aca95a3d2553919b31b65718ac0376f6c8e46744772201bf5869796226df2223353808ffdcaf871ff4b698cda6effd4cbab49013fc306d3d181af510bff
|
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-
|
|
3
|
+
# on 2026-05-09 04:47:12 UTC using RuboCop version 1.75.8.
|
|
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
|
|
@@ -15,33 +15,56 @@ Gemspec/RequiredRubyVersion:
|
|
|
15
15
|
- 'coradoc-html/coradoc-html.gemspec'
|
|
16
16
|
- 'coradoc.gemspec'
|
|
17
17
|
|
|
18
|
-
# Offense count:
|
|
18
|
+
# Offense count: 2
|
|
19
19
|
# This cop supports safe autocorrection (--autocorrect).
|
|
20
20
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
21
21
|
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
22
22
|
Layout/ArgumentAlignment:
|
|
23
23
|
Exclude:
|
|
24
|
-
- 'coradoc-adoc/lib/coradoc/asciidoc/
|
|
24
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/transformer/structural_rules.rb'
|
|
25
25
|
|
|
26
26
|
# Offense count: 1
|
|
27
27
|
# This cop supports safe autocorrection (--autocorrect).
|
|
28
|
-
|
|
28
|
+
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
|
29
|
+
# SupportedStylesAlignWith: start_of_line, def
|
|
30
|
+
Layout/DefEndAlignment:
|
|
29
31
|
Exclude:
|
|
30
|
-
- 'lib/coradoc/
|
|
32
|
+
- 'lib/coradoc/core_model/block.rb'
|
|
31
33
|
|
|
32
|
-
# Offense count:
|
|
34
|
+
# Offense count: 2
|
|
33
35
|
# This cop supports safe autocorrection (--autocorrect).
|
|
34
36
|
Layout/EmptyLineAfterGuardClause:
|
|
35
37
|
Exclude:
|
|
36
|
-
- 'coradoc-adoc/
|
|
38
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/transform/to_core_model.rb'
|
|
39
|
+
- 'coradoc-html/lib/coradoc/html/renderer.rb'
|
|
40
|
+
|
|
41
|
+
# Offense count: 4
|
|
42
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
43
|
+
Layout/EmptyLines:
|
|
44
|
+
Exclude:
|
|
45
|
+
- 'coradoc-markdown/lib/coradoc/markdown/model/extension.rb'
|
|
46
|
+
- 'coradoc-markdown/lib/coradoc/markdown/model/highlight.rb'
|
|
47
|
+
- 'coradoc-markdown/lib/coradoc/markdown/model/math.rb'
|
|
48
|
+
- 'coradoc-markdown/lib/coradoc/markdown/model/strikethrough.rb'
|
|
49
|
+
|
|
50
|
+
# Offense count: 12
|
|
51
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
52
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
53
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
54
|
+
# SupportedColonStyles: key, separator, table
|
|
55
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
56
|
+
Layout/HashAlignment:
|
|
57
|
+
Exclude:
|
|
58
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/parser/block.rb'
|
|
59
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/transformer/structural_rules.rb'
|
|
60
|
+
- 'spec/core_model/typed_blocks_spec.rb'
|
|
37
61
|
|
|
38
62
|
# Offense count: 1
|
|
39
63
|
# This cop supports safe autocorrection (--autocorrect).
|
|
40
|
-
# Configuration parameters:
|
|
41
|
-
|
|
42
|
-
Layout/FirstArgumentIndentation:
|
|
64
|
+
# Configuration parameters: Width, AllowedPatterns.
|
|
65
|
+
Layout/IndentationWidth:
|
|
43
66
|
Exclude:
|
|
44
|
-
- 'lib/coradoc/
|
|
67
|
+
- 'lib/coradoc/core_model/block.rb'
|
|
45
68
|
|
|
46
69
|
# Offense count: 6
|
|
47
70
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -50,26 +73,24 @@ Layout/FirstArgumentIndentation:
|
|
|
50
73
|
Layout/LineLength:
|
|
51
74
|
Max: 235
|
|
52
75
|
|
|
53
|
-
# Offense count:
|
|
54
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
55
|
-
# Configuration parameters: EnforcedStyle.
|
|
56
|
-
# SupportedStyles: symmetrical, new_line, same_line
|
|
57
|
-
Layout/MultilineMethodCallBraceLayout:
|
|
58
|
-
Exclude:
|
|
59
|
-
- 'lib/coradoc/document_manipulator.rb'
|
|
60
|
-
|
|
61
|
-
# Offense count: 1
|
|
76
|
+
# Offense count: 2
|
|
62
77
|
# This cop supports safe autocorrection (--autocorrect).
|
|
63
78
|
# Configuration parameters: AllowInHeredoc.
|
|
64
79
|
Layout/TrailingWhitespace:
|
|
65
80
|
Exclude:
|
|
66
|
-
- 'coradoc-adoc/lib/coradoc/asciidoc/
|
|
81
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/parser/block.rb'
|
|
82
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/transformer/structural_rules.rb'
|
|
67
83
|
|
|
68
84
|
# Offense count: 1
|
|
69
85
|
Lint/BinaryOperatorWithIdenticalOperands:
|
|
70
86
|
Exclude:
|
|
71
87
|
- 'coradoc-html/lib/coradoc/html/converters/attribute_reference.rb'
|
|
72
88
|
|
|
89
|
+
# Offense count: 1
|
|
90
|
+
Lint/DuplicateCaseCondition:
|
|
91
|
+
Exclude:
|
|
92
|
+
- 'coradoc-html/lib/coradoc/html/converters/base.rb'
|
|
93
|
+
|
|
73
94
|
# Offense count: 3
|
|
74
95
|
# This cop supports safe autocorrection (--autocorrect).
|
|
75
96
|
# Configuration parameters: AutoCorrect, AllowComments.
|
|
@@ -98,6 +119,13 @@ Lint/MissingSuper:
|
|
|
98
119
|
- 'coradoc-html/lib/coradoc/html/converters/template_html_converter.rb'
|
|
99
120
|
- 'lib/coradoc/visitor.rb'
|
|
100
121
|
|
|
122
|
+
# Offense count: 2
|
|
123
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
124
|
+
Lint/RedundantCopEnableDirective:
|
|
125
|
+
Exclude:
|
|
126
|
+
- 'coradoc-adoc/spec/coradoc/asciidoc/round_trip_spec.rb'
|
|
127
|
+
- 'coradoc-adoc/spec/coradoc/developer_experience_spec.rb'
|
|
128
|
+
|
|
101
129
|
# Offense count: 29
|
|
102
130
|
# Configuration parameters: AllowKeywordBlockArguments.
|
|
103
131
|
Lint/UnderscorePrefixedVariableName:
|
|
@@ -142,7 +170,7 @@ Lint/Void:
|
|
|
142
170
|
# Offense count: 237
|
|
143
171
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
144
172
|
Metrics/AbcSize:
|
|
145
|
-
Max:
|
|
173
|
+
Max: 190
|
|
146
174
|
|
|
147
175
|
# Offense count: 15
|
|
148
176
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
@@ -160,15 +188,15 @@ Metrics/BlockNesting:
|
|
|
160
188
|
Metrics/ClassLength:
|
|
161
189
|
Max: 556
|
|
162
190
|
|
|
163
|
-
# Offense count:
|
|
191
|
+
# Offense count: 183
|
|
164
192
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
165
193
|
Metrics/CyclomaticComplexity:
|
|
166
|
-
Max:
|
|
194
|
+
Max: 33
|
|
167
195
|
|
|
168
|
-
# Offense count:
|
|
196
|
+
# Offense count: 388
|
|
169
197
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
170
198
|
Metrics/MethodLength:
|
|
171
|
-
Max:
|
|
199
|
+
Max: 245
|
|
172
200
|
|
|
173
201
|
# Offense count: 21
|
|
174
202
|
# Configuration parameters: CountComments, CountAsOne.
|
|
@@ -253,7 +281,7 @@ RSpec/BeforeAfterAll:
|
|
|
253
281
|
- '**/spec/support/**/*.rb'
|
|
254
282
|
- 'spec/benchmark/performance_spec.rb'
|
|
255
283
|
|
|
256
|
-
# Offense count:
|
|
284
|
+
# Offense count: 24
|
|
257
285
|
# Configuration parameters: IgnoredMetadata.
|
|
258
286
|
RSpec/DescribeClass:
|
|
259
287
|
Enabled: false
|
|
@@ -309,7 +337,7 @@ RSpec/MessageSpies:
|
|
|
309
337
|
RSpec/MultipleDescribes:
|
|
310
338
|
Enabled: false
|
|
311
339
|
|
|
312
|
-
# Offense count:
|
|
340
|
+
# Offense count: 629
|
|
313
341
|
RSpec/MultipleExpectations:
|
|
314
342
|
Max: 12
|
|
315
343
|
|
|
@@ -388,19 +416,23 @@ Style/ClassVars:
|
|
|
388
416
|
- 'coradoc-adoc/lib/coradoc/asciidoc/serializer/element_registry.rb'
|
|
389
417
|
- 'coradoc-html/lib/coradoc/html/input/converters.rb'
|
|
390
418
|
|
|
391
|
-
# Offense count:
|
|
419
|
+
# Offense count: 305
|
|
392
420
|
# Configuration parameters: AllowedConstants.
|
|
393
421
|
Style/Documentation:
|
|
394
422
|
Enabled: false
|
|
395
423
|
|
|
396
|
-
# Offense count:
|
|
424
|
+
# Offense count: 7
|
|
397
425
|
# This cop supports safe autocorrection (--autocorrect).
|
|
398
426
|
# Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
|
|
399
427
|
# SupportedStyles: empty, nil, both
|
|
400
428
|
Style/EmptyElse:
|
|
401
429
|
Exclude:
|
|
402
430
|
- 'coradoc-docx/lib/coradoc/docx/transform/rules/bookmark_rule.rb'
|
|
431
|
+
- 'coradoc-html/lib/coradoc/html/converters/base.rb'
|
|
403
432
|
- 'coradoc-html/lib/coradoc/html/input/converters/text.rb'
|
|
433
|
+
- 'coradoc-markdown/lib/coradoc/markdown/transform/from_core_model.rb'
|
|
434
|
+
- 'lib/coradoc/core_model/block.rb'
|
|
435
|
+
- 'lib/coradoc/core_model/builder/block_builder.rb'
|
|
404
436
|
- 'lib/coradoc/core_model/toc_generator.rb'
|
|
405
437
|
|
|
406
438
|
# Offense count: 3
|
|
@@ -416,25 +448,25 @@ Style/GlobalVars:
|
|
|
416
448
|
Exclude:
|
|
417
449
|
- 'utils/parser_analyzer.rb'
|
|
418
450
|
|
|
419
|
-
# Offense count:
|
|
451
|
+
# Offense count: 6
|
|
420
452
|
# Configuration parameters: MinBranchesCount.
|
|
421
453
|
Style/HashLikeCase:
|
|
422
454
|
Exclude:
|
|
423
455
|
- 'coradoc-adoc/lib/coradoc/asciidoc/model/table_cell.rb'
|
|
424
456
|
- 'coradoc-html/lib/coradoc/html/input/converters/table.rb'
|
|
425
457
|
- 'coradoc-html/lib/coradoc/html/input/converters/td.rb'
|
|
458
|
+
- 'lib/coradoc/core_model/builder/block_builder.rb'
|
|
426
459
|
|
|
427
|
-
# Offense count:
|
|
460
|
+
# Offense count: 1
|
|
428
461
|
# This cop supports safe autocorrection (--autocorrect).
|
|
429
462
|
Style/IfUnlessModifier:
|
|
430
463
|
Exclude:
|
|
431
464
|
- 'coradoc-adoc/spec/coradoc/asciidoc/integration_pipeline_spec.rb'
|
|
432
465
|
|
|
433
|
-
# Offense count:
|
|
434
|
-
|
|
435
|
-
Style/MultilineIfModifier:
|
|
466
|
+
# Offense count: 2
|
|
467
|
+
Style/MultilineBlockChain:
|
|
436
468
|
Exclude:
|
|
437
|
-
- 'coradoc-adoc/lib/coradoc/asciidoc/
|
|
469
|
+
- 'coradoc-adoc/lib/coradoc/asciidoc/transform/to_core_model.rb'
|
|
438
470
|
|
|
439
471
|
# Offense count: 1
|
|
440
472
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
@@ -451,6 +483,20 @@ Style/OptionalBooleanParameter:
|
|
|
451
483
|
Exclude:
|
|
452
484
|
- 'coradoc-adoc/lib/coradoc/asciidoc/parser/content.rb'
|
|
453
485
|
|
|
486
|
+
# Offense count: 1
|
|
487
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
488
|
+
Style/RedundantParentheses:
|
|
489
|
+
Exclude:
|
|
490
|
+
- 'lib/coradoc/core_model/block.rb'
|
|
491
|
+
|
|
492
|
+
# Offense count: 1
|
|
493
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
494
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
|
495
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
|
496
|
+
Style/SafeNavigation:
|
|
497
|
+
Exclude:
|
|
498
|
+
- 'coradoc-adoc/spec/coradoc/asciidoc/integration_pipeline_spec.rb'
|
|
499
|
+
|
|
454
500
|
# Offense count: 1
|
|
455
501
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
456
502
|
# Configuration parameters: Mode.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'resolver'
|
|
4
|
-
|
|
5
3
|
module Coradoc
|
|
6
4
|
module AsciiDoc
|
|
7
5
|
module Model
|
|
6
|
+
autoload :Resolver, "#{__dir__}/resolver"
|
|
7
|
+
|
|
8
8
|
# Document model representing an AsciiDoc document.
|
|
9
9
|
#
|
|
10
10
|
# The Document class is the main container for parsed AsciiDoc content.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'resolvable'
|
|
4
|
-
|
|
5
3
|
module Coradoc
|
|
6
4
|
module AsciiDoc
|
|
7
5
|
module Model
|
|
6
|
+
autoload :Resolvable, "#{__dir__}/resolvable"
|
|
7
|
+
|
|
8
8
|
# Include directive element for AsciiDoc documents.
|
|
9
9
|
#
|
|
10
10
|
# Include directives allow incorporating content from external files
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# IMPORTANT: Load
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
require_relative 'model/base'
|
|
3
|
+
# IMPORTANT: Load Serialization module eagerly — it registers the asciidoc
|
|
4
|
+
# format with Lutaml::Model, which is needed before any model class can
|
|
5
|
+
# use the asciidoc DSL.
|
|
7
6
|
require_relative 'model/serialization'
|
|
8
7
|
|
|
9
8
|
module Coradoc
|
|
10
9
|
module AsciiDoc
|
|
11
10
|
module Model
|
|
11
|
+
# Base class for all AsciiDoc model classes (no side effects)
|
|
12
|
+
autoload :Base, "#{__dir__}/model/base"
|
|
13
|
+
|
|
12
14
|
# Layer 0: Mixins (no dependencies)
|
|
13
15
|
autoload :Anchorable, "#{__dir__}/model/anchorable"
|
|
14
16
|
autoload :Attached, "#{__dir__}/model/attached"
|
|
@@ -55,7 +55,7 @@ module Coradoc
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def source_block(n_deep)
|
|
58
|
-
block_style(n_deep, '-', 4)
|
|
58
|
+
block_style(n_deep, '-', 4, verbatim: true)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# Open block: exactly 2 dashes (cannot nest within itself)
|
|
@@ -110,7 +110,7 @@ module Coradoc
|
|
|
110
110
|
# @param delimiter [String] The delimiter character ("=", "-", "_", "*", "+")
|
|
111
111
|
# @param repeater [Integer] Minimum number of delimiter characters (default: 4)
|
|
112
112
|
# @param type [Symbol] Block type for special handling (e.g., :pass)
|
|
113
|
-
def block_style(n_deep = 3, delimiter = '*', repeater = 4, type = nil)
|
|
113
|
+
def block_style(n_deep = 3, delimiter = '*', repeater = 4, type = nil, verbatim: false)
|
|
114
114
|
# repeat(repeater,) means repeater or more characters
|
|
115
115
|
current_delimiter = str(delimiter).repeat(repeater).capture(:delimit)
|
|
116
116
|
closing_delimiter = dynamic do |_s, c|
|
|
@@ -124,7 +124,8 @@ module Coradoc
|
|
|
124
124
|
closing_pattern = str(delim_str) >> newline
|
|
125
125
|
|
|
126
126
|
# Build content that doesn't match the closing delimiter
|
|
127
|
-
content = block_image | list | text_line(false, unguarded: true
|
|
127
|
+
content = block_image | list | text_line(false, unguarded: true,
|
|
128
|
+
verbatim: verbatim) | empty_line.as(:line_break)
|
|
128
129
|
if n_deep.positive?
|
|
129
130
|
# For nested blocks, also prevent them from consuming the closing delimiter
|
|
130
131
|
content |= block(n_deep - 1)
|
|
@@ -139,7 +140,7 @@ module Coradoc
|
|
|
139
140
|
line_start? >>
|
|
140
141
|
current_delimiter.as(:delimiter) >> newline >>
|
|
141
142
|
if type == :pass
|
|
142
|
-
(text_line(false, unguarded: true) | empty_line.as(:line_break)).repeat(1).as(:lines)
|
|
143
|
+
(text_line(false, unguarded: true, verbatim: verbatim) | empty_line.as(:line_break)).repeat(1).as(:lines)
|
|
143
144
|
else
|
|
144
145
|
# Use dynamic block content that respects closing delimiter
|
|
145
146
|
block_content_with_closing.as(:lines)
|
|
@@ -22,8 +22,10 @@ module Coradoc
|
|
|
22
22
|
|
|
23
23
|
# Text
|
|
24
24
|
# :zero :one :many
|
|
25
|
-
def text_line(many_breaks = false, unguarded: false)
|
|
26
|
-
tl = if
|
|
25
|
+
def text_line(many_breaks = false, unguarded: false, verbatim: false)
|
|
26
|
+
tl = if verbatim
|
|
27
|
+
text_any.as(:text)
|
|
28
|
+
elsif unguarded
|
|
27
29
|
literal_space? >> text_any.as(:text)
|
|
28
30
|
else
|
|
29
31
|
(asciidoc_char_with_id.absent? | element_id_inline) >>
|
|
@@ -103,14 +103,15 @@ module Coradoc
|
|
|
103
103
|
def transform_block(block)
|
|
104
104
|
content = block.renderable_content
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
semantic = resolve_semantic_type(block)
|
|
107
|
+
|
|
108
|
+
case semantic
|
|
109
|
+
when :paragraph
|
|
107
110
|
return Coradoc::AsciiDoc::Model::Paragraph.new(
|
|
108
111
|
id: block.id,
|
|
109
112
|
content: create_text_elements(content)
|
|
110
113
|
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if block.element_type == 'comment'
|
|
114
|
+
when :comment
|
|
114
115
|
return Coradoc::AsciiDoc::Model::CommentBlock.new(
|
|
115
116
|
text: safe_content_to_string(content)
|
|
116
117
|
)
|
|
@@ -118,42 +119,67 @@ module Coradoc
|
|
|
118
119
|
|
|
119
120
|
content_text = safe_content_to_string(content)
|
|
120
121
|
|
|
121
|
-
case
|
|
122
|
-
when
|
|
122
|
+
case semantic
|
|
123
|
+
when :source_code
|
|
123
124
|
Coradoc::AsciiDoc::Model::Block::SourceCode.new(
|
|
124
125
|
id: block.id,
|
|
125
126
|
title: block.title,
|
|
126
127
|
lines: content_text.split("\n"),
|
|
127
128
|
attributes: build_attributes(block)
|
|
128
129
|
)
|
|
129
|
-
when
|
|
130
|
+
when :quote
|
|
130
131
|
Coradoc::AsciiDoc::Model::Block::Quote.new(
|
|
131
132
|
id: block.id,
|
|
132
133
|
title: block.title,
|
|
133
134
|
lines: content_text.split("\n")
|
|
134
135
|
)
|
|
135
|
-
when
|
|
136
|
+
when :example
|
|
136
137
|
Coradoc::AsciiDoc::Model::Block::Example.new(
|
|
137
138
|
id: block.id,
|
|
138
139
|
title: block.title,
|
|
139
140
|
lines: content_text.split("\n")
|
|
140
141
|
)
|
|
141
|
-
when
|
|
142
|
+
when :sidebar
|
|
142
143
|
Coradoc::AsciiDoc::Model::Block::Side.new(
|
|
143
144
|
id: block.id,
|
|
144
145
|
title: block.title,
|
|
145
146
|
lines: content_text.split("\n")
|
|
146
147
|
)
|
|
147
|
-
when
|
|
148
|
+
when :literal
|
|
148
149
|
Coradoc::AsciiDoc::Model::Block::Literal.new(
|
|
149
150
|
id: block.id,
|
|
150
151
|
title: block.title,
|
|
151
152
|
lines: content_text.split("\n")
|
|
152
153
|
)
|
|
153
|
-
when
|
|
154
|
-
Coradoc::AsciiDoc::Model::
|
|
154
|
+
when :open
|
|
155
|
+
Coradoc::AsciiDoc::Model::Block::Open.new(
|
|
155
156
|
id: block.id,
|
|
156
|
-
|
|
157
|
+
title: block.title,
|
|
158
|
+
lines: content_text.split("\n")
|
|
159
|
+
)
|
|
160
|
+
when :pass
|
|
161
|
+
Coradoc::AsciiDoc::Model::Block::Pass.new(
|
|
162
|
+
id: block.id,
|
|
163
|
+
title: block.title,
|
|
164
|
+
lines: content_text.split("\n")
|
|
165
|
+
)
|
|
166
|
+
when :listing
|
|
167
|
+
Coradoc::AsciiDoc::Model::Block::Listing.new(
|
|
168
|
+
id: block.id,
|
|
169
|
+
title: block.title,
|
|
170
|
+
lines: content_text.split("\n")
|
|
171
|
+
)
|
|
172
|
+
when :verse
|
|
173
|
+
Coradoc::AsciiDoc::Model::Block::Quote.new(
|
|
174
|
+
id: block.id,
|
|
175
|
+
title: block.title,
|
|
176
|
+
lines: content_text.split("\n")
|
|
177
|
+
)
|
|
178
|
+
when :reviewer
|
|
179
|
+
Coradoc::AsciiDoc::Model::Block::ReviewerComment.new(
|
|
180
|
+
id: block.id,
|
|
181
|
+
title: block.title,
|
|
182
|
+
lines: content_text.split("\n")
|
|
157
183
|
)
|
|
158
184
|
else
|
|
159
185
|
delim = block.delimiter_type.to_s
|
|
@@ -350,6 +376,51 @@ module Coradoc
|
|
|
350
376
|
|
|
351
377
|
private
|
|
352
378
|
|
|
379
|
+
# Reverse mapping: semantic type → AsciiDoc delimiter generation
|
|
380
|
+
SEMANTIC_TO_ADOC_BLOCK = {
|
|
381
|
+
source_code: :source_code,
|
|
382
|
+
quote: :quote,
|
|
383
|
+
example: :example,
|
|
384
|
+
sidebar: :sidebar,
|
|
385
|
+
literal: :literal,
|
|
386
|
+
pass: :pass,
|
|
387
|
+
open: :open,
|
|
388
|
+
verse: :open,
|
|
389
|
+
paragraph: :paragraph,
|
|
390
|
+
comment: :comment
|
|
391
|
+
}.freeze
|
|
392
|
+
|
|
393
|
+
# Map raw delimiter_type string → semantic type (backward compat)
|
|
394
|
+
DELIMITER_CHAR_TO_SEMANTIC = {
|
|
395
|
+
'-' => :source_code,
|
|
396
|
+
'=' => :example,
|
|
397
|
+
'_' => :quote,
|
|
398
|
+
'*' => :sidebar,
|
|
399
|
+
'.' => :literal,
|
|
400
|
+
'+' => :pass
|
|
401
|
+
}.freeze
|
|
402
|
+
|
|
403
|
+
def resolve_semantic_type(block)
|
|
404
|
+
# Polymorphic dispatch: typed classes override semantic_type
|
|
405
|
+
semantic = block.resolve_semantic_type
|
|
406
|
+
return semantic if semantic
|
|
407
|
+
|
|
408
|
+
# Format-specific fallback from delimiter_type
|
|
409
|
+
delim = block.delimiter_type
|
|
410
|
+
return nil unless delim && !delim.empty?
|
|
411
|
+
|
|
412
|
+
case delim
|
|
413
|
+
when 'comment' then :comment
|
|
414
|
+
when 'paragraph' then :paragraph
|
|
415
|
+
when '[verse]' then :verse
|
|
416
|
+
when '>' then :quote
|
|
417
|
+
when "'''", '---', '___', '***' then :horizontal_rule
|
|
418
|
+
else
|
|
419
|
+
char = delim[0]
|
|
420
|
+
DELIMITER_CHAR_TO_SEMANTIC[char] || nil
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
|
|
353
424
|
def safe_content_to_string(content)
|
|
354
425
|
case content
|
|
355
426
|
when String
|
|
@@ -31,21 +31,23 @@ module Coradoc
|
|
|
31
31
|
when Coradoc::AsciiDoc::Model::Paragraph
|
|
32
32
|
transform_paragraph(model)
|
|
33
33
|
when Coradoc::AsciiDoc::Model::Block::SourceCode
|
|
34
|
-
|
|
34
|
+
transform_source_block(model)
|
|
35
35
|
when Coradoc::AsciiDoc::Model::Block::Quote
|
|
36
|
-
|
|
36
|
+
transform_typed_block(model, Coradoc::CoreModel::QuoteBlock)
|
|
37
37
|
when Coradoc::AsciiDoc::Model::Block::Example
|
|
38
|
-
|
|
38
|
+
transform_typed_block(model, Coradoc::CoreModel::ExampleBlock)
|
|
39
39
|
when Coradoc::AsciiDoc::Model::Block::Side
|
|
40
|
-
|
|
40
|
+
transform_typed_block(model, Coradoc::CoreModel::SidebarBlock)
|
|
41
41
|
when Coradoc::AsciiDoc::Model::Block::Literal
|
|
42
|
-
|
|
42
|
+
transform_typed_block(model, Coradoc::CoreModel::LiteralBlock)
|
|
43
43
|
when Coradoc::AsciiDoc::Model::Block::Open
|
|
44
|
-
|
|
44
|
+
transform_typed_block(model, Coradoc::CoreModel::OpenBlock)
|
|
45
45
|
when Coradoc::AsciiDoc::Model::Block::Pass
|
|
46
|
-
|
|
46
|
+
transform_typed_block(model, Coradoc::CoreModel::PassBlock)
|
|
47
|
+
when Coradoc::AsciiDoc::Model::Block::Listing
|
|
48
|
+
transform_typed_block(model, Coradoc::CoreModel::ListingBlock)
|
|
47
49
|
when Coradoc::AsciiDoc::Model::Block::Core
|
|
48
|
-
transform_block(model, model.delimiter)
|
|
50
|
+
transform_block(model, model.delimiter.to_s)
|
|
49
51
|
when Coradoc::AsciiDoc::Model::Table
|
|
50
52
|
transform_table(model)
|
|
51
53
|
when Coradoc::AsciiDoc::Model::TableRow
|
|
@@ -125,33 +127,25 @@ module Coradoc
|
|
|
125
127
|
|
|
126
128
|
Coradoc::CoreModel::Block.new(
|
|
127
129
|
element_type: 'paragraph',
|
|
130
|
+
block_semantic_type: :paragraph,
|
|
128
131
|
id: para.id,
|
|
129
132
|
content: extract_text_content(para.content),
|
|
130
133
|
children: children
|
|
131
134
|
)
|
|
132
135
|
end
|
|
133
136
|
|
|
134
|
-
def
|
|
135
|
-
content_lines = Array(block.lines).
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
extract_core_model_text(transformed)
|
|
141
|
-
else
|
|
142
|
-
transformed.to_s
|
|
143
|
-
end
|
|
144
|
-
else
|
|
145
|
-
line.to_s
|
|
146
|
-
end
|
|
137
|
+
def transform_source_block(block)
|
|
138
|
+
content_lines = Array(block.lines).reject do |line|
|
|
139
|
+
line.is_a?(Coradoc::AsciiDoc::Model::LineBreak) ||
|
|
140
|
+
line.is_a?(Coradoc::AsciiDoc::Model::Break::PageBreak)
|
|
141
|
+
end.map do |line|
|
|
142
|
+
extract_text_content(line)
|
|
147
143
|
end.join("\n")
|
|
148
144
|
|
|
149
|
-
language = block
|
|
150
|
-
block.attributes&.positional&.first
|
|
145
|
+
language = extract_block_language(block)
|
|
151
146
|
|
|
152
|
-
Coradoc::CoreModel::
|
|
147
|
+
Coradoc::CoreModel::SourceBlock.new(
|
|
153
148
|
element_type: 'block',
|
|
154
|
-
delimiter_type: delimiter_type,
|
|
155
149
|
id: block.id,
|
|
156
150
|
title: extract_title_text(block.title),
|
|
157
151
|
content: content_lines,
|
|
@@ -159,6 +153,47 @@ module Coradoc
|
|
|
159
153
|
)
|
|
160
154
|
end
|
|
161
155
|
|
|
156
|
+
def transform_block(block, semantic_type_or_delimiter)
|
|
157
|
+
content_lines = extract_block_lines(block)
|
|
158
|
+
semantic_type = if semantic_type_or_delimiter.is_a?(Symbol)
|
|
159
|
+
semantic_type_or_delimiter
|
|
160
|
+
else
|
|
161
|
+
asciidoc_delimiter_to_semantic(semantic_type_or_delimiter)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
Coradoc::CoreModel::Block.new(
|
|
165
|
+
element_type: 'block',
|
|
166
|
+
block_semantic_type: semantic_type,
|
|
167
|
+
delimiter_type: semantic_type_or_delimiter.is_a?(String) ? semantic_type_or_delimiter : nil,
|
|
168
|
+
id: block.id,
|
|
169
|
+
title: extract_title_text(block.title),
|
|
170
|
+
content: content_lines,
|
|
171
|
+
language: extract_block_language(block)
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def transform_typed_block(block, klass, extra_attrs = {})
|
|
176
|
+
content_lines = extract_block_lines(block)
|
|
177
|
+
|
|
178
|
+
klass.new(
|
|
179
|
+
element_type: 'block',
|
|
180
|
+
id: block.id,
|
|
181
|
+
title: extract_title_text(block.title),
|
|
182
|
+
content: content_lines,
|
|
183
|
+
language: extract_block_language(block),
|
|
184
|
+
**extra_attrs
|
|
185
|
+
)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def extract_block_lines(block)
|
|
189
|
+
Array(block.lines).reject do |line|
|
|
190
|
+
line.is_a?(Coradoc::AsciiDoc::Model::LineBreak) ||
|
|
191
|
+
line.is_a?(Coradoc::AsciiDoc::Model::Break::PageBreak)
|
|
192
|
+
end.map do |line|
|
|
193
|
+
extract_text_content(line)
|
|
194
|
+
end.join("\n")
|
|
195
|
+
end
|
|
196
|
+
|
|
162
197
|
def transform_table(table)
|
|
163
198
|
rows = Array(table.rows).map do |row|
|
|
164
199
|
transform_table_row(row)
|
|
@@ -322,11 +357,45 @@ module Coradoc
|
|
|
322
357
|
|
|
323
358
|
private
|
|
324
359
|
|
|
360
|
+
# AsciiDoc delimiters are any length of the same character (4+ for most, 2+ for open).
|
|
361
|
+
# We map by the first character to handle all lengths correctly.
|
|
362
|
+
ADOC_DELIMITER_CHAR_TO_SEMANTIC = {
|
|
363
|
+
'-' => :source_code,
|
|
364
|
+
'=' => :example,
|
|
365
|
+
'_' => :quote,
|
|
366
|
+
'*' => :sidebar,
|
|
367
|
+
'.' => :literal,
|
|
368
|
+
'+' => :pass
|
|
369
|
+
}.freeze
|
|
370
|
+
|
|
371
|
+
def asciidoc_delimiter_to_semantic(delimiter)
|
|
372
|
+
return :open if delimiter && delimiter.length < 4
|
|
373
|
+
|
|
374
|
+
char = delimiter&.[](0)
|
|
375
|
+
ADOC_DELIMITER_CHAR_TO_SEMANTIC[char] || :open
|
|
376
|
+
end
|
|
377
|
+
|
|
325
378
|
def extract_document_attributes(doc)
|
|
326
379
|
return {} unless doc.document_attributes
|
|
380
|
+
|
|
327
381
|
doc.document_attributes.to_hash
|
|
328
382
|
end
|
|
329
383
|
|
|
384
|
+
def extract_block_language(block)
|
|
385
|
+
lang = block.lang
|
|
386
|
+
return lang if lang.is_a?(String) && !lang.empty?
|
|
387
|
+
|
|
388
|
+
attrs = block.attributes
|
|
389
|
+
return nil unless attrs.is_a?(Coradoc::AsciiDoc::Model::AttributeList)
|
|
390
|
+
|
|
391
|
+
named_lang = attrs['language']
|
|
392
|
+
return named_lang.to_s if named_lang
|
|
393
|
+
|
|
394
|
+
# For [source,yaml], the language is the second positional attribute
|
|
395
|
+
positional = attrs.positional
|
|
396
|
+
positional[1]&.value&.to_s if positional.length > 1
|
|
397
|
+
end
|
|
398
|
+
|
|
330
399
|
def transform_inline_content(content)
|
|
331
400
|
return [] if content.nil?
|
|
332
401
|
|