prosereflect 0.1.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 +7 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +25 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +228 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +10 -0
- data/README.adoc +268 -0
- data/Rakefile +12 -0
- data/debug_loading.rb +34 -0
- data/lib/prosereflect/document.rb +63 -0
- data/lib/prosereflect/hard_break.rb +22 -0
- data/lib/prosereflect/node.rb +77 -0
- data/lib/prosereflect/paragraph.rb +50 -0
- data/lib/prosereflect/parser.rb +56 -0
- data/lib/prosereflect/table.rb +64 -0
- data/lib/prosereflect/table_cell.rb +37 -0
- data/lib/prosereflect/table_row.rb +32 -0
- data/lib/prosereflect/text.rb +37 -0
- data/lib/prosereflect/version.rb +5 -0
- data/lib/prosereflect.rb +17 -0
- data/prosereflect.gemspec +33 -0
- data/sig/prosemirror.rbs +4 -0
- data/spec/fixtures/ituob-1000/ituob-1000-DP.json +366 -0
- data/spec/fixtures/ituob-1000/ituob-1000-DP.yaml +182 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E118_IIN.json +381 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E118_IIN.yaml +182 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E164_ACN.json +203 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E164_ACN.yaml +98 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E212_MNC.json +202 -0
- data/spec/fixtures/ituob-1000/ituob-1000-E212_MNC.yaml +101 -0
- data/spec/fixtures/ituob-1000/ituob-1000-F32_TDI.json +6948 -0
- data/spec/fixtures/ituob-1000/ituob-1000-F32_TDI.yaml +3519 -0
- data/spec/fixtures/ituob-1000/ituob-1000-M1400_ICC.json +529 -0
- data/spec/fixtures/ituob-1000/ituob-1000-M1400_ICC.yaml +263 -0
- data/spec/fixtures/ituob-1000/ituob-1000-NNP.json +288 -0
- data/spec/fixtures/ituob-1000/ituob-1000-NNP.yaml +152 -0
- data/spec/fixtures/ituob-1000/ituob-1000-Q708_ISPC.json +1534 -0
- data/spec/fixtures/ituob-1000/ituob-1000-Q708_ISPC.yaml +789 -0
- data/spec/fixtures/ituob-1000/ituob-1000-Q708_SANC.json +252 -0
- data/spec/fixtures/ituob-1000/ituob-1000-Q708_SANC.yaml +123 -0
- data/spec/fixtures/ituob-1000/ituob-1000-R_SP_LM.V.json +428 -0
- data/spec/fixtures/ituob-1000/ituob-1000-R_SP_LM.V.yaml +208 -0
- data/spec/fixtures/ituob-1000/ituob-1000-T35_NA.json +621 -0
- data/spec/fixtures/ituob-1000/ituob-1000-T35_NA.yaml +317 -0
- data/spec/fixtures/ituob-1001/ituob-1001-DP.json +532 -0
- data/spec/fixtures/ituob-1001/ituob-1001-DP.yaml +266 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E118_IIN.json +1093 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E118_IIN.yaml +519 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E164_ACN.json +449 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E164_ACN.yaml +214 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E164_CC.json +271 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E164_CC.yaml +136 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E212_MNC.json +199 -0
- data/spec/fixtures/ituob-1001/ituob-1001-E212_MNC.yaml +99 -0
- data/spec/fixtures/ituob-1001/ituob-1001-NNP.json +288 -0
- data/spec/fixtures/ituob-1001/ituob-1001-NNP.yaml +152 -0
- data/spec/fixtures/ituob-1001/ituob-1001-Q708_ISPC.json +960 -0
- data/spec/fixtures/ituob-1001/ituob-1001-Q708_ISPC.yaml +487 -0
- data/spec/prosereflect/document_spec.rb +149 -0
- data/spec/prosereflect/hard_break_spec.rb +51 -0
- data/spec/prosereflect/node_spec.rb +256 -0
- data/spec/prosereflect/paragraph_spec.rb +152 -0
- data/spec/prosereflect/parser_spec.rb +129 -0
- data/spec/prosereflect/table_cell_spec.rb +114 -0
- data/spec/prosereflect/table_row_spec.rb +77 -0
- data/spec/prosereflect/table_spec.rb +144 -0
- data/spec/prosereflect/text_spec.rb +116 -0
- data/spec/prosereflect/version_spec.rb +11 -0
- data/spec/prosereflect_spec.rb +57 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/matchers.rb +131 -0
- data/spec/support/shared_examples.rb +220 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4932ddc045360d00a528353acb8c741642588d3c0d180e62752d4090f47d28d
|
4
|
+
data.tar.gz: 646f972a327d8a8a735904bc31f64f2778232e077e6b1fcf6e888b1d6452ac25
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fd539de5ef42d23b9d1cb4ab07a6dc2f6ea0466e02230016b09ce6f6c90dc6ab947ceaa82ee5f0058030cb0fee82484d6a676ad5841b8d6207d45dec717f785a
|
7
|
+
data.tar.gz: 38e6f185405e0dd9fdd56aa9821253442f545aac7944c54e909a6e5c5ee430c7d610caac53d4d32e4de1fd5ebb7b125822e1465ce3d01e8aa745621efaae603e
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
12
|
+
required: true
|
13
|
+
default: 'skip'
|
14
|
+
repository_dispatch:
|
15
|
+
types: [ do-release ]
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
release:
|
19
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
20
|
+
with:
|
21
|
+
next_version: ${{ github.event.inputs.next_version }}
|
22
|
+
secrets:
|
23
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
24
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
25
|
+
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-05-12 01:22:35 UTC using RuboCop version 1.75.5.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
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:
|
25
|
+
Exclude:
|
26
|
+
- 'e118_amendment.rb'
|
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'
|
34
|
+
|
35
|
+
# Offense count: 2
|
36
|
+
# This cop supports safe autocorrection (--autocorrect).
|
37
|
+
Layout/EmptyLines:
|
38
|
+
Exclude:
|
39
|
+
- 'e118_amendment.rb'
|
40
|
+
|
41
|
+
# Offense count: 2
|
42
|
+
# This cop supports safe autocorrection (--autocorrect).
|
43
|
+
# Configuration parameters: EnforcedStyle.
|
44
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
45
|
+
Layout/EmptyLinesAroundClassBody:
|
46
|
+
Exclude:
|
47
|
+
- 'e118_amendment.rb'
|
48
|
+
|
49
|
+
# Offense count: 2
|
50
|
+
# This cop supports safe autocorrection (--autocorrect).
|
51
|
+
# Configuration parameters: Width, AllowedPatterns.
|
52
|
+
Layout/IndentationWidth:
|
53
|
+
Exclude:
|
54
|
+
- 'bin/extract-ituob-amendments.rb'
|
55
|
+
- 'e118_amendment.rb'
|
56
|
+
|
57
|
+
# Offense count: 1
|
58
|
+
# This cop supports safe autocorrection (--autocorrect).
|
59
|
+
Lint/ScriptPermission:
|
60
|
+
Exclude:
|
61
|
+
- 'debug_loading.rb'
|
62
|
+
|
63
|
+
# Offense count: 1
|
64
|
+
# This cop supports safe autocorrection (--autocorrect).
|
65
|
+
# Configuration parameters: AutoCorrect, ContextCreatingMethods, MethodCreatingMethods.
|
66
|
+
Lint/UselessAccessModifier:
|
67
|
+
Exclude:
|
68
|
+
- 'e118_amendment.rb'
|
69
|
+
|
70
|
+
# Offense count: 5
|
71
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
72
|
+
Metrics/AbcSize:
|
73
|
+
Max: 98
|
74
|
+
|
75
|
+
# Offense count: 23
|
76
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
77
|
+
# AllowedMethods: refine
|
78
|
+
Metrics/BlockLength:
|
79
|
+
Max: 201
|
80
|
+
|
81
|
+
# Offense count: 4
|
82
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
83
|
+
Metrics/CyclomaticComplexity:
|
84
|
+
Max: 30
|
85
|
+
|
86
|
+
# Offense count: 6
|
87
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
88
|
+
Metrics/MethodLength:
|
89
|
+
Max: 47
|
90
|
+
|
91
|
+
# Offense count: 3
|
92
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
93
|
+
Metrics/PerceivedComplexity:
|
94
|
+
Max: 32
|
95
|
+
|
96
|
+
# Offense count: 9
|
97
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
98
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
99
|
+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
100
|
+
Naming/VariableNumber:
|
101
|
+
Exclude:
|
102
|
+
- 'e118_entry.rb'
|
103
|
+
|
104
|
+
# Offense count: 2
|
105
|
+
# This cop supports safe autocorrection (--autocorrect).
|
106
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
107
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
108
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
109
|
+
# FunctionalMethods: let, let!, subject, watch
|
110
|
+
# AllowedMethods: lambda, proc, it
|
111
|
+
Style/BlockDelimiters:
|
112
|
+
Exclude:
|
113
|
+
- 'bin/extract-ituob-amendments.rb'
|
114
|
+
|
115
|
+
# Offense count: 11
|
116
|
+
# Configuration parameters: AllowedConstants.
|
117
|
+
Style/Documentation:
|
118
|
+
Exclude:
|
119
|
+
- 'spec/**/*'
|
120
|
+
- 'test/**/*'
|
121
|
+
- 'e118_amendment.rb'
|
122
|
+
- 'e118_entry.rb'
|
123
|
+
- 'lib/prosereflect/document.rb'
|
124
|
+
- 'lib/prosereflect/hard_break.rb'
|
125
|
+
- 'lib/prosereflect/node.rb'
|
126
|
+
- 'lib/prosereflect/paragraph.rb'
|
127
|
+
- 'lib/prosereflect/parser.rb'
|
128
|
+
- 'lib/prosereflect/table.rb'
|
129
|
+
- 'lib/prosereflect/table_cell.rb'
|
130
|
+
- 'lib/prosereflect/table_row.rb'
|
131
|
+
- 'lib/prosereflect/text.rb'
|
132
|
+
|
133
|
+
# Offense count: 1
|
134
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
135
|
+
# Configuration parameters: EnforcedStyle.
|
136
|
+
# SupportedStyles: always, always_true, never
|
137
|
+
Style/FrozenStringLiteralComment:
|
138
|
+
Exclude:
|
139
|
+
- '**/*.arb'
|
140
|
+
- 'bin/extract-ituob-amendments.rb'
|
141
|
+
|
142
|
+
# Offense count: 7
|
143
|
+
# This cop supports safe autocorrection (--autocorrect).
|
144
|
+
Style/IfUnlessModifier:
|
145
|
+
Exclude:
|
146
|
+
- 'e118_amendment.rb'
|
147
|
+
- 'e118_entry.rb'
|
148
|
+
|
149
|
+
# Offense count: 1
|
150
|
+
# This cop supports safe autocorrection (--autocorrect).
|
151
|
+
# Configuration parameters: EnforcedStyle, MinBodyLength, AllowConsecutiveConditionals.
|
152
|
+
# SupportedStyles: skip_modifier_ifs, always
|
153
|
+
Style/Next:
|
154
|
+
Exclude:
|
155
|
+
- 'e118_amendment.rb'
|
156
|
+
|
157
|
+
# Offense count: 9
|
158
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
159
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
160
|
+
# SupportedStyles: predicate, comparison
|
161
|
+
Style/NumericPredicate:
|
162
|
+
Exclude:
|
163
|
+
- 'spec/**/*'
|
164
|
+
- 'e118_amendment.rb'
|
165
|
+
- 'e118_entry.rb'
|
166
|
+
- 'lib/prosereflect/table.rb'
|
167
|
+
|
168
|
+
# Offense count: 1
|
169
|
+
# This cop supports safe autocorrection (--autocorrect).
|
170
|
+
Style/ParallelAssignment:
|
171
|
+
Exclude:
|
172
|
+
- 'e118_amendment.rb'
|
173
|
+
|
174
|
+
# Offense count: 1
|
175
|
+
# This cop supports safe autocorrection (--autocorrect).
|
176
|
+
Style/RedundantSelf:
|
177
|
+
Exclude:
|
178
|
+
- 'e118_amendment.rb'
|
179
|
+
|
180
|
+
# Offense count: 1
|
181
|
+
# This cop supports safe autocorrection (--autocorrect).
|
182
|
+
# Configuration parameters: EnforcedStyle.
|
183
|
+
# SupportedStyles: implicit, explicit
|
184
|
+
Style/RescueStandardError:
|
185
|
+
Exclude:
|
186
|
+
- 'bin/extract-ituob-amendments.rb'
|
187
|
+
|
188
|
+
# Offense count: 4
|
189
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
190
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
191
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
192
|
+
Style/SafeNavigation:
|
193
|
+
Exclude:
|
194
|
+
- 'e118_amendment.rb'
|
195
|
+
|
196
|
+
# Offense count: 1
|
197
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
198
|
+
Style/SlicingWithRange:
|
199
|
+
Exclude:
|
200
|
+
- 'lib/prosereflect/table.rb'
|
201
|
+
|
202
|
+
# Offense count: 38
|
203
|
+
# This cop supports safe autocorrection (--autocorrect).
|
204
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
205
|
+
# SupportedStyles: single_quotes, double_quotes
|
206
|
+
Style/StringLiterals:
|
207
|
+
Exclude:
|
208
|
+
- 'Gemfile'
|
209
|
+
- 'Rakefile'
|
210
|
+
- 'bin/console'
|
211
|
+
- 'bin/extract-ituob-amendments.rb'
|
212
|
+
- 'lib/prosereflect.rb'
|
213
|
+
- 'lib/prosereflect/version.rb'
|
214
|
+
- 'prosereflect.gemspec'
|
215
|
+
|
216
|
+
# Offense count: 7
|
217
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
218
|
+
Style/ZeroLengthPredicate:
|
219
|
+
Exclude:
|
220
|
+
- 'e118_amendment.rb'
|
221
|
+
- 'e118_entry.rb'
|
222
|
+
|
223
|
+
# Offense count: 6
|
224
|
+
# This cop supports safe autocorrection (--autocorrect).
|
225
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
226
|
+
# URISchemes: http, https
|
227
|
+
Layout/LineLength:
|
228
|
+
Max: 153
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/Gemfile
ADDED
data/README.adoc
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
= prosereflect gem: Library for ProseMirror documents
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/prosereflect.svg["Gem Version", link="https://rubygems.org/gems/prosereflect"]
|
4
|
+
image:https://github.com/metanorma/prosereflect/actions/workflows/rake.yml/badge.svg["Build Status", link="https://github.com/metanorma/prosereflect/actions/workflows/rake.yml"]
|
5
|
+
image:https://img.shields.io/github/issues-pr-raw/metanorma/prosereflect.svg["Pull Requests", link="https://github.com/metanorma/prosereflect/pulls"]
|
6
|
+
image:https://img.shields.io/github/commits-since/metanorma/prosereflect/latest.svg["Commits since latest",link="https://github.com/metanorma/prosereflect/releases"]
|
7
|
+
|
8
|
+
== Purpose
|
9
|
+
|
10
|
+
`prosereflect` is a Ruby gem for working with the document structure used by the https://prosemirror.net/[ProseMirror rich text editor].
|
11
|
+
|
12
|
+
It provides a set of models and utilities for parsing, manipulating, and
|
13
|
+
accessing the hierarchical document tree structure represented in ProseMirror's
|
14
|
+
JSON/YAML format. This allows for convenient traversal and extraction of content
|
15
|
+
from rich text documents.
|
16
|
+
|
17
|
+
|
18
|
+
== Installation
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
[source,ruby]
|
23
|
+
----
|
24
|
+
gem 'prosereflect'
|
25
|
+
----
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
[source,shell]
|
30
|
+
----
|
31
|
+
$ bundle install
|
32
|
+
----
|
33
|
+
|
34
|
+
Or install it yourself as:
|
35
|
+
|
36
|
+
[source,shell]
|
37
|
+
----
|
38
|
+
$ gem install prosereflect
|
39
|
+
----
|
40
|
+
|
41
|
+
== Usage
|
42
|
+
|
43
|
+
=== Parsing ProseMirror documents
|
44
|
+
|
45
|
+
==== From YAML
|
46
|
+
|
47
|
+
[source,ruby]
|
48
|
+
----
|
49
|
+
require 'prosereflect'
|
50
|
+
|
51
|
+
# Parse from YAML string or file
|
52
|
+
yaml_content = File.read('document.yaml')
|
53
|
+
document = Prosereflect::Parser.parse_document(yaml_content)
|
54
|
+
|
55
|
+
# Access the document structure
|
56
|
+
document.content.each do |node|
|
57
|
+
# Work with nodes
|
58
|
+
end
|
59
|
+
----
|
60
|
+
|
61
|
+
==== From JSON
|
62
|
+
|
63
|
+
[source,ruby]
|
64
|
+
----
|
65
|
+
require 'prosereflect'
|
66
|
+
|
67
|
+
# Parse from JSON string or file
|
68
|
+
json_content = File.read('document.json')
|
69
|
+
document = Prosereflect::Parser.parse_document(json_content)
|
70
|
+
----
|
71
|
+
|
72
|
+
=== Navigating the document
|
73
|
+
|
74
|
+
[source,ruby]
|
75
|
+
----
|
76
|
+
# Get all tables in the document
|
77
|
+
tables = document.tables
|
78
|
+
|
79
|
+
# Get all paragraphs
|
80
|
+
paragraphs = document.paragraphs
|
81
|
+
|
82
|
+
# Access the first table
|
83
|
+
first_table = document.first_table
|
84
|
+
|
85
|
+
# Access header row and data rows in a table
|
86
|
+
header = first_table.header_row
|
87
|
+
data_rows = first_table.data_rows
|
88
|
+
|
89
|
+
# Access cells in a table
|
90
|
+
cell = first_table.cell_at(0, 0) # First data row, first column
|
91
|
+
----
|
92
|
+
|
93
|
+
=== Accessing content
|
94
|
+
|
95
|
+
[source,ruby]
|
96
|
+
----
|
97
|
+
# Get text content from a paragraph
|
98
|
+
paragraph = document.paragraphs.first
|
99
|
+
text = paragraph.text_content
|
100
|
+
|
101
|
+
# Get text content from a table cell
|
102
|
+
cell = document.tables.first.cell_at(0, 0)
|
103
|
+
cell_text = cell.text_content
|
104
|
+
|
105
|
+
# Get cell content as separate lines
|
106
|
+
lines = cell.lines
|
107
|
+
----
|
108
|
+
|
109
|
+
=== Finding nodes
|
110
|
+
|
111
|
+
[source,ruby]
|
112
|
+
----
|
113
|
+
# Find the first node of a specific type
|
114
|
+
table = document.find_first('table')
|
115
|
+
paragraph = document.find_first('paragraph')
|
116
|
+
|
117
|
+
# Find all nodes of a specific type
|
118
|
+
tables = document.find_all('table')
|
119
|
+
text_nodes = document.find_all('text')
|
120
|
+
|
121
|
+
# Find child nodes of a specific type
|
122
|
+
table_cells = table.find_children('table_cell')
|
123
|
+
----
|
124
|
+
|
125
|
+
== Data model
|
126
|
+
|
127
|
+
The prosereflect gem represents the document structure as a hierarchy of node
|
128
|
+
objects.
|
129
|
+
|
130
|
+
[source]
|
131
|
+
----
|
132
|
+
+-------------------+
|
133
|
+
| Document |
|
134
|
+
| |
|
135
|
+
| +content |
|
136
|
+
+--------+----------+
|
137
|
+
|
|
138
|
+
| 1..*
|
139
|
+
+--------v----------+
|
140
|
+
| Node |
|
141
|
+
| |
|
142
|
+
| -type |
|
143
|
+
| -attrs |
|
144
|
+
| -marks |
|
145
|
+
| +content |
|
146
|
+
+-------------------+
|
147
|
+
|
|
148
|
+
+----+----+---------------------+
|
149
|
+
| | |
|
150
|
+
+---v---+ +---v----------+ +-------v--------+
|
151
|
+
|Table | | Paragraph | | Text |
|
152
|
+
| | | | | |
|
153
|
+
+---+---+ +--------------+ +----------------+
|
154
|
+
|
|
155
|
+
|
|
156
|
+
+---v-----------+
|
157
|
+
| TableRow |
|
158
|
+
| |
|
159
|
+
+---+-----------+
|
160
|
+
|
|
161
|
+
+---v-----------+
|
162
|
+
| TableCell |
|
163
|
+
| |
|
164
|
+
+---------------+
|
165
|
+
----
|
166
|
+
|
167
|
+
== Classes
|
168
|
+
|
169
|
+
=== Node
|
170
|
+
|
171
|
+
Base class for all node types.
|
172
|
+
|
173
|
+
`type`:: The node type (e.g., "doc", "paragraph", "text", "table")
|
174
|
+
`content`:: A collection of child nodes
|
175
|
+
`attrs`:: Attributes specific to the node type
|
176
|
+
`marks`:: Formatting marks applied to the node
|
177
|
+
|
178
|
+
=== Document
|
179
|
+
|
180
|
+
Top-level container representing a ProseMirror document.
|
181
|
+
|
182
|
+
`content`:: A collection of top-level nodes in the document
|
183
|
+
|
184
|
+
=== Paragraph
|
185
|
+
|
186
|
+
Represents a paragraph of text.
|
187
|
+
|
188
|
+
`text_content`:: Returns the combined text content of all child text nodes
|
189
|
+
|
190
|
+
=== Text
|
191
|
+
|
192
|
+
Represents a text node.
|
193
|
+
|
194
|
+
`text`:: The text content of the node
|
195
|
+
|
196
|
+
=== Table
|
197
|
+
|
198
|
+
Represents a table structure.
|
199
|
+
|
200
|
+
`rows`:: All table rows
|
201
|
+
`header_row`:: The first row (assumed to be the header)
|
202
|
+
`data_rows`:: All rows except the header
|
203
|
+
`cell_at(row_index, col_index)`:: Access a specific cell by position
|
204
|
+
|
205
|
+
=== TableRow
|
206
|
+
|
207
|
+
Represents a row in a table.
|
208
|
+
|
209
|
+
`cells`:: All cells in the row
|
210
|
+
|
211
|
+
=== TableCell
|
212
|
+
|
213
|
+
Represents a cell in a table.
|
214
|
+
|
215
|
+
`paragraphs`:: All paragraphs in the cell
|
216
|
+
`text_content`:: All text content combined
|
217
|
+
`lines`:: Text content split into separate lines
|
218
|
+
|
219
|
+
|
220
|
+
== Development
|
221
|
+
|
222
|
+
=== Adding test fixtures
|
223
|
+
|
224
|
+
The repository includes a utility script `bin/extract-ituob-amendments.rb` to
|
225
|
+
extract ProseMirror content from the ITU Operational Bulletin for test fixtures.
|
226
|
+
|
227
|
+
Syntax:
|
228
|
+
|
229
|
+
[source,shell]
|
230
|
+
----
|
231
|
+
$ bin/extract-ituob-amendments.rb {filename} {issue_number}
|
232
|
+
----
|
233
|
+
|
234
|
+
Where,
|
235
|
+
|
236
|
+
`{filename}`:: The amendments YAML file to extract from. The script expects the
|
237
|
+
`{filename}` file in the format used by the ITU Operational Bulletin data
|
238
|
+
repository: https://github.com/ituob/itu-ob-data/
|
239
|
+
`{issue_number}`:: The issue number to use in the generated file names.
|
240
|
+
|
241
|
+
This command:
|
242
|
+
|
243
|
+
. Extract ProseMirror content from the specified amendments file
|
244
|
+
. Generate both YAML and JSON files in the current directory
|
245
|
+
. Name files according to the pattern `ituob-<issue_number>-<publication>.<format>`
|
246
|
+
|
247
|
+
These generated files can be moved to `spec/fixtures/ituob-<issue_number>/` to use in tests.
|
248
|
+
|
249
|
+
|
250
|
+
[example]
|
251
|
+
====
|
252
|
+
[source,shell]
|
253
|
+
----
|
254
|
+
$ bin/extract-ituob-amendments.rb amendments.yaml 1000
|
255
|
+
----
|
256
|
+
====
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
== Copyright
|
261
|
+
|
262
|
+
This gem is developed, maintained and funded by
|
263
|
+
https://www.ribose.com[Ribose Inc.]
|
264
|
+
|
265
|
+
== License
|
266
|
+
|
267
|
+
The gem is available as open source under the terms of the
|
268
|
+
https://opensource.org/licenses/BSD-2-Clause[2-Clause BSD License].
|