metanorma-ietf 3.7.10 → 3.7.12.pre.alpha.1
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 +11 -0
- data/.html.err.html +118 -0
- data/.rspec +0 -1
- data/Gemfile +29 -4
- data/Gemfile.devel +1 -0
- data/TODO.rfc-to-from-conversions/01-fix-reference-anchor-uuid.md +18 -0
- data/TODO.rfc-to-from-conversions/02-fix-extract-paragraph-text.md +13 -0
- data/TODO.rfc-to-from-conversions/03-fix-duplicate-anchors-roundtrip.md +26 -0
- data/TODO.rfc-to-from-conversions/04-fix-li-t-children-roundtrip.md +22 -0
- data/TODO.rfc-to-from-conversions/05-write-pipeline1-spec.md +22 -0
- data/TODO.rfc-to-from-conversions/06-write-pipeline2-spec.md +27 -0
- data/TODO.rfc-to-from-conversions/07-final-verification.md +14 -0
- data/TODO.rfc-to-from-conversions/bugreport-metanorma-document-circular-autoload.md +112 -0
- data/TODO.transform-bidirectional/01-bidirectional-architecture.md +86 -0
- data/TODO.transform-bidirectional/02-encapsulate-lutaml-model-private-api.md +109 -0
- data/TODO.transform-bidirectional/03-eliminate-xml-string-manipulation.md +101 -0
- data/TODO.transform-bidirectional/04-replace-null-objects.md +86 -0
- data/TODO.transform-bidirectional/05-remove-nokogiri-from-validation.md +58 -0
- data/TODO.transform-bidirectional/06-reverse-transformer-metadata.md +50 -0
- data/TODO.transform-bidirectional/07-reverse-transformer-front.md +59 -0
- data/TODO.transform-bidirectional/08-reverse-transformer-sections.md +89 -0
- data/TODO.transform-bidirectional/09-reverse-transformer-references.md +37 -0
- data/TODO.transform-bidirectional/10-reverse-transformer-terms.md +24 -0
- data/TODO.transform-bidirectional/11-reverse-transformer-cleanup.md +22 -0
- data/TODO.transform-bidirectional/12-spec-coverage.md +48 -0
- data/TODO.transform-bidirectional/13-refactor-forward-transformer.md +50 -0
- data/TODO.transform-bidirectional/14-round-trip-fidelity.md +53 -0
- data/TODO.transform-bidirectional/README.md +23 -0
- data/docs/architecture.adoc +506 -0
- data/docs/discrepancy-log.adoc +124 -0
- data/docs/keiko-census-pretriage.md +37 -0
- data/docs/qa-plan.adoc +1616 -0
- data/docs/truthy-collection-audit.md +32 -0
- data/docs/ws5b/README.md +21 -0
- data/docs/ws5b/audit/a1-front.md +130 -0
- data/docs/ws5b/audit/a2-blocks.md +77 -0
- data/docs/ws5b/audit/a3-inline.md +145 -0
- data/docs/ws5b/audit/a4-lists-tables.md +65 -0
- data/docs/ws5b/audit/a5-references.md +67 -0
- data/docs/ws5b/audit/a6-sections-terms.md +77 -0
- data/docs/ws5b/audit/a7-entry-validation.md +74 -0
- data/docs/ws5b/consolidated.md +107 -0
- data/docs/ws5b/odo-report-ws5b.md +47 -0
- data/docs/ws5b/tickets/00-tracking.md +34 -0
- data/docs/ws5b/tickets/03-inline-flattening.md +23 -0
- data/docs/ws5b/tickets/04-footnotes.md +18 -0
- data/docs/ws5b/tickets/05-list-items.md +17 -0
- data/docs/ws5b/tickets/06-tables.md +14 -0
- data/docs/ws5b/tickets/07-figures-images.md +18 -0
- data/docs/ws5b/tickets/08-containers.md +19 -0
- data/docs/ws5b/tickets/09-front-matter.md +25 -0
- data/docs/ws5b/tickets/10-sections-root-attrs.md +23 -0
- data/docs/ws5b/tickets/11-terms.md +21 -0
- data/docs/ws5b/tickets/12-references.md +22 -0
- data/docs/ws5b/tickets/13-pipeline-robustness.md +19 -0
- data/docs/ws5b/tickets/WITHDRAWN-01-cref-stub.md +28 -0
- data/docs/ws5b/tickets/WITHDRAWN-02-passthrough.md +28 -0
- data/docs/ws5b/verdicts/verdicts-v1-blocks.md +21 -0
- data/docs/ws5b/verdicts/verdicts-v2-inline.md +12 -0
- data/docs/ws5b/verdicts/verdicts-v3-lists.md +12 -0
- data/docs/ws5b/verdicts/verdicts-v4-front.md +12 -0
- data/docs/ws5b/verdicts/verdicts-v5-pipeline.md +9 -0
- data/docs/ws5c/c1-grammar-vs-model.md +19 -0
- data/docs/ws5c/c2-model-vs-transformer.md +21 -0
- data/docs/ws5c/c3-transformer-vs-v3.md +15 -0
- data/docs/ws5c/model_coverage_exhaustiveness_spec.rb +171 -0
- data/docs/ws5c/odo-report-ws5c.md +32 -0
- data/docs/ws5c/probe-verdicts.md +10 -0
- data/docs/ws5c/synthesis.md +40 -0
- data/docs/ws5c/tickets/14-pseudocode-dead-guard.md +22 -0
- data/docs/ws5c/tickets/15-erefstack.md +18 -0
- data/docs/ws5c/tickets/16-artwork-sizing.md +14 -0
- data/docs/ws5c/tickets/17-concept-crash.md +30 -0
- data/docs/ws5c/tickets/18-metanorma-document-followup.md +19 -0
- data/docs/ws5c/tickets/19-park-ws4.md +10 -0
- data/docs/ws5c/tickets/20-park-ws7.md +10 -0
- data/docs/ws5c/tickets/comment-291.md +13 -0
- data/docs/ws5c/tickets/comment-295.md +7 -0
- data/docs/ws5c/tickets/comment-300.md +8 -0
- data/lib/isodoc/ietf/presentation_xml_convert.rb +95 -0
- data/lib/metanorma/ietf/basicdoc.rng +53 -30
- data/lib/metanorma/ietf/biblio-standoc.rng +18 -0
- data/lib/metanorma/ietf/blocks.rb +3 -2
- data/lib/metanorma/ietf/cleanup.rb +2 -8
- data/lib/metanorma/ietf/converter.rb +0 -18
- data/lib/metanorma/ietf/document/metadata/ietf_bib_data_extension_type.rb +39 -0
- data/lib/metanorma/ietf/document/metadata/ietf_bibliographic_item.rb +51 -0
- data/lib/metanorma/ietf/document/metadata/ietf_editorial_group.rb +17 -0
- data/lib/metanorma/ietf/document/metadata/pi_settings.rb +35 -0
- data/lib/metanorma/ietf/document/metadata.rb +16 -0
- data/lib/metanorma/ietf/document/root.rb +31 -0
- data/lib/metanorma/ietf/document/sections/ietf_annex_section.rb +26 -0
- data/lib/metanorma/ietf/document/sections/ietf_clause_section.rb +26 -0
- data/lib/metanorma/ietf/document/sections/ietf_content_section.rb +25 -0
- data/lib/metanorma/ietf/document/sections/ietf_sections.rb +35 -0
- data/lib/metanorma/ietf/document/sections.rb +12 -0
- data/lib/metanorma/ietf/document.rb +59 -0
- data/lib/metanorma/ietf/front.rb +1 -1
- data/lib/metanorma/ietf/html/renderer.rb +79 -0
- data/lib/metanorma/ietf/html.rb +14 -0
- data/lib/metanorma/ietf/ietf.rng +25 -25
- data/lib/metanorma/ietf/processor.rb +50 -5
- data/lib/metanorma/ietf/reqt.rng +32 -12
- data/lib/metanorma/ietf/schema/reference_renderer.rb +363 -0
- data/lib/metanorma/ietf/{isodoc.rng → standoc.rng} +238 -78
- data/lib/metanorma/ietf/themes/ietf/templates/_rfc_cover.html.liquid +25 -0
- data/lib/metanorma/ietf/themes/ietf/theme.yaml +45 -0
- data/lib/metanorma/ietf/transformer/annotation_transformer.rb +25 -0
- data/lib/metanorma/ietf/transformer/base.rb +255 -0
- data/lib/metanorma/ietf/transformer/block_transformer.rb +813 -0
- data/lib/metanorma/ietf/transformer/cleanup_transformer.rb +505 -0
- data/lib/metanorma/ietf/transformer/figure_transformer.rb +310 -0
- data/lib/metanorma/ietf/transformer/front_transformer.rb +634 -0
- data/lib/metanorma/ietf/transformer/ietf_to_rfc_v3.rb +463 -0
- data/lib/metanorma/ietf/transformer/inline_transformer.rb +335 -0
- data/lib/metanorma/ietf/transformer/list_transformer.rb +485 -0
- data/lib/metanorma/ietf/transformer/metadata_transformer.rb +188 -0
- data/lib/metanorma/ietf/transformer/null_objects.rb +40 -0
- data/lib/metanorma/ietf/transformer/order_tracker.rb +91 -0
- data/lib/metanorma/ietf/transformer/reference_transformer.rb +776 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/annotation_transformer.rb +104 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/block_transformer.rb +86 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/cleanup_transformer.rb +66 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/figure_transformer.rb +82 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/front_transformer.rb +156 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/inline_transformer.rb +231 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/list_transformer.rb +269 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/metadata_transformer.rb +224 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/reference_transformer.rb +279 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/section_transformer.rb +211 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/table_transformer.rb +108 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf/term_transformer.rb +159 -0
- data/lib/metanorma/ietf/transformer/rfc_v3_to_ietf.rb +175 -0
- data/lib/metanorma/ietf/transformer/section_transformer.rb +605 -0
- data/lib/metanorma/ietf/transformer/table_transformer.rb +278 -0
- data/lib/metanorma/ietf/transformer/term_transformer.rb +349 -0
- data/lib/metanorma/ietf/transformer/validation_transformer.rb +248 -0
- data/lib/metanorma/ietf/transformer.rb +313 -0
- data/lib/metanorma/ietf/version.rb +1 -1
- data/lib/metanorma/ietf.rb +16 -1
- data/lib/metanorma-ietf.rb +0 -1
- data/metanorma-ietf.gemspec +6 -16
- data/test.doc +1109 -0
- data/test.html +282 -0
- data/test.pdf +0 -0
- data/test.pdf.err +1 -0
- data/test.presentation.xml +62 -0
- data/tools/compare_old_new.rb +141 -0
- data/tools/ws5_sweep.rb +87 -0
- metadata +157 -185
- data/lib/isodoc/ietf/blocks.rb +0 -241
- data/lib/isodoc/ietf/cleanup.rb +0 -125
- data/lib/isodoc/ietf/cleanup_blocks.rb +0 -206
- data/lib/isodoc/ietf/cleanup_inline.rb +0 -92
- data/lib/isodoc/ietf/footnotes.rb +0 -74
- data/lib/isodoc/ietf/front.rb +0 -247
- data/lib/isodoc/ietf/init.rb +0 -21
- data/lib/isodoc/ietf/inline.rb +0 -190
- data/lib/isodoc/ietf/lists.rb +0 -85
- data/lib/isodoc/ietf/metadata.rb +0 -68
- data/lib/isodoc/ietf/references.rb +0 -109
- data/lib/isodoc/ietf/reqt.rb +0 -36
- data/lib/isodoc/ietf/rfc_convert.rb +0 -136
- data/lib/isodoc/ietf/section.rb +0 -185
- data/lib/isodoc/ietf/table.rb +0 -54
- data/lib/isodoc/ietf/terms.rb +0 -148
- data/lib/isodoc/ietf/validation.rb +0 -202
- data/lib/relaton/render/config.yml +0 -60
- data/lib/relaton/render/date.rb +0 -12
- data/lib/relaton/render/fields.rb +0 -30
- data/lib/relaton/render/general.rb +0 -26
- data/lib/relaton/render/parse.rb +0 -176
- data/lib/relaton/render/template.rb +0 -29
- /data/lib/{isodoc/ietf → metanorma/ietf/schema}/SVG-1.2-RFC.rng +0 -0
- /data/lib/{isodoc/ietf → metanorma/ietf/schema}/v3.rng +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4057d389151d966fc7aa733b69ac7901aea8da9e51b1cbf555c2c6c4eb8b917b
|
|
4
|
+
data.tar.gz: c2fda3e54ba45cda235a5b58ffa5612e454f3318078d49a12e4d6b16cfcb1929
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bdb89f96dcc8c07499607e80e45dc33a112df022cad12f17f7412bb284459ee281aee71973237e430fc7293c6c00f27cd8ea83373daa8e3f83a27f5d4445c45
|
|
7
|
+
data.tar.gz: d4406a05055b07583cd439b49c6ed0dcae8cf526bcc9902fbfe36e4a4fc15583a66d1bc3e443daf668098f3c8c7048cfe4ff58f214117f60c955bb9aecf87147
|
data/.gitignore
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
/spec/reports/
|
|
9
9
|
/tmp/
|
|
10
10
|
.tmp.xml
|
|
11
|
+
test.err.html
|
|
12
|
+
test.rfc.xml
|
|
13
|
+
test.xml
|
|
14
|
+
.asciidoc.log.txt
|
|
15
|
+
metanorma.asciidoc.log.txt
|
|
11
16
|
|
|
12
17
|
# rspec failure tracking
|
|
13
18
|
.rspec_status
|
|
@@ -20,5 +25,11 @@
|
|
|
20
25
|
.rubocop-https--*
|
|
21
26
|
|
|
22
27
|
/Gemfile.lock
|
|
28
|
+
/Gemfile.devel
|
|
23
29
|
/test.err
|
|
24
30
|
/test.rfc.xml.err
|
|
31
|
+
document.xml
|
|
32
|
+
document.err.html
|
|
33
|
+
document.rfc.xml.err
|
|
34
|
+
*.gem
|
|
35
|
+
spec/relatondb/
|
data/.html.err.html
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<html><head><title>./.html.err.html errors</title>
|
|
2
|
+
<meta charset="UTF-8"/>
|
|
3
|
+
<style> pre { white-space: pre-wrap; }
|
|
4
|
+
thead th { font-weight: bold; background-color: aqua; }
|
|
5
|
+
.severity0 { font-weight: bold; background-color: lightpink }
|
|
6
|
+
.severity1 { font-weight: bold; }
|
|
7
|
+
.severity2 { }
|
|
8
|
+
.severity3 { font-style: italic; color: grey; }
|
|
9
|
+
</style>
|
|
10
|
+
</head><body><h1>./.html.err.html errors</h1>
|
|
11
|
+
<ul><li><p><b><a href="#Relaton">Relaton</a></b>: Severity 3: <b>1</b> error</p></li>
|
|
12
|
+
|
|
13
|
+
<li><p><b><a href="#Style">Style</a></b>: Severity 2: <b>2</b> errors</p></li>
|
|
14
|
+
|
|
15
|
+
<li><p><b><a href="#Metanorma_XML_Syntax">Metanorma XML Syntax</a></b>: Severity 2: <b>22</b> errors</p></li>
|
|
16
|
+
</ul>
|
|
17
|
+
<h2 id="Relaton">Relaton</h2>
|
|
18
|
+
<table border="1">
|
|
19
|
+
<thead><th width="5%">Line</th><th width="20%">ID</th><th width="10%">Error</th>
|
|
20
|
+
<th width="20%">Message</th><th width="40%">Context</th><th width="5%">Severity</th></thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr class="severity3">
|
|
23
|
+
<td></td><th><code>ISO/IEC 10118-3</code></th><td>RELATON_4</td>
|
|
24
|
+
<td>(Error from Relaton) not found in cache, if you wish to ignore cache please use <code>no-cache</code> option.</td><td><pre></pre></td><td>3</td></tr>
|
|
25
|
+
</tbody></table>
|
|
26
|
+
<h2 id="Style">Style</h2>
|
|
27
|
+
<table border="1">
|
|
28
|
+
<thead><th width="5%">Line</th><th width="20%">ID</th><th width="10%">Error</th>
|
|
29
|
+
<th width="20%">Message</th><th width="40%">Context</th><th width="5%">Severity</th></thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr class="severity2">
|
|
32
|
+
<td>000433</td><th><code><a href='./.html.html#frame'>frame</a></code></th><td>STANDOC_48</td>
|
|
33
|
+
<td>(generic warning) Hanging paragraph in clause</td><td><pre><clause id="_7db07fdc-fcc6-b1d5-fbd9-4af3fe5d67d4" anchor="frame" inline-header="false" obligation="normative">
|
|
34
|
+
<title id="_7f507f76-d16f-6909-7c72-3bf386b1aac3">Frame Format</title>
|
|
35
|
+
<p id="_e5b93d18-9b70-055e-f3ea-e7d3e221cb31">The IP <em>datagram</em> is <strong>printed</strong>, on a small scroll of paper, in hexadecimal, with each octet separated by whitestuff and blackstuff. The scroll of paper is wrapped around one leg of the avian carrier. A band of duct tape is used to secure the datagram's edges. The bandwidth is limited to the leg length. The MTU is variable, and paradoxically, generally increases with increased carrier age. A typical MTU is 256 milligrams. Some datagram padding may be needed.<eref type="inline" bibitemid="RFC7253" citeas="RFC 7253"> <display-text>alt</display-text> </eref> </p>
|
|
36
|
+
|
|
37
|
+
<p id="_cbfa7d28-50f5-f4d4-8920-3ff81bb853de">Upon receipt, the duct tape is removed and the paper copy of the datagram is optically scanned into a electronically transmittable form.<eref type="inline" bibitemid="RFC7253" citeas="RFC 7253"/> </p></pre></td><td>2</td></tr>
|
|
38
|
+
<tr class="severity2">
|
|
39
|
+
<td>000468</td><th><code><a href='./.html.html#_b1474689-968c-d908-ec3c-52106a8e875b'>_b1474689-968c-d908-ec3c-52106a8e875b</a></code></th><td>STANDOC_48</td>
|
|
40
|
+
<td>(generic warning) Hanging paragraph in clause</td><td><pre><clause id="_b1474689-968c-d908-ec3c-52106a8e875b" inline-header="false" obligation="normative">
|
|
41
|
+
<title id="_0615fb18-bab7-fcce-7fe6-b06f78cdb707">Definitions</title>
|
|
42
|
+
<dl id="_188c1a32-874f-ef99-a4e5-24156e77be2b"> <dt>OSCCA-compliant:</dt>
|
|
43
|
+
<dd id="_2c9455c4-4da3-7bc6-4086-0552e4f2e2d7"> <p id="_5adcd946-10f3-f180-1cbb-f92b4fabcca2">All cryptographic algorithms used are compliant with OSCCA regulations.</p>
|
|
44
|
+
</dd></pre></td><td>2</td></tr>
|
|
45
|
+
</tbody></table>
|
|
46
|
+
<h2 id="Metanorma_XML_Syntax">Metanorma XML Syntax</h2>
|
|
47
|
+
<table border="1">
|
|
48
|
+
<thead><th width="5%">Line</th><th width="20%">ID</th><th width="10%">Error</th>
|
|
49
|
+
<th width="20%">Message</th><th width="40%">Context</th><th width="5%">Severity</th></thead>
|
|
50
|
+
<tbody>
|
|
51
|
+
<tr class="severity2">
|
|
52
|
+
<td></td><th><code>XML Line 000021:84</code></th><td>STANDOC_7</td>
|
|
53
|
+
<td>text not allowed here; expected the element end-tag or element "draft" or "revision-date"</td><td><pre></pre></td><td>2</td></tr>
|
|
54
|
+
<tr class="severity2">
|
|
55
|
+
<td></td><th><code>XML Line 000082:13</code></th><td>STANDOC_7</td>
|
|
56
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
57
|
+
<tr class="severity2">
|
|
58
|
+
<td></td><th><code>XML Line 000085:13</code></th><td>STANDOC_7</td>
|
|
59
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
60
|
+
<tr class="severity2">
|
|
61
|
+
<td></td><th><code>XML Line 000088:13</code></th><td>STANDOC_7</td>
|
|
62
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
63
|
+
<tr class="severity2">
|
|
64
|
+
<td></td><th><code>XML Line 000091:13</code></th><td>STANDOC_7</td>
|
|
65
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
66
|
+
<tr class="severity2">
|
|
67
|
+
<td></td><th><code>XML Line 000237:13</code></th><td>STANDOC_7</td>
|
|
68
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
69
|
+
<tr class="severity2">
|
|
70
|
+
<td></td><th><code>XML Line 000240:13</code></th><td>STANDOC_7</td>
|
|
71
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
72
|
+
<tr class="severity2">
|
|
73
|
+
<td></td><th><code>XML Line 000243:13</code></th><td>STANDOC_7</td>
|
|
74
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
75
|
+
<tr class="severity2">
|
|
76
|
+
<td></td><th><code>XML Line 000246:13</code></th><td>STANDOC_7</td>
|
|
77
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
78
|
+
<tr class="severity2">
|
|
79
|
+
<td></td><th><code>XML Line 000323:13</code></th><td>STANDOC_7</td>
|
|
80
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
81
|
+
<tr class="severity2">
|
|
82
|
+
<td></td><th><code>XML Line 000326:13</code></th><td>STANDOC_7</td>
|
|
83
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
84
|
+
<tr class="severity2">
|
|
85
|
+
<td></td><th><code>XML Line 000405:13</code></th><td>STANDOC_7</td>
|
|
86
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
87
|
+
<tr class="severity2">
|
|
88
|
+
<td></td><th><code>XML Line 000408:13</code></th><td>STANDOC_7</td>
|
|
89
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
90
|
+
<tr class="severity2">
|
|
91
|
+
<td></td><th><code>XML Line 000411:13</code></th><td>STANDOC_7</td>
|
|
92
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
93
|
+
<tr class="severity2">
|
|
94
|
+
<td></td><th><code>XML Line 000414:13</code></th><td>STANDOC_7</td>
|
|
95
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
96
|
+
<tr class="severity2">
|
|
97
|
+
<td></td><th><code>XML Line 000417:13</code></th><td>STANDOC_7</td>
|
|
98
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
99
|
+
<tr class="severity2">
|
|
100
|
+
<td></td><th><code>XML Line 000424:132</code></th><td>STANDOC_7</td>
|
|
101
|
+
<td>element "pi" not allowed here; expected the element end-tag or element "backpage-image", "coverpage-image", "ics", "indexInclude", "innercoverpage-image", "iprExtract", "showOnFrontPage", "sortRefs", "structuredidentifier", "symRefs", "tocDepth", "tocInclude" or "tocside-image"</td><td><pre></pre></td><td>2</td></tr>
|
|
102
|
+
<tr class="severity2">
|
|
103
|
+
<td></td><th><code>XML Line 000435:606</code></th><td>STANDOC_7</td>
|
|
104
|
+
<td>element "display-text" not allowed here; expected the element end-tag, text or element "date", "locality" or "localityStack"</td><td><pre></pre></td><td>2</td></tr>
|
|
105
|
+
<tr class="severity2">
|
|
106
|
+
<td></td><th><code>XML Line 000510:6</code></th><td>STANDOC_7</td>
|
|
107
|
+
<td>element "pre" missing required attribute "id"</td><td><pre></pre></td><td>2</td></tr>
|
|
108
|
+
<tr class="severity2">
|
|
109
|
+
<td></td><th><code>XML Line 000648:13</code></th><td>STANDOC_7</td>
|
|
110
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
111
|
+
<tr class="severity2">
|
|
112
|
+
<td></td><th><code>XML Line 000651:13</code></th><td>STANDOC_7</td>
|
|
113
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
114
|
+
<tr class="severity2">
|
|
115
|
+
<td></td><th><code>XML Line 000654:13</code></th><td>STANDOC_7</td>
|
|
116
|
+
<td>element "keyword" incomplete; missing required element "taxon"</td><td><pre></pre></td><td>2</td></tr>
|
|
117
|
+
</tbody></table>
|
|
118
|
+
</body></html>
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
|
-
Encoding.default_external = Encoding::UTF_8
|
|
2
|
-
Encoding.default_internal = Encoding::UTF_8
|
|
3
|
-
|
|
4
1
|
source "https://rubygems.org"
|
|
5
|
-
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
6
2
|
|
|
7
3
|
gemspec
|
|
4
|
+
gem "metanorma-mirror", "~> 1.0", github: "metanorma/metanorma-mirror", branch: "main"
|
|
5
|
+
|
|
6
|
+
# and the pubid-2 / relaton-bib 2.2 / metanorma-document 0.5 chain.
|
|
7
|
+
# Revert each pin once the corresponding PR merges:
|
|
8
|
+
# - https://github.com/metanorma/metanorma-document/pull/45
|
|
9
|
+
gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
|
|
10
|
+
gem "metanorma-document", github: "metanorma/metanorma-document", branch: "main"
|
|
11
|
+
gem "isodoc", github: "metanorma/isodoc", branch: "main" # merged as #825
|
|
12
|
+
gem "pubid", "~> 2.0.0.pre.alpha"
|
|
13
|
+
|
|
14
|
+
gem "canon"
|
|
15
|
+
gem "equivalent-xml"
|
|
16
|
+
gem "htmlentities"
|
|
17
|
+
gem "metanorma", github: "metanorma/metanorma", branch: "main"
|
|
18
|
+
gem "rake"
|
|
19
|
+
# Gemfile.devel may pin relaton-bib to a git branch (declaring the
|
|
20
|
+
# same gem twice aborts the rescued eval_gemfile silently)
|
|
21
|
+
gem "relaton-bib", "~>2.1" unless File.exist?(File.join(__dir__, "Gemfile.devel"))
|
|
22
|
+
gem "rspec"
|
|
23
|
+
gem "rubocop"
|
|
24
|
+
gem "rubocop-performance"
|
|
25
|
+
gem "simplecov"
|
|
26
|
+
gem "timecop"
|
|
27
|
+
gem "webmock"
|
|
8
28
|
|
|
9
29
|
eval_gemfile("Gemfile.devel") rescue nil
|
|
30
|
+
|
|
31
|
+
gem "metanorma-iso", github: "metanorma/metanorma-iso", branch: "main"
|
|
32
|
+
gem "metanorma-core", github: "metanorma/metanorma-core", branch: "main"
|
|
33
|
+
# leptris 1.9.359+ drops Declaration#to_xml and changes the validator
|
|
34
|
+
# surface (leptris#1733); pin the 1.9.356-era pair until leptris ships
|
data/Gemfile.devel
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gem "relaton-bib", github: "relaton/relaton-bib", branch: "feat/rfcxml-v3-export"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Task 1: Fix bibliography reference anchors using UUIDs instead of original IDs
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
When forward-transforming ADOC input with `[bibliography] == References * [[[RFC2119,Key Words]]] ...`, the reference anchor in RFC XML output is a UUID like `_302856a2-5468-3783-9d82-c075e1073e0b` instead of the expected `RFC2119`. This causes xml2rfc to emit:
|
|
5
|
+
```
|
|
6
|
+
Warning: Unused reference: There seems to be no reference to [_302856a2-...]
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Root Cause
|
|
10
|
+
The forward transformer's reference_transformer.rb likely doesn't extract the original `id` or anchor from the `<bibitem id="RFC2119">` element in semantic XML, instead generating a new UUID.
|
|
11
|
+
|
|
12
|
+
## Fix Location
|
|
13
|
+
`lib/metanorma/ietf/transformer/reference_transformer.rb` — the `transform_bibitem` or equivalent method that creates `<reference>` elements must use the bibitem's `id` attribute as the RFC XML `anchor`.
|
|
14
|
+
|
|
15
|
+
## Verification
|
|
16
|
+
- Run the full ADOC integration spec
|
|
17
|
+
- xml2rfc should have 0 warnings about unused references
|
|
18
|
+
- The `<reference anchor="RFC2119">` should appear in RFC XML output
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Task 2: Fix extract_paragraph_text to use `text` attribute (not `content`)
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
`extract_paragraph_text` in `inline_transformer.rb` calls `paragraph.content` but `ParagraphBlock` has no `content` attribute — it uses `text` (a string collection). This causes `NoMethodError` when forward-transforming MN XML that was produced by the reverse transformer (round-trip scenario).
|
|
5
|
+
|
|
6
|
+
## Root Cause
|
|
7
|
+
`ParagraphBlock` (from metanorma-document) maps `<p>` content to the `text` attribute (collection). The `content` attribute only exists on some other model types. The forward transformer was checking `content` first, which triggers lutaml-model's `method_missing` and raises.
|
|
8
|
+
|
|
9
|
+
## Fix Location
|
|
10
|
+
`lib/metanorma/ietf/transformer/inline_transformer.rb` — `extract_paragraph_text` method. Already partially fixed to use `paragraph.text`, but need to verify it's complete and no other callers depend on `content`.
|
|
11
|
+
|
|
12
|
+
## Status
|
|
13
|
+
Partially done — method was updated. Need to verify all callers work.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Task 3: Fix duplicate anchors and invalid anchor attributes in round-trip RFC XML
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
When round-tripping (RFC XML → reverse → forward → RFC XML), the output has:
|
|
5
|
+
1. **Duplicate anchors** — same UUID appearing on multiple elements (e.g., `_d36058ae...` on multiple `<t>` elements)
|
|
6
|
+
2. **Invalid `anchor` on `<t>`** — RFC XML v3 `<t>` element does NOT support `anchor` attribute, but the forward transformer is generating `<t anchor="...">`
|
|
7
|
+
|
|
8
|
+
xml2rfc errors:
|
|
9
|
+
```
|
|
10
|
+
Error: Invalid attribute anchor for element t, at /rfc/middle/section[1]/t[5]
|
|
11
|
+
Error: Duplicate xsd:ID attribute anchor="_d36058ae-..." found.
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Root Cause
|
|
15
|
+
The forward transformer's `transform_paragraph` (or `transform_t`) sets `anchor` on `<t>` elements. In RFC XML v3, only `<section>`, `<figure>`, `<table>`, `<ul>`, `<ol>`, `<references>` etc. support `anchor` — NOT `<t>`.
|
|
16
|
+
|
|
17
|
+
The duplicate anchors happen because the reverse transformer preserves IDs in the MN XML, and then the forward transformer re-applies those same IDs, but the MN XML model has `id` on `ParagraphBlock` which maps to both the paragraph's `id` AND gets used as an RFC anchor.
|
|
18
|
+
|
|
19
|
+
## Fix Location
|
|
20
|
+
1. `lib/metanorma/ietf/transformer/block_transformer.rb` — `transform_paragraph` must NOT set `anchor` on `<t>` elements
|
|
21
|
+
2. Check all element types in forward transformer that set `anchor` — verify they only do so for RFC v3 elements that support it
|
|
22
|
+
|
|
23
|
+
## Verification
|
|
24
|
+
- Round-trip example.xml through forward→reverse→forward→xml2rfc with exit 0 and 0 errors
|
|
25
|
+
- No "Invalid attribute anchor" errors
|
|
26
|
+
- No "Duplicate xsd:ID" warnings
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Task 4: Fix `<li>` containing `<t>` children in round-trip
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
xml2rfc error:
|
|
5
|
+
```
|
|
6
|
+
Error: Element li has extra content: t, at /rfc/middle/section[1]/ul[4]/li[1]/t
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
In RFC XML v3, `<li>` can contain `<t>` but the xml2rfc error suggests a structural issue. This happens in the round-trip output.
|
|
10
|
+
|
|
11
|
+
## Root Cause
|
|
12
|
+
The reverse transformer creates paragraph blocks inside list items. When forward-transforming back, those paragraphs become `<t>` inside `<li>`, but the surrounding structure may be wrong — e.g., the `<t>` should be a direct child of `<li>` but there might be extra wrapping, or the `<li>` has mixed content that isn't allowed.
|
|
13
|
+
|
|
14
|
+
Need to inspect the actual round-trip XML to see the exact structure.
|
|
15
|
+
|
|
16
|
+
## Fix Location
|
|
17
|
+
- Likely `lib/metanorma/ietf/transformer/list_transformer.rb` — how list items with paragraph children are transformed
|
|
18
|
+
- Possibly `lib/metanorma/ietf/transformer/rfc_v3_to_ietf/list_transformer.rb` — how reverse transformer creates list item content
|
|
19
|
+
|
|
20
|
+
## Verification
|
|
21
|
+
- Round-trip example.xml → xml2rfc exit 0
|
|
22
|
+
- No "Element li has extra content" errors
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Task 5: Write integration spec for Pipeline 1 (ADOC → RFC XML → xml2rfc)
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Verify that ADOC documents can be converted to semantic XML, parsed by metanorma-document, transformed to RFC XML v3, and accepted by xml2rfc with **no errors and no warnings**.
|
|
5
|
+
|
|
6
|
+
## Test Cases
|
|
7
|
+
1. Simple document (title, sections, paragraphs) — clean pass
|
|
8
|
+
2. Full document (abstract, intro, lists, tables, bibliography, BCP14 keywords, notes) — clean pass
|
|
9
|
+
3. Fixture documents (example.xml, antioch.xml) — clean pass
|
|
10
|
+
|
|
11
|
+
## Assertion Criteria
|
|
12
|
+
- `xml2rfc --text` exit code must be 0
|
|
13
|
+
- No "Error:" lines in xml2rfc output
|
|
14
|
+
- RFC XML must have `<rfc>`, `<front>`, `<middle>`, `<back>`
|
|
15
|
+
- Title, author, sections, metadata preserved correctly
|
|
16
|
+
|
|
17
|
+
## Current Status
|
|
18
|
+
DONE. Integration spec includes:
|
|
19
|
+
- Step-by-step pipeline tests (ADOC→XML, XML→model, model→RFC XML, RFC XML→xml2rfc)
|
|
20
|
+
- Fixture-based tests with shared examples
|
|
21
|
+
- Content preservation assertions for metadata, sections, lists, tables, BCP14, notes, bibliography
|
|
22
|
+
- 38 integration tests pass, 288 total specs pass with 0 failures
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Task 6: Write integration spec for Pipeline 2 (RFC XML → reverse → forward → xml2rfc)
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Verify that RFC XML v3 documents can be reverse-transformed to metanorma-document, then forward-transformed back to RFC XML v3, and the round-tripped RFC XML is accepted by xml2rfc with **no errors and no warnings**.
|
|
5
|
+
|
|
6
|
+
## Test Cases
|
|
7
|
+
1. Simple RFC XML (sections, paragraphs, lists, bibliography) — clean round-trip
|
|
8
|
+
2. Complex RFC XML (example.xml fixture forward output) — clean round-trip
|
|
9
|
+
3. Antioch.xml fixture forward output — clean round-trip
|
|
10
|
+
|
|
11
|
+
## Assertion Criteria
|
|
12
|
+
- `xml2rfc --text` on round-tripped RFC XML exit code must be 0
|
|
13
|
+
- No "Error:" lines
|
|
14
|
+
- No "Warning:" lines
|
|
15
|
+
- Round-tripped RFC XML must preserve: title, author, sections, references
|
|
16
|
+
- Content text must be preserved (no data loss)
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- Task 2 (fix extract_paragraph_text) — DONE
|
|
20
|
+
- Task 3 (fix duplicate anchors) — DONE
|
|
21
|
+
- Task 4 (fix li/t children) — DONE
|
|
22
|
+
|
|
23
|
+
## Current Status
|
|
24
|
+
DONE. Integration spec includes:
|
|
25
|
+
- Shared examples for fixture-based round-trip (example.xml, antioch.xml)
|
|
26
|
+
- ADOC-based full round-trip test (ADOC → RFC → reverse → forward → xml2rfc)
|
|
27
|
+
- All 38 integration tests pass, 288 total specs pass with 0 failures
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Task 7: Final verification — all specs pass
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Ensure all 275+ specs pass with 0 failures after all fixes.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
1. Run `bin/rspec` — all specs green
|
|
8
|
+
2. Run `bin/rspec spec/transformer/` — all transformer specs green
|
|
9
|
+
3. Run `bin/rspec spec/transformer/integration_spec.rb` — all integration specs green
|
|
10
|
+
4. Run rubocop if needed
|
|
11
|
+
|
|
12
|
+
## Acceptance Criteria
|
|
13
|
+
- `bin/rspec` returns 0 failures
|
|
14
|
+
- No regressions in existing specs
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Bug Report: Circular Autoload Dependency in Register Setup
|
|
2
|
+
|
|
3
|
+
**Severity:** High — prevents any non-ISO flavor from loading via `require "metanorma/document"`
|
|
4
|
+
|
|
5
|
+
**Affected file:** `lib/metanorma/registers/setup.rb` lines 14–15
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
`registers/setup.rb` defines module-level constants that trigger autoloads before the `Setup` module's methods are fully defined:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
module Metanorma
|
|
13
|
+
module Registers
|
|
14
|
+
module Setup
|
|
15
|
+
SD = Metanorma::StandardDocument # line 14 — triggers autoload of standard_document
|
|
16
|
+
ISO = Metanorma::IsoDocument # line 15 — triggers autoload of iso_document
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
def setup_iso_register # line 21 — not yet defined when line 15 autoloads iso_document.rb
|
|
20
|
+
...
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## How it breaks
|
|
29
|
+
|
|
30
|
+
1. `ietf_document.rb` line 11 calls `Metanorma::Registers::Setup.setup_ietf_register`
|
|
31
|
+
2. This triggers autoload of `registers/setup.rb`
|
|
32
|
+
3. Line 15: `ISO = Metanorma::IsoDocument` triggers autoload of `iso_document.rb`
|
|
33
|
+
4. `iso_document.rb` line 16: `Metanorma::Registers::Setup.setup_iso_register`
|
|
34
|
+
5. But `setup_iso_register` isn't defined yet — the `class << self` block hasn't been evaluated (still at line 15)
|
|
35
|
+
6. **`NoMethodError: undefined method 'setup_iso_register'`**
|
|
36
|
+
|
|
37
|
+
## Symmetric problem
|
|
38
|
+
|
|
39
|
+
Every `*_document.rb` file calls `Registers::Setup.setup_*_register` at load time. Any two flavors that are both referenced inside `setup.rb` will have this circular dependency. For example, if a new flavor's register setup references `Metanorma::IeeeDocument`, loading `ieee_document.rb` would trigger `setup.rb` which references `IsoDocument`, which calls `setup_iso_register` before it's defined.
|
|
40
|
+
|
|
41
|
+
## Current workaround
|
|
42
|
+
|
|
43
|
+
metanorma-ietf forces the loading order in its transformer.rb:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
require "metanorma/document"
|
|
47
|
+
|
|
48
|
+
# Force-load order to break the circular autoload
|
|
49
|
+
Metanorma::StandardDocument::Sections
|
|
50
|
+
Metanorma::IsoDocument::Sections
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This pre-resolves `Metanorma::IsoDocument` before `ietf_document.rb` references `Registers::Setup`, so when `setup.rb` loads, `ISO = Metanorma::IsoDocument` resolves without triggering a new autoload.
|
|
54
|
+
|
|
55
|
+
## Suggested fix
|
|
56
|
+
|
|
57
|
+
Move the module-level constants inside the methods that use them, or lazy-initialize them:
|
|
58
|
+
|
|
59
|
+
```ruby
|
|
60
|
+
module Metanorma
|
|
61
|
+
module Registers
|
|
62
|
+
module Setup
|
|
63
|
+
class << self
|
|
64
|
+
def setup_iso_register
|
|
65
|
+
sd = Metanorma::StandardDocument
|
|
66
|
+
iso = Metanorma::IsoDocument
|
|
67
|
+
reg = Lutaml::Model::Register.new(:iso_document)
|
|
68
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
69
|
+
|
|
70
|
+
reg.register_global_type_substitution(
|
|
71
|
+
from_type: sd::Sections::ClauseSection,
|
|
72
|
+
to_type: iso::Sections::IsoClauseSection,
|
|
73
|
+
)
|
|
74
|
+
# ... etc
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def setup_ietf_register
|
|
78
|
+
sd = Metanorma::StandardDocument
|
|
79
|
+
ietf = Metanorma::IetfDocument
|
|
80
|
+
reg = Lutaml::Model::Register.new(:ietf_document)
|
|
81
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
82
|
+
# ... etc
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This way, no autoloads are triggered at module-definition time, and the circular dependency is eliminated.
|
|
91
|
+
|
|
92
|
+
## Secondary issue: IETF content model gaps
|
|
93
|
+
|
|
94
|
+
While adapting the IETF transformer to the restructured metanorma-document, we found these model gaps. These are **not blockers** (we have workarounds), but they represent model design questions for the metanorma-document team:
|
|
95
|
+
|
|
96
|
+
### 1. `IetfContentSection` lacks `unnumbered` and `toc`
|
|
97
|
+
|
|
98
|
+
`IetfClauseSection` (extends `ClauseSection`) inherits `unnumbered` and `toc` from its base class. But `IetfContentSection` (extends `ContentSection`) does not have these attributes. In the IETF context, preface content sections can be unnumbered, so the forward transformer needs to check `unnumbered` on content sections too.
|
|
99
|
+
|
|
100
|
+
**Current workaround:** `rescue NoMethodError` guards in the forward transformer.
|
|
101
|
+
|
|
102
|
+
### 2. No IETF-specific term types
|
|
103
|
+
|
|
104
|
+
The `StandardDocument` base provides `Term`, `TermsSection`, `TermDefinition`, `TermExpression`, `TermNameElement`, and `Designation`. But IETF documents that include terminology need these same types. The reverse transformer uses `StandardDocument` base types instead of `IsoDocument` types (which is correct per the architecture), but there's no IETF-specific customization layer.
|
|
105
|
+
|
|
106
|
+
**Status:** Working with `StandardDocument` base types. No IETF-specific term model needed yet, but the metanorma-document team should be aware that IETF may need term model extensions in the future.
|
|
107
|
+
|
|
108
|
+
### 3. `Preface.content` type is `ContentSection`
|
|
109
|
+
|
|
110
|
+
The `Preface` model's `content` attribute is typed as `ContentSection`, which maps `"clause" → :subsection`. But some flavors (like IETF) put clause-like content in preface `content`. The register substitution `ContentSection → IetfContentSection` applies to all content items, including objects that behave more like `ClauseSection`. This causes attribute mismatch during serialization.
|
|
111
|
+
|
|
112
|
+
**Current workaround:** The reverse transformer creates `IetfContentSection` instances for preface content, which serializes correctly. But if richer clause features (amend, terms, definitions) are needed in preface content, the type system needs a more flexible approach.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 01: Bidirectional Transformer Architecture
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
The current transformer is one-directional: `IetfToRfcV3` only handles Metanorma XML → RFC XML v3. There is no reverse transformer. The architecture is a single monolithic class with 13 mixins, ~4,400 lines total, using private APIs and XML string manipulation.
|
|
6
|
+
|
|
7
|
+
## Design
|
|
8
|
+
|
|
9
|
+
### 1. Introduce `Transform` protocol module
|
|
10
|
+
|
|
11
|
+
Define a `Transform` module that both directions implement:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
module Metanorma::Ietf::Transformer
|
|
15
|
+
module Transform
|
|
16
|
+
# @param input [String] XML string
|
|
17
|
+
# @param options [Hash] transformation options
|
|
18
|
+
# @return [String] transformed XML string
|
|
19
|
+
def self.call(input, options = {})
|
|
20
|
+
raise NotImplementedError
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Split into two transformer classes under a common base
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
lib/metanorma/ietf/transformer/
|
|
30
|
+
base.rb # Shared utilities (ls_text, to_ncname, etc.)
|
|
31
|
+
ietf_to_rfc_v3.rb # Forward: Metanorma XML → RFC XML v3 (refactored)
|
|
32
|
+
rfc_v3_to_ietf.rb # Reverse: RFC XML v3 → Metanorma XML (NEW)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`Base` holds:
|
|
36
|
+
- `ls_text`, `extract_text`, `escape_xml_text`, `to_ncname`, `to_array`, `anchor_for`
|
|
37
|
+
- `build_organization` (shared between forward and reverse)
|
|
38
|
+
- No state (no `@doc`, `@xrefs`, etc.) — those belong to the concrete transformers
|
|
39
|
+
|
|
40
|
+
### 3. Refactor `IetfToRfcV3` to extend `Base`
|
|
41
|
+
|
|
42
|
+
Move shared helpers to `Base`. Keep the 13 existing modules but:
|
|
43
|
+
- Each module becomes a standalone class or remains a mixin — but no more `send` to private lutaml-model APIs
|
|
44
|
+
- Replace `NullBibdata`/`NullExt` with proper null objects (see TODO 04)
|
|
45
|
+
|
|
46
|
+
### 4. Create `RfcV3ToIetf` (reverse transformer)
|
|
47
|
+
|
|
48
|
+
New class extending `Base` with its own modules:
|
|
49
|
+
- `RfcV3ToIetf::Metadata` — RFC attributes → bibdata
|
|
50
|
+
- `RfcV3ToIetf::Front` — `<front>` → Metanorma front matter
|
|
51
|
+
- `RfcV3ToIetf::Section` — `<middle>`/`<back>` → Metanorma sections
|
|
52
|
+
- `RfcV3ToIetf::Block` — paragraphs, sourcecode, etc.
|
|
53
|
+
- `RfcV3ToIetf::Inline` — xref, eref, cref, etc.
|
|
54
|
+
- `RfcV3ToIetf::Table` — tables
|
|
55
|
+
- `RfcV3ToIetf::Figure` — figures/artwork
|
|
56
|
+
- `RfcV3ToIetf::List` — lists
|
|
57
|
+
- `RfcV3ToIetf::Term` — terms/definitions
|
|
58
|
+
- `RfcV3ToIetf::Reference` — bibliography
|
|
59
|
+
- `RfcV3ToIetf::Cleanup` — post-processing
|
|
60
|
+
|
|
61
|
+
### 5. Update entry point
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
module Metanorma::Ietf::Transformer
|
|
65
|
+
def self.convert(xml_string, direction: :forward, options = {})
|
|
66
|
+
case direction
|
|
67
|
+
when :forward then Forward.call(xml_string, options)
|
|
68
|
+
when :reverse then Reverse.call(xml_string, options)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Files to modify/create
|
|
75
|
+
|
|
76
|
+
| File | Action |
|
|
77
|
+
|------|--------|
|
|
78
|
+
| `lib/metanorma/ietf/transformer/base.rb` | NEW — shared utilities |
|
|
79
|
+
| `lib/metanorma/ietf/transformer/ietf_to_rfc_v3.rb` | Refactor to extend Base |
|
|
80
|
+
| `lib/metanorma/ietf/transformer/rfc_v3_to_ietf.rb` | NEW — reverse transformer |
|
|
81
|
+
| `lib/metanorma/ietf/transformer.rb` | Update entry point with direction parameter |
|
|
82
|
+
|
|
83
|
+
## Dependencies
|
|
84
|
+
|
|
85
|
+
- TODO 02 (private API encapsulation) must be done first
|
|
86
|
+
- TODO 04 (NullBibdata replacement) should be done before refactoring
|