moxml 0.1.16 → 0.1.18
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/.gitignore +6 -0
- data/.rubocop_todo.yml +49 -133
- data/README.adoc +18 -0
- data/lib/moxml/adapter/base.rb +65 -8
- data/lib/moxml/adapter/headed_ox.rb +2 -1
- data/lib/moxml/adapter/libxml.rb +16 -6
- data/lib/moxml/adapter/nokogiri.rb +13 -7
- data/lib/moxml/adapter/oga.rb +35 -90
- data/lib/moxml/adapter/ox.rb +69 -19
- data/lib/moxml/adapter/rexml.rb +26 -9
- data/lib/moxml/attribute.rb +6 -0
- data/lib/moxml/config.rb +17 -2
- data/lib/moxml/element.rb +12 -8
- data/lib/moxml/node.rb +4 -1
- data/lib/moxml/text.rb +6 -0
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xpath/compiler.rb +40 -21
- data/lib/moxml/xpath/parser.rb +12 -7
- data/spec/integration/all_adapters_spec.rb +1 -0
- data/spec/integration/shared_examples/edge_cases.rb +85 -6
- data/spec/integration/shared_examples/entity_reference_whitespace.rb +124 -0
- data/spec/integration/shared_examples/high_level/document_builder_behavior.rb +8 -6
- data/spec/integration/shared_examples/integration_workflows.rb +1 -1
- data/spec/integration/shared_examples/node_wrappers/cdata_behavior.rb +0 -7
- data/spec/integration/shared_examples/node_wrappers/namespace_behavior.rb +135 -0
- data/spec/integration/shared_examples/node_wrappers/node_behavior.rb +0 -3
- data/spec/integration/shared_examples/node_wrappers/node_set_behavior.rb +3 -1
- data/spec/moxml/adapter/entity_restoration_spec.rb +97 -0
- data/spec/moxml/builder_spec.rb +16 -1
- data/spec/moxml/entity_preservation_spec.rb +130 -0
- data/spec/moxml/entity_reference_spec.rb +114 -0
- data/spec/moxml/entity_registry_spec.rb +68 -0
- data/spec/moxml/moxml_spec.rb +39 -0
- data/spec/moxml/xpath/axes_spec.rb +0 -1
- data/spec/moxml/xpath/compiler_spec.rb +0 -2
- data/spec/performance/benchmark_spec.rb +1 -1
- metadata +6 -12
- data/TODO.remaining/1-entity-reference-adapter-support.md +0 -157
- data/TODO.remaining/2-entity-restoration-model-driven.md +0 -169
- data/TODO.remaining/3-entity-reference-test-coverage.md +0 -170
- data/TODO.remaining/4-lenient-entities-mode.md +0 -106
- data/TODO.remaining/5-fixture-integrity.md +0 -65
- data/TODO.remaining/6-ox-element-ordering-bug.md +0 -36
- data/TODO.remaining/7-headed-ox-limitations.md +0 -95
- data/TODO.remaining/8-xpath-predicate-gaps.md +0 -68
- data/TODO.remaining/9-cleanup-hygiene.md +0 -42
- data/TODO.remaining/README.md +0 -54
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# TODO 8: XPath Engine Predicate Gaps (5 xit Tests)
|
|
2
|
-
|
|
3
|
-
## Problem
|
|
4
|
-
|
|
5
|
-
The pure-Ruby XPath engine (used by HeadedOx) does not fully support
|
|
6
|
-
`position()`, `last()`, and `id()` inside predicates. Five tests are marked
|
|
7
|
-
`xit` pending predicate support.
|
|
8
|
-
|
|
9
|
-
These gaps affect the XPath engine in `lib/moxml/xpath/` — they are not
|
|
10
|
-
adapter-specific.
|
|
11
|
-
|
|
12
|
-
## Failing Tests
|
|
13
|
-
|
|
14
|
-
### `position()` in Predicates (2 tests)
|
|
15
|
-
|
|
16
|
-
`spec/moxml/xpath/functions/position_functions_spec.rb`
|
|
17
|
-
|
|
18
|
-
```ruby
|
|
19
|
-
xit "returns current position in predicate" do
|
|
20
|
-
# /root/item[position() = 2]
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
xit "works with position comparison" do
|
|
24
|
-
# /root/item[position() > 1]
|
|
25
|
-
end
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### `last()` in Predicates (2 tests)
|
|
29
|
-
|
|
30
|
-
`spec/moxml/xpath/functions/position_functions_spec.rb`
|
|
31
|
-
|
|
32
|
-
```ruby
|
|
33
|
-
xit "returns size of context in predicate" do
|
|
34
|
-
# /root/item[position() = last()]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
xit "works with last() - 1" do
|
|
38
|
-
# /root/item[position() = last() - 1]
|
|
39
|
-
end
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### `id()` with Nodeset Argument (1 test)
|
|
43
|
-
|
|
44
|
-
`spec/moxml/xpath/functions/special_functions_spec.rb:69`
|
|
45
|
-
|
|
46
|
-
```ruby
|
|
47
|
-
xit "accepts nodeset argument containing IDs" do
|
|
48
|
-
# id(nodeset) where nodeset is path-evaluated
|
|
49
|
-
end
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Investigation Needed
|
|
53
|
-
|
|
54
|
-
- The XPath compiler likely needs to pass predicate context (position, size)
|
|
55
|
-
into the evaluation environment when compiling predicate expressions.
|
|
56
|
-
- `position()` and `last()` are defined but raise `InvalidContextError` when
|
|
57
|
-
used inside predicates — the predicate evaluation path doesn't set up the
|
|
58
|
-
context they need.
|
|
59
|
-
- `id()` with a nodeset argument requires evaluating the argument as an XPath
|
|
60
|
-
path first, then extracting ID values from the resulting nodes.
|
|
61
|
-
|
|
62
|
-
## Files
|
|
63
|
-
|
|
64
|
-
- `lib/moxml/xpath/compiler.rb` — predicate compilation
|
|
65
|
-
- `lib/moxml/xpath/engine.rb` — runtime evaluation context
|
|
66
|
-
- `lib/moxml/xpath/context.rb` — context setup for position/last
|
|
67
|
-
- `spec/moxml/xpath/functions/position_functions_spec.rb`
|
|
68
|
-
- `spec/moxml/xpath/functions/special_functions_spec.rb`
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# TODO 9: Cleanup and Hygiene
|
|
2
|
-
|
|
3
|
-
Small items that don't affect functionality but should be addressed.
|
|
4
|
-
|
|
5
|
-
## 9a. Stale Doc Links in Skip Messages
|
|
6
|
-
|
|
7
|
-
15+ test skip messages reference `docs/HEADED_OX_LIMITATIONS.md` but the
|
|
8
|
-
actual file is at `docs/_pages/headed-ox-limitations.adoc`. The referenced
|
|
9
|
-
path does not exist.
|
|
10
|
-
|
|
11
|
-
**Fix:** Update all skip messages to reference
|
|
12
|
-
`docs/_pages/headed-ox-limitations.adoc` instead.
|
|
13
|
-
|
|
14
|
-
**Affected files:**
|
|
15
|
-
- `spec/integration/headed_ox_integration_spec.rb`
|
|
16
|
-
- `spec/integration/shared_examples/integration_workflows.rb`
|
|
17
|
-
- `spec/integration/shared_examples/node_wrappers/node_behavior.rb`
|
|
18
|
-
- `spec/integration/shared_examples/node_wrappers/cdata_behavior.rb`
|
|
19
|
-
- `spec/integration/shared_examples/edge_cases.rb`
|
|
20
|
-
- `spec/moxml/xpath/axes_spec.rb`
|
|
21
|
-
- `spec/moxml/xpath/compiler_spec.rb`
|
|
22
|
-
- `spec/moxml/adapter/headed_ox_spec.rb`
|
|
23
|
-
|
|
24
|
-
## 9b. Untracked `scripts/` Directory
|
|
25
|
-
|
|
26
|
-
`scripts/format_xml.rb` and `scripts/pretty_format_xml.rb` exist as untracked
|
|
27
|
-
files. Decide whether to commit (and add to `.gitignore` pattern or document)
|
|
28
|
-
or remove.
|
|
29
|
-
|
|
30
|
-
## 9c. Superseded Root TODO Files
|
|
31
|
-
|
|
32
|
-
The following root-level files are marked as superseded in
|
|
33
|
-
`TODO.remaining/README.md` but still exist:
|
|
34
|
-
|
|
35
|
-
- `TODO.entities-work.md`
|
|
36
|
-
- `TODO.entity-handling.md`
|
|
37
|
-
- `TODO.entity-support.md`
|
|
38
|
-
- `TODO.full-entity-support.md`
|
|
39
|
-
- `TODO.full-entity.md`
|
|
40
|
-
- `TODO.mn-bilingual-round-trip.md`
|
|
41
|
-
|
|
42
|
-
Once all work is confirmed tracked in `TODO.remaining/`, these can be deleted.
|
data/TODO.remaining/README.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# TODO.remaining — Consolidated Action Items
|
|
2
|
-
|
|
3
|
-
Consolidated from: TODO.entities-work.md, TODO.entity-support.md,
|
|
4
|
-
TODO.full-entity.md, TODO.full-entity-support.md, TODO.entity-handling.md,
|
|
5
|
-
TODO.mn-bilingual-round-trip.md, plus code audit (2026-04-22).
|
|
6
|
-
|
|
7
|
-
Those root files are superseded and can be removed.
|
|
8
|
-
|
|
9
|
-
## Dependency Order
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
TODO 1 (Adapter Support)
|
|
13
|
-
|
|
|
14
|
-
v
|
|
15
|
-
TODO 2 (Model-Driven Restoration) ---> TODO 4 (Lenient Entities Mode)
|
|
16
|
-
|
|
|
17
|
-
v
|
|
18
|
-
TODO 3 (Test Coverage)
|
|
19
|
-
|
|
20
|
-
TODO 5 (Fixture Integrity) — independent
|
|
21
|
-
TODO 6 (Ox Element Ordering) — independent
|
|
22
|
-
TODO 7 (HeadedOx Limitations) — independent
|
|
23
|
-
TODO 8 (XPath Predicate Gaps) — independent
|
|
24
|
-
TODO 9 (Cleanup Hygiene) — independent
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Summary
|
|
28
|
-
|
|
29
|
-
| # | File | Description | Status |
|
|
30
|
-
|---|------|-------------|--------|
|
|
31
|
-
| 1 | `1-entity-reference-adapter-support.md` | EntityReference in Ox, Oga, REXML, LibXML, HeadedOx | Not started |
|
|
32
|
-
| 2 | `2-entity-restoration-model-driven.md` | Use EntityRegistry as source of truth for restoration | Not started |
|
|
33
|
-
| 3 | `3-entity-reference-test-coverage.md` | Tests for EntityReference nodes and round-trips | Not started |
|
|
34
|
-
| 4 | `4-lenient-entities-mode.md` | Strict vs lenient entity restoration mode | Not started |
|
|
35
|
-
| 5 | `5-fixture-integrity.md` | Bilingual fixture verification + CI validation | Not started |
|
|
36
|
-
| 6 | `6-ox-element-ordering-bug.md` | Ox adapter reorders elements in certain fixtures | Not started |
|
|
37
|
-
| 7 | `7-headed-ox-limitations.md` | 15 skipped tests across 7 HeadedOx limitation areas | Not started |
|
|
38
|
-
| 8 | `8-xpath-predicate-gaps.md` | position()/last()/id() not working in XPath predicates | Not started |
|
|
39
|
-
| 9 | `9-cleanup-hygiene.md` | Stale doc links, untracked scripts, superseded files | Not started |
|
|
40
|
-
|
|
41
|
-
## What's Already Done
|
|
42
|
-
|
|
43
|
-
- EntityReference node class (`lib/moxml/entity_reference.rb`)
|
|
44
|
-
- EntityRegistry with 2125 W3C entities (`lib/moxml/entity_registry.rb`)
|
|
45
|
-
- Node type registry includes `:entity_reference`
|
|
46
|
-
- Base adapter template: `create_entity_reference`, `validate_entity_reference_name`
|
|
47
|
-
- Nokogiri adapter: full native EntityReference support
|
|
48
|
-
- Document factory: `create_entity_reference(name)`
|
|
49
|
-
- DocumentBuilder: `visit_entity_reference` + partial `restore_entities_in_text`
|
|
50
|
-
- Builder DSL: `entity_reference(name)`
|
|
51
|
-
- Config: `restore_entities`, `entity_load_mode`, `entity_provider`, `preload_entity_sets`
|
|
52
|
-
- Context: entity registry integration
|
|
53
|
-
- EntityRegistry tests (24 examples passing)
|
|
54
|
-
- HeadedOx limitations documented in `docs/_pages/headed-ox-limitations.adoc`
|