prosereflect 0.1.1 → 0.3.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/docs.yml +63 -0
- data/.github/workflows/links.yml +97 -0
- data/.github/workflows/rake.yml +4 -0
- data/.github/workflows/release.yml +5 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +19 -1
- data/.rubocop_todo.yml +119 -183
- data/CLAUDE.md +78 -0
- data/Gemfile +8 -4
- data/README.adoc +2 -0
- data/Rakefile +3 -3
- data/docs/Gemfile +10 -0
- data/docs/INDEX.adoc +45 -0
- data/docs/_advanced/index.adoc +15 -0
- data/docs/_advanced/schema.adoc +112 -0
- data/docs/_advanced/step-map.adoc +66 -0
- data/docs/_advanced/steps.adoc +88 -0
- data/docs/_advanced/test-builder.adoc +61 -0
- data/docs/_advanced/transform.adoc +92 -0
- data/docs/_config.yml +174 -0
- data/docs/_features/html-input.adoc +69 -0
- data/docs/_features/html-output.adoc +45 -0
- data/docs/_features/index.adoc +15 -0
- data/docs/_features/marks.adoc +86 -0
- data/docs/_features/node-types.adoc +124 -0
- data/docs/_features/user-mentions.adoc +47 -0
- data/docs/_guides/custom-nodes.adoc +107 -0
- data/docs/_guides/index.adoc +13 -0
- data/docs/_guides/round-trip-html.adoc +91 -0
- data/docs/_guides/serialization.adoc +109 -0
- data/docs/_pages/index.adoc +67 -0
- data/docs/_reference/document-api.adoc +49 -0
- data/docs/_reference/index.adoc +14 -0
- data/docs/_reference/node-api.adoc +79 -0
- data/docs/_reference/schema-api.adoc +95 -0
- data/docs/_reference/transform-api.adoc +77 -0
- data/docs/_understanding/document-model.adoc +65 -0
- data/docs/_understanding/fragment.adoc +52 -0
- data/docs/_understanding/index.adoc +14 -0
- data/docs/_understanding/resolved-position.adoc +53 -0
- data/docs/_understanding/slice.adoc +54 -0
- data/docs/lychee.toml +63 -0
- 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 +19 -11
- data/lib/prosereflect/bullet_list.rb +36 -29
- data/lib/prosereflect/code_block.rb +23 -27
- data/lib/prosereflect/code_block_wrapper.rb +12 -13
- data/lib/prosereflect/document.rb +14 -22
- data/lib/prosereflect/fragment.rb +249 -0
- data/lib/prosereflect/hard_break.rb +6 -6
- data/lib/prosereflect/heading.rb +14 -15
- data/lib/prosereflect/horizontal_rule.rb +23 -14
- data/lib/prosereflect/image.rb +32 -23
- data/lib/prosereflect/input/html.rb +179 -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 +171 -33
- data/lib/prosereflect/ordered_list.rb +17 -14
- data/lib/prosereflect/output/html.rb +279 -50
- data/lib/prosereflect/output.rb +7 -0
- data/lib/prosereflect/paragraph.rb +11 -13
- data/lib/prosereflect/parser.rb +56 -66
- data/lib/prosereflect/resolved_pos.rb +256 -0
- data/lib/prosereflect/schema/attribute.rb +57 -0
- data/lib/prosereflect/schema/content_match.rb +656 -0
- data/lib/prosereflect/schema/fragment.rb +166 -0
- data/lib/prosereflect/schema/mark.rb +121 -0
- data/lib/prosereflect/schema/mark_type.rb +130 -0
- data/lib/prosereflect/schema/node.rb +236 -0
- data/lib/prosereflect/schema/node_type.rb +274 -0
- data/lib/prosereflect/schema/schema_main.rb +190 -0
- data/lib/prosereflect/schema/spec.rb +92 -0
- data/lib/prosereflect/schema.rb +39 -0
- 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 +35 -11
- data/lib/prosereflect/transform/attr_step.rb +157 -0
- data/lib/prosereflect/transform/insert_step.rb +115 -0
- data/lib/prosereflect/transform/mapping.rb +82 -0
- data/lib/prosereflect/transform/mark_step.rb +269 -0
- data/lib/prosereflect/transform/replace_around_step.rb +181 -0
- data/lib/prosereflect/transform/replace_step.rb +157 -0
- data/lib/prosereflect/transform/slice.rb +91 -0
- data/lib/prosereflect/transform/step.rb +89 -0
- data/lib/prosereflect/transform/step_map.rb +126 -0
- data/lib/prosereflect/transform/structure.rb +120 -0
- data/lib/prosereflect/transform/transform.rb +341 -0
- data/lib/prosereflect/transform.rb +26 -0
- data/lib/prosereflect/user.rb +15 -15
- data/lib/prosereflect/version.rb +1 -1
- data/lib/prosereflect.rb +30 -17
- data/prosereflect.gemspec +17 -16
- data/spec/fixtures/documents/formatted_text.yaml +14 -0
- data/spec/fixtures/documents/heading_paragraph.yaml +16 -0
- data/spec/fixtures/documents/lists_doc.yaml +32 -0
- data/spec/fixtures/documents/mixed_content.yaml +40 -0
- data/spec/fixtures/documents/nested_doc.yaml +20 -0
- data/spec/fixtures/documents/simple_doc.yaml +6 -0
- data/spec/fixtures/documents/table_doc.yaml +32 -0
- data/spec/fixtures/documents/transform_test.yaml +14 -0
- data/spec/fixtures/schema/custom_schema.rb +37 -0
- data/spec/fixtures/schema/test_schema.rb +46 -0
- data/spec/fixtures/test_builder/helpers.rb +212 -0
- data/spec/prosereflect/document_spec.rb +332 -330
- data/spec/prosereflect/fragment_spec.rb +273 -0
- data/spec/prosereflect/hard_break_spec.rb +125 -125
- data/spec/prosereflect/input/html_spec.rb +718 -522
- data/spec/prosereflect/node_spec.rb +311 -182
- data/spec/prosereflect/output/html_spec.rb +105 -105
- data/spec/prosereflect/output/whitespace_spec.rb +248 -0
- data/spec/prosereflect/paragraph_spec.rb +275 -274
- data/spec/prosereflect/parser/round_trip_spec.rb +472 -0
- data/spec/prosereflect/parser_spec.rb +185 -180
- data/spec/prosereflect/resolved_pos_spec.rb +74 -0
- data/spec/prosereflect/schema/conftest.rb +68 -0
- data/spec/prosereflect/schema/content_match_spec.rb +237 -0
- data/spec/prosereflect/schema/mark_spec.rb +274 -0
- data/spec/prosereflect/schema/mark_type_spec.rb +86 -0
- data/spec/prosereflect/schema/node_type_spec.rb +142 -0
- data/spec/prosereflect/schema/schema_spec.rb +194 -0
- 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/test_builder/marks_spec.rb +127 -0
- data/spec/prosereflect/text_spec.rb +133 -132
- data/spec/prosereflect/transform/equivalence_spec.rb +487 -0
- data/spec/prosereflect/transform/mapping_spec.rb +226 -0
- data/spec/prosereflect/transform/replace_spec.rb +832 -0
- data/spec/prosereflect/transform/replace_step_spec.rb +157 -0
- data/spec/prosereflect/transform/slice_spec.rb +48 -0
- data/spec/prosereflect/transform/step_map_spec.rb +70 -0
- data/spec/prosereflect/transform/step_spec.rb +211 -0
- data/spec/prosereflect/transform/structure_spec.rb +98 -0
- data/spec/prosereflect/transform/transform_spec.rb +238 -0
- data/spec/prosereflect/user_spec.rb +31 -28
- data/spec/prosereflect_spec.rb +28 -26
- data/spec/spec_helper.rb +7 -6
- data/spec/support/matchers.rb +6 -6
- data/spec/support/shared_examples.rb +49 -49
- metadata +96 -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: d9f70970efc856c322c1d356262ae1492856c2432d2ed6343b7f00a4b96a97a9
|
|
4
|
+
data.tar.gz: 4670d12e397d85fa399ea4bd721d0eaa4d35aa24b7425c0bb7e6b61eb057a173
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42bb32f0114a3cb597a65498681177c93345f3ddcff24412a2ba03dd8492b1ec0da306797ada94fac95c984e0f80a63631de555fae2a836b647c8805ab73e0b6
|
|
7
|
+
data.tar.gz: d6b5dcf22e6d6b0c923c5b35a1dbccecea6e7103af0001428ca567ad8f2333d2f63fe7652149f087b2ea0383beff80afc69e02b09f086f93b5fd51ee7be1dca1
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/**'
|
|
8
|
+
pull_request:
|
|
9
|
+
paths:
|
|
10
|
+
- 'docs/**'
|
|
11
|
+
repository_dispatch:
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
pages: write
|
|
17
|
+
id-token: write
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v6
|
|
29
|
+
|
|
30
|
+
- name: Setup Ruby
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
ruby-version: '3.3'
|
|
34
|
+
bundler-cache: true
|
|
35
|
+
cache-version: 0
|
|
36
|
+
working-directory: docs
|
|
37
|
+
|
|
38
|
+
- name: Setup Pages
|
|
39
|
+
id: pages
|
|
40
|
+
uses: actions/configure-pages@v5
|
|
41
|
+
|
|
42
|
+
- name: Build with Jekyll
|
|
43
|
+
run: bundle exec jekyll build --verbose --trace --baseurl "${{ steps.pages.outputs.base_path }}"
|
|
44
|
+
working-directory: docs
|
|
45
|
+
env:
|
|
46
|
+
JEKYLL_ENV: production
|
|
47
|
+
|
|
48
|
+
- name: Upload artifact
|
|
49
|
+
uses: actions/upload-pages-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
path: docs/_site
|
|
52
|
+
|
|
53
|
+
deploy:
|
|
54
|
+
environment:
|
|
55
|
+
name: github-pages
|
|
56
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
57
|
+
if: ${{ github.ref == 'refs/heads/main' }}
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
needs: build
|
|
60
|
+
steps:
|
|
61
|
+
- name: Deploy to GitHub Pages
|
|
62
|
+
id: deployment
|
|
63
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
name: links
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
pull_request:
|
|
10
|
+
paths:
|
|
11
|
+
- 'docs/**'
|
|
12
|
+
|
|
13
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
pull-requests: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
link_checker:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v6
|
|
23
|
+
|
|
24
|
+
- uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: '3.4'
|
|
27
|
+
bundler-cache: true
|
|
28
|
+
working-directory: docs
|
|
29
|
+
|
|
30
|
+
- name: Build site
|
|
31
|
+
env:
|
|
32
|
+
JEKYLL_ENV: production
|
|
33
|
+
run: bundle exec jekyll build --trace
|
|
34
|
+
working-directory: docs
|
|
35
|
+
|
|
36
|
+
- name: Restore lychee cache
|
|
37
|
+
uses: actions/cache@v4
|
|
38
|
+
with:
|
|
39
|
+
path: .lycheecache
|
|
40
|
+
key: cache-lychee-${{ github.sha }}
|
|
41
|
+
restore-keys: cache-lychee-
|
|
42
|
+
|
|
43
|
+
- name: Check if site was built
|
|
44
|
+
run: |
|
|
45
|
+
if [ ! -d "_site" ]; then
|
|
46
|
+
echo "Error: _site directory not created"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
echo "Site built successfully"
|
|
50
|
+
ls -la _site/
|
|
51
|
+
working-directory: docs
|
|
52
|
+
|
|
53
|
+
- name: Link Checker (Built Site)
|
|
54
|
+
uses: lycheeverse/lychee-action@v2
|
|
55
|
+
with:
|
|
56
|
+
args: >-
|
|
57
|
+
--verbose
|
|
58
|
+
--no-progress
|
|
59
|
+
--config lychee.toml
|
|
60
|
+
--root-dir "$(pwd)/_site"
|
|
61
|
+
--scheme https,http
|
|
62
|
+
'_site/**/*.html'
|
|
63
|
+
fail: true
|
|
64
|
+
output: link-check-results.md
|
|
65
|
+
format: markdown
|
|
66
|
+
workingDirectory: docs
|
|
67
|
+
|
|
68
|
+
- name: Upload link check results
|
|
69
|
+
if: always()
|
|
70
|
+
uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: link-check-results
|
|
73
|
+
path: |
|
|
74
|
+
docs/link-check-results.md
|
|
75
|
+
retention-days: 30
|
|
76
|
+
|
|
77
|
+
- name: Comment PR with results
|
|
78
|
+
if: failure() && github.event_name == 'pull_request'
|
|
79
|
+
uses: actions/github-script@v7
|
|
80
|
+
with:
|
|
81
|
+
script: |
|
|
82
|
+
const fs = require('fs');
|
|
83
|
+
let comment = '## Link Check Failed\n\n';
|
|
84
|
+
|
|
85
|
+
if (fs.existsSync('docs/link-check-results.md')) {
|
|
86
|
+
const results = fs.readFileSync('docs/link-check-results.md', 'utf8');
|
|
87
|
+
comment += '### Built Site Results\n\n' + results + '\n\n';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
comment += '\n---\n\n*Please fix the broken links and push a new commit.*';
|
|
91
|
+
|
|
92
|
+
github.rest.issues.createComment({
|
|
93
|
+
issue_number: context.issue.number,
|
|
94
|
+
owner: context.repo.owner,
|
|
95
|
+
repo: context.repo.repo,
|
|
96
|
+
body: comment
|
|
97
|
+
});
|
data/.github/workflows/rake.yml
CHANGED
data/.gitignore
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,183 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-04-14 23:12:52 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:
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
|
12
11
|
Exclude:
|
|
13
|
-
- '
|
|
12
|
+
- 'prosereflect.gemspec'
|
|
14
13
|
|
|
15
14
|
# Offense count: 2
|
|
16
15
|
# This cop supports safe autocorrection (--autocorrect).
|
|
17
|
-
|
|
18
|
-
Layout/CommentIndentation:
|
|
16
|
+
Layout/ElseAlignment:
|
|
19
17
|
Exclude:
|
|
20
|
-
- '
|
|
18
|
+
- 'lib/prosereflect/schema/schema_main.rb'
|
|
21
19
|
|
|
22
20
|
# Offense count: 1
|
|
23
21
|
# This cop supports safe autocorrection (--autocorrect).
|
|
24
|
-
|
|
22
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
23
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
24
|
+
Layout/EndAlignment:
|
|
25
25
|
Exclude:
|
|
26
|
-
- '
|
|
26
|
+
- 'lib/prosereflect/schema/schema_main.rb'
|
|
27
27
|
|
|
28
28
|
# Offense count: 1
|
|
29
29
|
# This cop supports safe autocorrection (--autocorrect).
|
|
30
|
-
# Configuration parameters:
|
|
31
|
-
|
|
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.
|
|
30
|
+
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
31
|
+
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
52
32
|
Layout/IndentationWidth:
|
|
53
33
|
Exclude:
|
|
54
|
-
- '
|
|
55
|
-
- 'e118_amendment.rb'
|
|
34
|
+
- 'lib/prosereflect/schema/schema_main.rb'
|
|
56
35
|
|
|
57
|
-
# Offense count:
|
|
36
|
+
# Offense count: 264
|
|
58
37
|
# This cop supports safe autocorrection (--autocorrect).
|
|
59
|
-
|
|
38
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
39
|
+
# URISchemes: http, https
|
|
40
|
+
Layout/LineLength:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
# Offense count: 5
|
|
44
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
45
|
+
Lint/DuplicateBranch:
|
|
60
46
|
Exclude:
|
|
61
|
-
- '
|
|
47
|
+
- 'lib/prosereflect/input/html.rb'
|
|
48
|
+
- 'lib/prosereflect/schema/attribute.rb'
|
|
49
|
+
- 'lib/prosereflect/schema/content_match.rb'
|
|
50
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
51
|
+
- 'spec/fixtures/test_builder/helpers.rb'
|
|
62
52
|
|
|
63
53
|
# Offense count: 1
|
|
64
54
|
# This cop supports safe autocorrection (--autocorrect).
|
|
65
|
-
# Configuration parameters:
|
|
66
|
-
|
|
55
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
|
|
56
|
+
# NotImplementedExceptions: NotImplementedError
|
|
57
|
+
Lint/UnusedMethodArgument:
|
|
67
58
|
Exclude:
|
|
68
|
-
- '
|
|
59
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
69
60
|
|
|
70
|
-
# Offense count:
|
|
71
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
61
|
+
# Offense count: 57
|
|
62
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
72
63
|
Metrics/AbcSize:
|
|
73
|
-
|
|
64
|
+
Enabled: false
|
|
74
65
|
|
|
75
|
-
# Offense count:
|
|
76
|
-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
66
|
+
# Offense count: 1
|
|
67
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
77
68
|
# AllowedMethods: refine
|
|
78
69
|
Metrics/BlockLength:
|
|
79
|
-
|
|
80
|
-
- 'spec/prosereflect/input/html_spec.rb'
|
|
81
|
-
Max: 500
|
|
70
|
+
Max: 27
|
|
82
71
|
|
|
83
|
-
# Offense count:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- 'lib/prosereflect/output/html.rb'
|
|
88
|
-
- 'lib/prosereflect/node.rb'
|
|
72
|
+
# Offense count: 1
|
|
73
|
+
# Configuration parameters: CountBlocks, CountModifierForms.
|
|
74
|
+
Metrics/BlockNesting:
|
|
75
|
+
Max: 4
|
|
89
76
|
|
|
90
|
-
# Offense count:
|
|
91
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
77
|
+
# Offense count: 57
|
|
78
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
92
79
|
Metrics/CyclomaticComplexity:
|
|
93
|
-
|
|
80
|
+
Enabled: false
|
|
94
81
|
|
|
95
|
-
# Offense count:
|
|
82
|
+
# Offense count: 82
|
|
96
83
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
97
84
|
Metrics/MethodLength:
|
|
98
|
-
Max:
|
|
99
|
-
|
|
100
|
-
# Offense count: 3
|
|
101
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
102
|
-
Metrics/PerceivedComplexity:
|
|
103
|
-
Max: 35
|
|
85
|
+
Max: 93
|
|
104
86
|
|
|
105
87
|
# Offense count: 9
|
|
106
|
-
# Configuration parameters:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Naming/VariableNumber:
|
|
110
|
-
Exclude:
|
|
111
|
-
- 'e118_entry.rb'
|
|
88
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
89
|
+
Metrics/ParameterLists:
|
|
90
|
+
Max: 8
|
|
112
91
|
|
|
113
|
-
# Offense count:
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
|
|
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'
|
|
92
|
+
# Offense count: 52
|
|
93
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
94
|
+
Metrics/PerceivedComplexity:
|
|
95
|
+
Enabled: false
|
|
123
96
|
|
|
124
|
-
# Offense count:
|
|
125
|
-
# Configuration parameters:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- '
|
|
130
|
-
- '
|
|
131
|
-
- '
|
|
132
|
-
- 'lib/prosereflect/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
- 'lib/prosereflect/
|
|
141
|
-
- 'lib/prosereflect/
|
|
142
|
-
- 'lib/prosereflect/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
97
|
+
# Offense count: 7
|
|
98
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
99
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
|
100
|
+
Naming/MethodParameterName:
|
|
101
|
+
Exclude:
|
|
102
|
+
- 'lib/prosereflect/schema/content_match.rb'
|
|
103
|
+
- 'lib/prosereflect/schema/fragment.rb'
|
|
104
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
105
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
106
|
+
|
|
107
|
+
# Offense count: 8
|
|
108
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
109
|
+
# AllowedMethods: call
|
|
110
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
111
|
+
Naming/PredicateMethod:
|
|
112
|
+
Exclude:
|
|
113
|
+
- 'lib/prosereflect/schema/attribute.rb'
|
|
114
|
+
- 'lib/prosereflect/schema/content_match.rb'
|
|
115
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
116
|
+
|
|
117
|
+
# Offense count: 12
|
|
118
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
119
|
+
# NamePrefix: is_, has_, have_, does_
|
|
120
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
121
|
+
# AllowedMethods: is_a?
|
|
122
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
123
|
+
Naming/PredicatePrefix:
|
|
124
|
+
Exclude:
|
|
125
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
126
|
+
- 'lib/prosereflect/schema/mark_type.rb'
|
|
127
|
+
- 'lib/prosereflect/schema/node.rb'
|
|
128
|
+
- 'lib/prosereflect/schema/node_type.rb'
|
|
151
129
|
|
|
152
130
|
# Offense count: 1
|
|
153
|
-
#
|
|
154
|
-
|
|
155
|
-
# SupportedStyles: always, always_true, never
|
|
156
|
-
Style/FrozenStringLiteralComment:
|
|
131
|
+
# Configuration parameters: MinSize.
|
|
132
|
+
Performance/CollectionLiteralInLoop:
|
|
157
133
|
Exclude:
|
|
158
|
-
- '
|
|
159
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
134
|
+
- 'lib/prosereflect/input/html.rb'
|
|
160
135
|
|
|
161
136
|
# Offense count: 7
|
|
162
|
-
#
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- 'e118_amendment.rb'
|
|
166
|
-
- 'e118_entry.rb'
|
|
167
|
-
|
|
168
|
-
# Offense count: 1
|
|
169
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
170
|
-
# Configuration parameters: EnforcedStyle, MinBodyLength, AllowConsecutiveConditionals.
|
|
171
|
-
# SupportedStyles: skip_modifier_ifs, always
|
|
172
|
-
Style/Next:
|
|
137
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
138
|
+
# Prefixes: when, with, without
|
|
139
|
+
RSpec/ContextWording:
|
|
173
140
|
Exclude:
|
|
174
|
-
- '
|
|
141
|
+
- 'spec/prosereflect/parser_spec.rb'
|
|
142
|
+
- 'spec/prosereflect/schema/conftest.rb'
|
|
143
|
+
- 'spec/support/shared_examples.rb'
|
|
175
144
|
|
|
176
|
-
# Offense count:
|
|
177
|
-
#
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
Style/NumericPredicate:
|
|
181
|
-
Exclude:
|
|
182
|
-
- 'spec/**/*'
|
|
183
|
-
- 'e118_amendment.rb'
|
|
184
|
-
- 'e118_entry.rb'
|
|
185
|
-
- 'lib/prosereflect/table.rb'
|
|
145
|
+
# Offense count: 254
|
|
146
|
+
# Configuration parameters: CountAsOne.
|
|
147
|
+
RSpec/ExampleLength:
|
|
148
|
+
Max: 134
|
|
186
149
|
|
|
187
|
-
# Offense count:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Exclude:
|
|
191
|
-
- 'e118_amendment.rb'
|
|
150
|
+
# Offense count: 158
|
|
151
|
+
RSpec/MultipleExpectations:
|
|
152
|
+
Max: 8
|
|
192
153
|
|
|
193
|
-
# Offense count:
|
|
194
|
-
#
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- 'e118_amendment.rb'
|
|
154
|
+
# Offense count: 7
|
|
155
|
+
# Configuration parameters: AllowedGroups.
|
|
156
|
+
RSpec/NestedGroups:
|
|
157
|
+
Max: 4
|
|
198
158
|
|
|
199
159
|
# Offense count: 1
|
|
200
|
-
#
|
|
201
|
-
#
|
|
202
|
-
|
|
203
|
-
Style/RescueStandardError:
|
|
160
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
161
|
+
# SupportedInflectors: default, active_support
|
|
162
|
+
RSpec/SpecFilePathFormat:
|
|
204
163
|
Exclude:
|
|
205
|
-
- '
|
|
164
|
+
- 'spec/prosereflect/schema/schema_spec.rb'
|
|
206
165
|
|
|
207
|
-
# Offense count:
|
|
166
|
+
# Offense count: 2
|
|
208
167
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
209
|
-
|
|
210
|
-
# AllowedMethods: present?, blank?, presence, try, try!
|
|
211
|
-
Style/SafeNavigation:
|
|
168
|
+
Style/IdenticalConditionalBranches:
|
|
212
169
|
Exclude:
|
|
213
|
-
- '
|
|
170
|
+
- 'lib/prosereflect/schema/mark.rb'
|
|
214
171
|
|
|
215
172
|
# Offense count: 1
|
|
216
|
-
#
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
- 'lib/prosereflect/table.rb'
|
|
220
|
-
|
|
221
|
-
# Offense count: 38
|
|
222
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
223
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
224
|
-
# SupportedStyles: single_quotes, double_quotes
|
|
225
|
-
Style/StringLiterals:
|
|
173
|
+
# Configuration parameters: EnforcedStyle.
|
|
174
|
+
# SupportedStyles: allow_single_line, disallow
|
|
175
|
+
Style/NumberedParameters:
|
|
226
176
|
Exclude:
|
|
227
|
-
- '
|
|
228
|
-
- 'Rakefile'
|
|
229
|
-
- 'bin/console'
|
|
230
|
-
- 'bin/extract-ituob-amendments.rb'
|
|
231
|
-
- 'lib/prosereflect.rb'
|
|
232
|
-
- 'lib/prosereflect/version.rb'
|
|
233
|
-
- 'prosereflect.gemspec'
|
|
177
|
+
- 'lib/prosereflect/schema/content_match.rb'
|
|
234
178
|
|
|
235
|
-
# Offense count:
|
|
236
|
-
#
|
|
237
|
-
Style/
|
|
179
|
+
# Offense count: 1
|
|
180
|
+
# Configuration parameters: AllowedClasses.
|
|
181
|
+
Style/OneClassPerFile:
|
|
238
182
|
Exclude:
|
|
239
|
-
- '
|
|
240
|
-
- 'e118_entry.rb'
|
|
241
|
-
|
|
242
|
-
# Offense count: 6
|
|
243
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
244
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
245
|
-
# URISchemes: http, https
|
|
246
|
-
Layout/LineLength:
|
|
247
|
-
Max: 153
|
|
183
|
+
- 'lib/prosereflect/schema.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
|
+
```
|