prosereflect 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +4 -0
- data/.github/workflows/release.yml +5 -0
- data/.rubocop.yml +19 -1
- data/.rubocop_todo.yml +141 -191
- data/CLAUDE.md +78 -0
- data/Gemfile +8 -4
- data/Rakefile +3 -3
- data/lib/prosereflect/attribute/base.rb +4 -6
- data/lib/prosereflect/attribute/bold.rb +2 -4
- data/lib/prosereflect/attribute/href.rb +1 -3
- data/lib/prosereflect/attribute/id.rb +7 -7
- data/lib/prosereflect/attribute.rb +4 -7
- data/lib/prosereflect/blockquote.rb +10 -11
- data/lib/prosereflect/bullet_list.rb +16 -15
- data/lib/prosereflect/code_block.rb +26 -26
- data/lib/prosereflect/code_block_wrapper.rb +12 -13
- data/lib/prosereflect/document.rb +14 -22
- data/lib/prosereflect/hard_break.rb +6 -6
- data/lib/prosereflect/heading.rb +14 -15
- data/lib/prosereflect/horizontal_rule.rb +14 -14
- data/lib/prosereflect/image.rb +23 -23
- data/lib/prosereflect/input/html.rb +83 -104
- data/lib/prosereflect/input.rb +7 -0
- data/lib/prosereflect/list_item.rb +11 -12
- data/lib/prosereflect/mark/base.rb +9 -11
- data/lib/prosereflect/mark/bold.rb +1 -3
- data/lib/prosereflect/mark/code.rb +1 -3
- data/lib/prosereflect/mark/italic.rb +1 -3
- data/lib/prosereflect/mark/link.rb +1 -3
- data/lib/prosereflect/mark/strike.rb +1 -3
- data/lib/prosereflect/mark/subscript.rb +1 -3
- data/lib/prosereflect/mark/superscript.rb +1 -3
- data/lib/prosereflect/mark/underline.rb +1 -3
- data/lib/prosereflect/mark.rb +9 -5
- data/lib/prosereflect/node.rb +31 -31
- data/lib/prosereflect/ordered_list.rb +15 -14
- data/lib/prosereflect/output/html.rb +52 -50
- data/lib/prosereflect/output.rb +7 -0
- data/lib/prosereflect/paragraph.rb +11 -13
- data/lib/prosereflect/parser.rb +47 -66
- data/lib/prosereflect/table.rb +12 -13
- data/lib/prosereflect/table_cell.rb +13 -13
- data/lib/prosereflect/table_header.rb +17 -17
- data/lib/prosereflect/table_row.rb +12 -12
- data/lib/prosereflect/text.rb +11 -11
- data/lib/prosereflect/user.rb +15 -15
- data/lib/prosereflect/version.rb +1 -1
- data/lib/prosereflect.rb +27 -17
- data/prosereflect.gemspec +17 -16
- data/spec/prosereflect/document_spec.rb +332 -330
- data/spec/prosereflect/hard_break_spec.rb +125 -125
- data/spec/prosereflect/input/html_spec.rb +522 -522
- data/spec/prosereflect/node_spec.rb +183 -182
- data/spec/prosereflect/output/html_spec.rb +105 -105
- data/spec/prosereflect/paragraph_spec.rb +275 -274
- data/spec/prosereflect/parser_spec.rb +185 -180
- data/spec/prosereflect/table_cell_spec.rb +183 -183
- data/spec/prosereflect/table_row_spec.rb +149 -149
- data/spec/prosereflect/table_spec.rb +320 -318
- data/spec/prosereflect/text_spec.rb +133 -132
- data/spec/prosereflect/user_spec.rb +31 -28
- data/spec/prosereflect_spec.rb +28 -26
- data/spec/spec_helper.rb +6 -6
- data/spec/support/matchers.rb +6 -6
- data/spec/support/shared_examples.rb +49 -49
- metadata +8 -5
- data/spec/prosereflect/version_spec.rb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5c6ec18ecdd44c7efaba52819b0763d35c829c7af571ef7b423da2863d29caf
|
|
4
|
+
data.tar.gz: ed3ed8a65bb95e4dbc89a0e96efe4f2dd4a2c57b0cc7210f6296c03a6b8c5d66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f736e62b0ef5909c60daebb95b79f29c23be47b76c56edf327adeb4bdf76df1071493def7a5530209cd5a431332f1dfec3a3428453c50c5e3e336873126be238
|
|
7
|
+
data.tar.gz: 56d78409069b3a61caf41ab36a44494f71b1f2be53e9ef15bd2290fad0eebab31cc3c7a22945b09b05f0dd0f011f65b77f0cc8045fa36230e723750b6796f118
|
data/.github/workflows/rake.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
inherit_from:
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
- .rubocop_todo.yml
|
|
6
|
+
|
|
7
|
+
inherit_mode:
|
|
8
|
+
merge:
|
|
9
|
+
- Exclude
|
|
10
|
+
|
|
11
|
+
# local repo-specific modifications
|
|
12
|
+
# ...
|
|
13
|
+
plugins:
|
|
14
|
+
- rubocop-rspec
|
|
15
|
+
- rubocop-performance
|
|
16
|
+
- rubocop-rake
|
|
17
|
+
|
|
18
|
+
AllCops:
|
|
19
|
+
TargetRubyVersion: 3.0
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,247 +1,197 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-04-13 10:04:56 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
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
|
|
11
|
-
Layout/BlockEndNewline:
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
14
|
-
|
|
15
|
-
# Offense count: 2
|
|
16
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
17
|
-
# Configuration parameters: AllowForAlignment.
|
|
18
|
-
Layout/CommentIndentation:
|
|
19
|
-
Exclude:
|
|
20
|
-
- 'e118_amendment.rb'
|
|
21
|
-
|
|
22
|
-
# Offense count: 1
|
|
23
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
24
|
-
Layout/EmptyLineAfterGuardClause:
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
|
25
11
|
Exclude:
|
|
26
|
-
- '
|
|
27
|
-
|
|
28
|
-
# Offense count: 1
|
|
29
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
30
|
-
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
31
|
-
Layout/EmptyLineBetweenDefs:
|
|
32
|
-
Exclude:
|
|
33
|
-
- 'e118_amendment.rb'
|
|
12
|
+
- 'prosereflect.gemspec'
|
|
34
13
|
|
|
35
|
-
# Offense count:
|
|
14
|
+
# Offense count: 5
|
|
36
15
|
# This cop supports safe autocorrection (--autocorrect).
|
|
37
|
-
|
|
16
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
17
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
18
|
+
# SupportedColonStyles: key, separator, table
|
|
19
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
20
|
+
Layout/HashAlignment:
|
|
38
21
|
Exclude:
|
|
39
|
-
- '
|
|
22
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
|
40
23
|
|
|
41
|
-
# Offense count:
|
|
24
|
+
# Offense count: 80
|
|
42
25
|
# This cop supports safe autocorrection (--autocorrect).
|
|
43
|
-
# Configuration parameters:
|
|
44
|
-
#
|
|
45
|
-
Layout/
|
|
46
|
-
|
|
47
|
-
- 'e118_amendment.rb'
|
|
26
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
27
|
+
# URISchemes: http, https
|
|
28
|
+
Layout/LineLength:
|
|
29
|
+
Enabled: false
|
|
48
30
|
|
|
49
|
-
# Offense count:
|
|
31
|
+
# Offense count: 5
|
|
50
32
|
# This cop supports safe autocorrection (--autocorrect).
|
|
51
|
-
# Configuration parameters:
|
|
52
|
-
Layout/
|
|
33
|
+
# Configuration parameters: AllowInHeredoc.
|
|
34
|
+
Layout/TrailingWhitespace:
|
|
53
35
|
Exclude:
|
|
54
|
-
- '
|
|
55
|
-
- 'e118_amendment.rb'
|
|
36
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
|
56
37
|
|
|
57
|
-
# Offense count:
|
|
58
|
-
#
|
|
59
|
-
Lint/
|
|
38
|
+
# Offense count: 4
|
|
39
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
40
|
+
Lint/DuplicateBranch:
|
|
60
41
|
Exclude:
|
|
61
|
-
- '
|
|
42
|
+
- 'lib/prosereflect/input/html.rb'
|
|
43
|
+
- 'lib/prosereflect/schema/attribute.rb'
|
|
44
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
45
|
+
- 'lib/prosereflect/schema/schema_class.rb'
|
|
62
46
|
|
|
63
47
|
# Offense count: 1
|
|
64
48
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
|
-
# Configuration parameters:
|
|
66
|
-
|
|
49
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
50
|
+
# NotImplementedExceptions: NotImplementedError
|
|
51
|
+
Lint/UnusedMethodArgument:
|
|
67
52
|
Exclude:
|
|
68
|
-
- '
|
|
53
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
69
54
|
|
|
70
|
-
# Offense count:
|
|
71
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
55
|
+
# Offense count: 34
|
|
56
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
72
57
|
Metrics/AbcSize:
|
|
73
|
-
Max: 98
|
|
74
|
-
|
|
75
|
-
# Offense count: 23
|
|
76
|
-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
77
|
-
# AllowedMethods: refine
|
|
78
|
-
Metrics/BlockLength:
|
|
79
|
-
Exclude:
|
|
80
|
-
- 'spec/prosereflect/input/html_spec.rb'
|
|
81
|
-
Max: 500
|
|
82
|
-
|
|
83
|
-
# Offense count: 3
|
|
84
|
-
Metrics/ClassLength:
|
|
85
58
|
Exclude:
|
|
86
59
|
- 'lib/prosereflect/input/html.rb'
|
|
87
|
-
- 'lib/prosereflect/output/html.rb'
|
|
88
60
|
- 'lib/prosereflect/node.rb'
|
|
61
|
+
- 'lib/prosereflect/output/html.rb'
|
|
62
|
+
- 'lib/prosereflect/parser.rb'
|
|
63
|
+
- 'lib/prosereflect/schema/fragment.rb'
|
|
64
|
+
- 'lib/prosereflect/schema/mark_type.rb'
|
|
65
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
66
|
+
- 'lib/prosereflect/schema/node_type.rb'
|
|
67
|
+
- 'lib/prosereflect/schema/schema_class.rb'
|
|
68
|
+
- 'spec/support/matchers.rb'
|
|
89
69
|
|
|
90
|
-
# Offense count:
|
|
91
|
-
# Configuration parameters:
|
|
92
|
-
Metrics/
|
|
93
|
-
Max:
|
|
70
|
+
# Offense count: 1
|
|
71
|
+
# Configuration parameters: CountBlocks, CountModifierForms.
|
|
72
|
+
Metrics/BlockNesting:
|
|
73
|
+
Max: 4
|
|
94
74
|
|
|
95
|
-
# Offense count:
|
|
75
|
+
# Offense count: 30
|
|
76
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
77
|
+
Metrics/CyclomaticComplexity:
|
|
78
|
+
Exclude:
|
|
79
|
+
- 'lib/prosereflect/code_block.rb'
|
|
80
|
+
- 'lib/prosereflect/input/html.rb'
|
|
81
|
+
- 'lib/prosereflect/node.rb'
|
|
82
|
+
- 'lib/prosereflect/output/html.rb'
|
|
83
|
+
- 'lib/prosereflect/parser.rb'
|
|
84
|
+
- 'lib/prosereflect/schema/attribute.rb'
|
|
85
|
+
- 'lib/prosereflect/schema/fragment.rb'
|
|
86
|
+
- 'lib/prosereflect/schema/mark_type.rb'
|
|
87
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
88
|
+
- 'lib/prosereflect/schema/node_type.rb'
|
|
89
|
+
- 'lib/prosereflect/schema/schema_class.rb'
|
|
90
|
+
- 'spec/support/matchers.rb'
|
|
91
|
+
|
|
92
|
+
# Offense count: 45
|
|
96
93
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
97
94
|
Metrics/MethodLength:
|
|
98
|
-
Max:
|
|
95
|
+
Max: 84
|
|
99
96
|
|
|
100
|
-
# Offense count:
|
|
101
|
-
# Configuration parameters:
|
|
102
|
-
Metrics/
|
|
103
|
-
Max:
|
|
97
|
+
# Offense count: 2
|
|
98
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
99
|
+
Metrics/ParameterLists:
|
|
100
|
+
Max: 8
|
|
104
101
|
|
|
105
|
-
# Offense count:
|
|
106
|
-
# Configuration parameters:
|
|
107
|
-
|
|
108
|
-
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
|
109
|
-
Naming/VariableNumber:
|
|
102
|
+
# Offense count: 30
|
|
103
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
104
|
+
Metrics/PerceivedComplexity:
|
|
110
105
|
Exclude:
|
|
111
|
-
- '
|
|
112
|
-
|
|
113
|
-
# Offense count: 2
|
|
114
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
115
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
116
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
117
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
118
|
-
# FunctionalMethods: let, let!, subject, watch
|
|
119
|
-
# AllowedMethods: lambda, proc, it
|
|
120
|
-
Style/BlockDelimiters:
|
|
121
|
-
Exclude:
|
|
122
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
123
|
-
|
|
124
|
-
# Offense count: 11
|
|
125
|
-
# Configuration parameters: AllowedConstants.
|
|
126
|
-
Style/Documentation:
|
|
127
|
-
Exclude:
|
|
128
|
-
- 'spec/**/*'
|
|
129
|
-
- 'test/**/*'
|
|
130
|
-
- 'e118_amendment.rb'
|
|
131
|
-
- 'e118_entry.rb'
|
|
132
|
-
- 'lib/prosereflect/document.rb'
|
|
133
|
-
- 'lib/prosereflect/hard_break.rb'
|
|
134
|
-
- 'lib/prosereflect/node.rb'
|
|
135
|
-
- 'lib/prosereflect/paragraph.rb'
|
|
136
|
-
- 'lib/prosereflect/parser.rb'
|
|
137
|
-
- 'lib/prosereflect/table.rb'
|
|
138
|
-
- 'lib/prosereflect/table_cell.rb'
|
|
139
|
-
- 'lib/prosereflect/table_row.rb'
|
|
140
|
-
- 'lib/prosereflect/text.rb'
|
|
141
|
-
- 'lib/prosereflect/heading.rb'
|
|
142
|
-
- 'lib/prosereflect/attribute.rb'
|
|
143
|
-
- 'lib/prosereflect/attribute/base.rb'
|
|
144
|
-
- 'lib/prosereflect/attribute/bold.rb'
|
|
145
|
-
- 'lib/prosereflect/attribute/href.rb'
|
|
146
|
-
- 'lib/prosereflect/attribute/id.rb'
|
|
106
|
+
- 'lib/prosereflect/code_block.rb'
|
|
147
107
|
- 'lib/prosereflect/input/html.rb'
|
|
108
|
+
- 'lib/prosereflect/node.rb'
|
|
148
109
|
- 'lib/prosereflect/output/html.rb'
|
|
149
|
-
- 'lib/prosereflect/
|
|
150
|
-
- 'lib/prosereflect/
|
|
110
|
+
- 'lib/prosereflect/parser.rb'
|
|
111
|
+
- 'lib/prosereflect/schema/fragment.rb'
|
|
112
|
+
- 'lib/prosereflect/schema/mark_type.rb'
|
|
113
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
114
|
+
- 'lib/prosereflect/schema/node_type.rb'
|
|
115
|
+
- 'lib/prosereflect/schema/schema_class.rb'
|
|
116
|
+
- 'spec/support/matchers.rb'
|
|
151
117
|
|
|
152
|
-
# Offense count:
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
|
|
156
|
-
Style/FrozenStringLiteralComment:
|
|
118
|
+
# Offense count: 4
|
|
119
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
120
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
|
121
|
+
Naming/MethodParameterName:
|
|
157
122
|
Exclude:
|
|
158
|
-
- '
|
|
159
|
-
- '
|
|
123
|
+
- 'lib/prosereflect/schema/fragment.rb'
|
|
124
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
160
125
|
|
|
161
|
-
# Offense count:
|
|
162
|
-
#
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
126
|
+
# Offense count: 6
|
|
127
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
128
|
+
# AllowedMethods: call
|
|
129
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
130
|
+
Naming/PredicateMethod:
|
|
131
|
+
Exclude:
|
|
132
|
+
- 'lib/prosereflect/schema/attribute.rb'
|
|
133
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
134
|
+
|
|
135
|
+
# Offense count: 12
|
|
136
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
137
|
+
# NamePrefix: is_, has_, have_, does_
|
|
138
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
139
|
+
# AllowedMethods: is_a?
|
|
140
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
141
|
+
Naming/PredicatePrefix:
|
|
142
|
+
Exclude:
|
|
143
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
144
|
+
- 'lib/prosereflect/schema/mark_type.rb'
|
|
145
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
146
|
+
- 'lib/prosereflect/schema/node_type.rb'
|
|
167
147
|
|
|
168
148
|
# Offense count: 1
|
|
169
|
-
#
|
|
170
|
-
|
|
171
|
-
# SupportedStyles: skip_modifier_ifs, always
|
|
172
|
-
Style/Next:
|
|
149
|
+
# Configuration parameters: MinSize.
|
|
150
|
+
Performance/CollectionLiteralInLoop:
|
|
173
151
|
Exclude:
|
|
174
|
-
- '
|
|
152
|
+
- 'lib/prosereflect/input/html.rb'
|
|
175
153
|
|
|
176
|
-
# Offense count:
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
|
|
180
|
-
Style/NumericPredicate:
|
|
154
|
+
# Offense count: 7
|
|
155
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
156
|
+
# Prefixes: when, with, without
|
|
157
|
+
RSpec/ContextWording:
|
|
181
158
|
Exclude:
|
|
182
|
-
- 'spec
|
|
183
|
-
- '
|
|
184
|
-
- '
|
|
185
|
-
- 'lib/prosereflect/table.rb'
|
|
159
|
+
- 'spec/prosereflect/parser_spec.rb'
|
|
160
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
|
161
|
+
- 'spec/support/shared_examples.rb'
|
|
186
162
|
|
|
187
|
-
# Offense count:
|
|
188
|
-
#
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
- 'e118_amendment.rb'
|
|
163
|
+
# Offense count: 142
|
|
164
|
+
# Configuration parameters: CountAsOne.
|
|
165
|
+
RSpec/ExampleLength:
|
|
166
|
+
Max: 134
|
|
192
167
|
|
|
193
|
-
# Offense count:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Exclude:
|
|
197
|
-
- 'e118_amendment.rb'
|
|
198
|
-
|
|
199
|
-
# Offense count: 1
|
|
200
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
201
|
-
# Configuration parameters: EnforcedStyle.
|
|
202
|
-
# SupportedStyles: implicit, explicit
|
|
203
|
-
Style/RescueStandardError:
|
|
204
|
-
Exclude:
|
|
205
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
168
|
+
# Offense count: 73
|
|
169
|
+
RSpec/MultipleExpectations:
|
|
170
|
+
Max: 8
|
|
206
171
|
|
|
207
|
-
# Offense count:
|
|
208
|
-
#
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Style/SafeNavigation:
|
|
212
|
-
Exclude:
|
|
213
|
-
- 'e118_amendment.rb'
|
|
172
|
+
# Offense count: 7
|
|
173
|
+
# Configuration parameters: AllowedGroups.
|
|
174
|
+
RSpec/NestedGroups:
|
|
175
|
+
Max: 4
|
|
214
176
|
|
|
215
|
-
# Offense count:
|
|
177
|
+
# Offense count: 2
|
|
216
178
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
217
|
-
Style/
|
|
179
|
+
Style/IdenticalConditionalBranches:
|
|
218
180
|
Exclude:
|
|
219
|
-
- 'lib/prosereflect/
|
|
181
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
220
182
|
|
|
221
|
-
# Offense count:
|
|
183
|
+
# Offense count: 2
|
|
222
184
|
# This cop supports safe autocorrection (--autocorrect).
|
|
223
|
-
# Configuration parameters:
|
|
224
|
-
#
|
|
225
|
-
Style/
|
|
226
|
-
Exclude:
|
|
227
|
-
- 'Gemfile'
|
|
228
|
-
- 'Rakefile'
|
|
229
|
-
- 'bin/console'
|
|
230
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
231
|
-
- 'lib/prosereflect.rb'
|
|
232
|
-
- 'lib/prosereflect/version.rb'
|
|
233
|
-
- 'prosereflect.gemspec'
|
|
234
|
-
|
|
235
|
-
# Offense count: 7
|
|
236
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
237
|
-
Style/ZeroLengthPredicate:
|
|
185
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
186
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
187
|
+
Style/TrailingCommaInArguments:
|
|
238
188
|
Exclude:
|
|
239
|
-
- '
|
|
240
|
-
- 'e118_entry.rb'
|
|
189
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
|
241
190
|
|
|
242
|
-
# Offense count:
|
|
191
|
+
# Offense count: 4
|
|
243
192
|
# This cop supports safe autocorrection (--autocorrect).
|
|
244
|
-
# Configuration parameters:
|
|
245
|
-
#
|
|
246
|
-
|
|
247
|
-
|
|
193
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
194
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
195
|
+
Style/TrailingCommaInHashLiteral:
|
|
196
|
+
Exclude:
|
|
197
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`prosereflect` is a Ruby gem for parsing, manipulating, and traversing ProseMirror rich text editor document trees. It provides a Ruby object model over ProseMirror's JSON/YAML format with HTML import/export capabilities.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install dependencies
|
|
13
|
+
bundle install
|
|
14
|
+
|
|
15
|
+
# Run tests and linting
|
|
16
|
+
rake
|
|
17
|
+
|
|
18
|
+
# Run tests only
|
|
19
|
+
rake spec
|
|
20
|
+
|
|
21
|
+
# Run a specific spec file
|
|
22
|
+
rspec spec/prosereflect/parser_spec.rb
|
|
23
|
+
|
|
24
|
+
# Run a specific test
|
|
25
|
+
rspec spec/prosereflect/parser_spec.rb:42
|
|
26
|
+
|
|
27
|
+
# Run linting only
|
|
28
|
+
rake rubocop
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Architecture
|
|
32
|
+
|
|
33
|
+
### Core Classes
|
|
34
|
+
|
|
35
|
+
- **Node** (`lib/prosereflect/node.rb`) - Base class for all document elements, extends `Lutaml::Model::Serializable`. All node types inherit `type`, `attrs`, `marks`, and `content` attributes.
|
|
36
|
+
- **Document** (`lib/prosereflect/document.rb`) - Top-level container, extends Node. Provides convenience methods like `tables`, `paragraphs`, `find_first`, `find_all`, `find_children`.
|
|
37
|
+
- **Parser** (`lib/prosereflect/parser.rb`) - Converts ProseMirror JSON/YAML hash structure into Node objects via `parse_document`.
|
|
38
|
+
|
|
39
|
+
### Node Hierarchy
|
|
40
|
+
|
|
41
|
+
All node types inherit from Node and define a `PM_TYPE` constant matching ProseMirror's type strings:
|
|
42
|
+
- Block nodes: `Document`, `Paragraph`, `Heading`, `Table`, `TableRow`, `TableCell`, `TableHeader`, `BulletList`, `OrderedList`, `ListItem`, `Blockquote`, `CodeBlockWrapper`, `CodeBlock`, `HorizontalRule`, `Image`, `HardBreak`
|
|
43
|
+
- Text nodes: `Text` with `Mark` collections (Bold, Italic, Code, Link, Strike, Subscript, Superscript, Underline)
|
|
44
|
+
- Special: `User` for @mentions
|
|
45
|
+
|
|
46
|
+
### HTML Conversion
|
|
47
|
+
|
|
48
|
+
- **Input::Html** (`lib/prosereflect/input/html.rb`) - Parses HTML strings into Document using Nokogiri
|
|
49
|
+
- **Output::Html** (`lib/prosereflect/output/html.rb`) - Converts Document back to HTML using Nokogiri::HTML::Builder
|
|
50
|
+
|
|
51
|
+
### Serialization
|
|
52
|
+
|
|
53
|
+
Uses `lutaml-model` for attribute serialization. The `key_value` block defines how Ruby attributes map to ProseMirror JSON keys. Override `to_h` methods handle special cases for attrs/marks serialization.
|
|
54
|
+
|
|
55
|
+
### Key Dependencies
|
|
56
|
+
|
|
57
|
+
- `lutaml-model` (~> 0.8) - Serialization framework
|
|
58
|
+
- `nokogiri` (~> 1.18) - HTML parsing/generation
|
|
59
|
+
|
|
60
|
+
## Superseding prosemirror-py
|
|
61
|
+
|
|
62
|
+
This library aims to be a full superset of the Python [prosemirror-py](https://github.com/metanorma/prosemirror-py). See `TODO.py-audit/` for detailed feature gap analysis and implementation plans to achieve complete compliance and schema validation parity.
|
|
63
|
+
|
|
64
|
+
## Data Model Pattern
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
class SomeNode < Node
|
|
68
|
+
PM_TYPE = 'some_node'
|
|
69
|
+
|
|
70
|
+
attribute :custom_attr, :string
|
|
71
|
+
|
|
72
|
+
key_value do
|
|
73
|
+
map 'type', to: :type, render_default: true
|
|
74
|
+
map 'attrs', to: :attrs
|
|
75
|
+
map 'content', to: :content
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
```
|
data/Gemfile
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
source
|
|
3
|
+
source "https://rubygems.org"
|
|
4
4
|
|
|
5
5
|
# Specify your gem's dependencies in prosereflect.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem
|
|
9
|
-
gem
|
|
10
|
-
gem
|
|
8
|
+
gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
|
|
9
|
+
gem "rake"
|
|
10
|
+
gem "rspec"
|
|
11
|
+
gem "rubocop"
|
|
12
|
+
gem "rubocop-performance"
|
|
13
|
+
gem "rubocop-rake"
|
|
14
|
+
gem "rubocop-rspec"
|
data/Rakefile
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
5
|
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
|
7
7
|
|
|
8
|
-
require
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
9
|
|
|
10
10
|
RuboCop::RakeTask.new
|
|
11
11
|
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '../attribute'
|
|
4
|
-
|
|
5
3
|
module Prosereflect
|
|
6
4
|
module Attribute
|
|
7
5
|
class Base < Lutaml::Model::Serializable
|
|
8
|
-
PM_TYPE =
|
|
6
|
+
PM_TYPE = "attribute"
|
|
9
7
|
|
|
10
8
|
attribute :type, :string, default: lambda {
|
|
11
9
|
begin
|
|
12
10
|
self.class.const_get(:PM_TYPE)
|
|
13
11
|
rescue StandardError
|
|
14
|
-
|
|
12
|
+
"attribute"
|
|
15
13
|
end
|
|
16
14
|
}
|
|
17
15
|
attribute :value, :string
|
|
18
16
|
|
|
19
17
|
key_value do
|
|
20
|
-
map
|
|
21
|
-
map
|
|
18
|
+
map "type", to: :type, render_default: true
|
|
19
|
+
map "value", to: :value
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
def self.create(type, value)
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Prosereflect
|
|
6
4
|
module Attribute
|
|
7
5
|
class Bold < Base
|
|
8
|
-
PM_TYPE =
|
|
6
|
+
PM_TYPE = "bold"
|
|
9
7
|
|
|
10
8
|
def initialize(options = {})
|
|
11
9
|
super
|
|
12
|
-
self.type =
|
|
10
|
+
self.type = "bold"
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def attrs
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Prosereflect
|
|
6
4
|
module Attribute
|
|
7
5
|
class Id < Base
|
|
8
|
-
PM_TYPE =
|
|
6
|
+
PM_TYPE = "id"
|
|
9
7
|
|
|
10
|
-
attribute :type, :string, default: -> {
|
|
8
|
+
attribute :type, :string, default: -> {
|
|
9
|
+
self.class.send(:const_get, "PM_TYPE")
|
|
10
|
+
}
|
|
11
11
|
attribute :id, :string
|
|
12
12
|
|
|
13
13
|
key_value do
|
|
14
|
-
map
|
|
15
|
-
map
|
|
14
|
+
map "type", to: :type, render_default: true
|
|
15
|
+
map "id", to: :id
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Convert to hash for serialization
|
|
19
19
|
def to_h
|
|
20
|
-
{
|
|
20
|
+
{ "id" => id }
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|