metanorma-iso 3.5.28 → 3.5.30

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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +0 -1
  4. data/Gemfile +0 -1
  5. data/TODO.docx/P0-001-sectpr-header-footer-refs.md +3 -1
  6. data/TODO.docx/P0-002-sectpr-header-footer-refs-detail.md +6 -0
  7. data/TODO.docx/P0-003-body-sectpr-differences.md +3 -1
  8. data/TODO.docx/P0-004-body-sectpr-structure.md +19 -0
  9. data/TODO.docx/P0-005-word-unreadable-content.md +5 -2
  10. data/TODO.docx/P1-001-missing-images.md +3 -1
  11. data/TODO.docx/P1-002-figures-images-content.md +11 -0
  12. data/TODO.docx/P1-003-subfigure-descriptions.md +3 -0
  13. data/TODO.docx/P1-004-copyright-on-cover-page.md +15 -1
  14. data/TODO.docx/P1-005-copyright-address-block.md +12 -0
  15. data/TODO.docx/P1-006-duplicate-boilerplate.md +12 -3
  16. data/TODO.docx/P1-007-missing-page-breaks.md +3 -1
  17. data/TODO.docx/P1-008-missing-bookmarks-hyperlinks.md +36 -0
  18. data/TODO.docx/P1-009-bookmarks-hyperlinks-detail.md +36 -0
  19. data/TODO.docx/P1-010-normref-formatting.md +16 -0
  20. data/TODO.docx/P1-011-normref-footnote-markers.md +7 -2
  21. data/TODO.docx/P1-012-normref-style-and-markers.md +5 -4
  22. data/TODO.docx/P1-013-inline-math-omml.md +21 -4
  23. data/TODO.docx/P2-001-character-styles-gap.md +13 -0
  24. data/TODO.docx/P2-002-style-alignment-gaps.md +93 -2
  25. data/TODO.docx/P2-003-missing-rstyles.md +33 -1
  26. data/TODO.docx/P2-004-toc-entries-wiring.md +9 -2
  27. data/TODO.docx/P2-005-toc-tab-separator.md +16 -0
  28. data/TODO.docx/P2-006-cover-from-model.md +3 -1
  29. data/TODO.docx/P2-007-cover-page-structure.md +11 -0
  30. data/TODO.docx/P2-008-cover-page-detail.md +11 -0
  31. data/TODO.docx/P2-009-boilerplate-from-model.md +11 -41
  32. data/TODO.docx/P2-010-note-example-count.md +14 -35
  33. data/TODO.docx/P2-011-paragraph-count-mismatch.md +127 -25
  34. data/TODO.docx/P2-012-section-breaks-headers.md +19 -4
  35. data/TODO.docx/P2-013-list-item-style.md +11 -1
  36. data/TODO.docx/P2-014-xref-text-concatenation.md +13 -8
  37. data/TODO.docx/P2-015-fallback-chain-elimination.md +16 -0
  38. data/TODO.docx/P2-016-style-exclusion-list.md +7 -0
  39. data/TODO.docx/P3-001-sts-roundtrip-gaps.md +4 -0
  40. data/TODO.docx/P3-002-sts-gap-analysis.md +27 -16
  41. data/TODO.docx/P3-003-sts-spec-coverage.md +15 -0
  42. data/TODO.docx/P3-004-sts-missing-transformers.md +11 -0
  43. data/TODO.docx/P3-005-e2e-rice-spec.md +40 -14
  44. data/TODO.docx/P3-006-amendment-doctype.md +6 -1
  45. data/TODO.docx/P3-007-verify-word-opens.md +5 -1
  46. data/TODO.docx/P3-008-architecture-root-cause.md +9 -31
  47. data/data/generate_docx_spec_fixtures.rb +77 -0
  48. data/data/iso-dis/style_mapping.yml +226 -1
  49. data/data/iso-dis/styles.yml +45 -0
  50. data/data/iso-dis/template.docx +0 -0
  51. data/data/iso-simple/style_mapping.yml +8 -2
  52. data/data/iso-simple/styles.yml +76 -0
  53. data/data/iso-simple/template.dotx +0 -0
  54. data/data/relaton_core_shadow_fix.rb +12 -0
  55. data/lib/isodoc/iso/docx/adapter.rb +202 -7
  56. data/lib/isodoc/iso/docx/amendment_doctype.rb +35 -0
  57. data/lib/isodoc/iso/docx/bibdata_text.rb +35 -4
  58. data/lib/isodoc/iso/docx/boilerplate_renderer.rb +51 -38
  59. data/lib/isodoc/iso/docx/box_wrapper.rb +1 -0
  60. data/lib/isodoc/iso/docx/context.rb +87 -5
  61. data/lib/isodoc/iso/docx/core_properties_builder.rb +7 -4
  62. data/lib/isodoc/iso/docx/cover_renderer.rb +65 -5
  63. data/lib/isodoc/iso/docx/formula_renderer.rb +24 -3
  64. data/lib/isodoc/iso/docx/header_footer_renderer.rb +23 -23
  65. data/lib/isodoc/iso/docx/inline.rb +230 -8
  66. data/lib/isodoc/iso/docx/inline_renderers/bookmark_renderer.rb +3 -1
  67. data/lib/isodoc/iso/docx/inline_renderers/eref_renderer.rb +6 -5
  68. data/lib/isodoc/iso/docx/inline_renderers/fmt_xref_renderer.rb +1 -1
  69. data/lib/isodoc/iso/docx/inline_renderers/footnote_renderer.rb +30 -1
  70. data/lib/isodoc/iso/docx/inline_renderers/raw_paragraph_renderer.rb +6 -2
  71. data/lib/isodoc/iso/docx/inline_renderers/registry.rb +2 -0
  72. data/lib/isodoc/iso/docx/inline_renderers/xref_renderer.rb +1 -1
  73. data/lib/isodoc/iso/docx/math_conversion.rb +53 -15
  74. data/lib/isodoc/iso/docx/mhtml_parity.rb +182 -14
  75. data/lib/isodoc/iso/docx/middle_title_renderer.rb +37 -15
  76. data/lib/isodoc/iso/docx/model_utils.rb +25 -0
  77. data/lib/isodoc/iso/docx/preface_renderer.rb +5 -1
  78. data/lib/isodoc/iso/docx/renderers/admonition_renderer.rb +1 -0
  79. data/lib/isodoc/iso/docx/renderers/annex_renderer.rb +75 -0
  80. data/lib/isodoc/iso/docx/renderers/base.rb +75 -9
  81. data/lib/isodoc/iso/docx/renderers/bibliography_renderer.rb +2 -2
  82. data/lib/isodoc/iso/docx/renderers/clause_renderer.rb +17 -1
  83. data/lib/isodoc/iso/docx/renderers/definition_list_renderer.rb +75 -23
  84. data/lib/isodoc/iso/docx/renderers/figure_renderer.rb +18 -1
  85. data/lib/isodoc/iso/docx/renderers/list_item_content.rb +67 -0
  86. data/lib/isodoc/iso/docx/renderers/note_renderer.rb +5 -3
  87. data/lib/isodoc/iso/docx/renderers/ordered_list_renderer.rb +27 -19
  88. data/lib/isodoc/iso/docx/renderers/paragraph_renderer.rb +91 -4
  89. data/lib/isodoc/iso/docx/renderers/quote_renderer.rb +2 -0
  90. data/lib/isodoc/iso/docx/renderers/references_renderer.rb +4 -2
  91. data/lib/isodoc/iso/docx/renderers/section_renderer.rb +91 -4
  92. data/lib/isodoc/iso/docx/renderers/table_cell_element/base.rb +7 -3
  93. data/lib/isodoc/iso/docx/renderers/table_cell_element/cell_target.rb +3 -2
  94. data/lib/isodoc/iso/docx/renderers/table_cell_element/definition_list_handler.rb +92 -0
  95. data/lib/isodoc/iso/docx/renderers/table_cell_element/list_handler.rb +2 -2
  96. data/lib/isodoc/iso/docx/renderers/table_cell_element/registry.rb +15 -1
  97. data/lib/isodoc/iso/docx/renderers/table_cell_element.rb +1 -0
  98. data/lib/isodoc/iso/docx/renderers/table_column_widths.rb +60 -0
  99. data/lib/isodoc/iso/docx/renderers/table_footnotes.rb +70 -0
  100. data/lib/isodoc/iso/docx/renderers/table_renderer.rb +160 -32
  101. data/lib/isodoc/iso/docx/renderers/table_row_spans.rb +86 -0
  102. data/lib/isodoc/iso/docx/renderers/term_renderer.rb +18 -0
  103. data/lib/isodoc/iso/docx/renderers/unordered_list_renderer.rb +5 -13
  104. data/lib/isodoc/iso/docx/renderers.rb +4 -0
  105. data/lib/isodoc/iso/docx/section_manager.rb +62 -8
  106. data/lib/isodoc/iso/docx/style_mapping_validator.rb +8 -7
  107. data/lib/isodoc/iso/docx/style_resolver.rb +25 -6
  108. data/lib/isodoc/iso/docx/toc_builder.rb +110 -18
  109. data/lib/isodoc/iso/docx.rb +1 -0
  110. data/lib/isodoc/iso/docx_style_mapping.rb +8 -0
  111. data/lib/isodoc/iso/word_dis_convert.rb +5 -2
  112. data/lib/metanorma/iso/mathml4-content.rng +1568 -0
  113. data/lib/metanorma/iso/mathml4-presentation.rng +1448 -0
  114. data/lib/metanorma/iso/processor.rb +20 -3
  115. data/lib/metanorma/iso/sts/transformer/block_dispatcher.rb +25 -15
  116. data/lib/metanorma/iso/sts/transformer/dl_transformer.rb +2 -1
  117. data/lib/metanorma/iso/sts/transformer/document_transformer.rb +12 -3
  118. data/lib/metanorma/iso/sts/transformer/figure_transformer.rb +74 -14
  119. data/lib/metanorma/iso/sts/transformer/formula_transformer.rb +1 -1
  120. data/lib/metanorma/iso/sts/transformer/id_generator.rb +46 -3
  121. data/lib/metanorma/iso/sts/transformer/iso_meta_transformer.rb +15 -8
  122. data/lib/metanorma/iso/sts/transformer/list_transformer.rb +2 -2
  123. data/lib/metanorma/iso/sts/transformer/nbsp_processor.rb +1 -1
  124. data/lib/metanorma/iso/sts/transformer/paragraph_transformer.rb +80 -7
  125. data/lib/metanorma/iso/sts/transformer/reference_transformer.rb +82 -8
  126. data/lib/metanorma/iso/sts/transformer/section_transformer.rb +21 -28
  127. data/lib/metanorma/iso/sts/transformer/source_document.rb +8 -4
  128. data/lib/metanorma/iso/sts/transformer/source_order.rb +58 -0
  129. data/lib/metanorma/iso/sts/transformer/table_transformer.rb +2 -2
  130. data/lib/metanorma/iso/sts/transformer.rb +1 -0
  131. data/lib/metanorma/iso/validation/rules/asset_cited_first_rule.rb +8 -3
  132. data/lib/metanorma/iso/version.rb +1 -1
  133. data/lib/tasks/docx_parity.rake +6 -2
  134. data/metanorma-iso.gemspec +1 -1
  135. metadata +15 -4
@@ -1,12 +1,16 @@
1
1
  ---
2
2
  title: 108-005 - Add TOC entries
3
3
  priority: P1
4
- status: open
4
+ status: done
5
5
  depends_on: [108-001]
6
6
  ---
7
7
 
8
8
  # 108-005: Add TOC Entries
9
9
 
10
+ `6b771179` supplies TOC entries with a tab and a complete PAGEREF field. The DIS regression in `spec/isodoc/docx/toc_entries_spec.rb` checks the packaged fields and heading bookmarks through `Processor#output(..., :docx)`. Untitled clauses such as 4.2.1 and 4.2.2 are deliberately omitted because they have no heading. Foreword, Introduction, Normative references and Bibliography now have heading bookmarks. The Bibliography bookmark is on the `BiblioTitle` paragraph.
11
+
12
+ Before the bookmark fix, measurement-only conversions of the submitted ISO 5878 (20260429-fdis) and ISO 2533 (20260907, en) presentation XML produced 41 and 30 TOC entries respectively, each with four missing bookmark targets.
13
+
10
14
  ## Problem
11
15
 
12
16
  The latest output has only the "Contents" heading but no TOC entries. The reference has 26 entries:
@@ -50,4 +54,7 @@ Use Option A for accuracy — generate actual TOC entries matching the reference
50
54
 
51
55
  ## Files to Change
52
56
 
53
- - `lib/isodoc/iso/docx/adapter.rb` — add visit_toc method
57
+ - `lib/isodoc/iso/docx/toc_builder.rb` — omit entries for clauses without a heading
58
+ - `lib/isodoc/iso/docx/preface_renderer.rb` — bookmark the Foreword and Introduction headings
59
+ - `lib/isodoc/iso/docx/renderers/references_renderer.rb` — bookmark the Normative references heading
60
+ - `lib/isodoc/iso/docx/adapter.rb` — bookmark the Bibliography heading in `visit_references_section`
@@ -1,3 +1,7 @@
1
+ ---
2
+ status: done
3
+ ---
4
+
1
5
  # 07: TOC entries have section numbers stripped
2
6
 
3
7
  ## Symptom
@@ -67,3 +71,15 @@ ParagraphBuilder.
67
71
  Ensure the tab between autonum and title is preserved as a distinct
68
72
  `<w:r><w:tab/></w:r>` run, not merged with adjacent text. If the
69
73
  ParagraphBuilder's text normalization merges them, that's the bug.
74
+
75
+ ## Resolution
76
+
77
+ Stale: not reproducible on grind/1609 (19c1878f). A real conversion of
78
+ spec/fixtures/iso/is/document-en.dis.presentation.xml gives
79
+ `TOC1 "1 " "Scope" <TAB> "1"`, `TOC2 "4" "." "1 " "General, ..." <TAB> "1"`:
80
+ numbers present, a space between number and title, one tab (page number).
81
+ `6b771179` made the label-to-title separator a space on purpose (a tab there
82
+ overshoots the TOC style stop and jumps to the right-hand dot-leader stop,
83
+ metanorma-pdfa#119), so a tab between number and title is NOT the target.
84
+ Pinned by `spec/isodoc/docx/toc_entries_spec.rb` ("separates each entry's
85
+ section number from its title with a space").
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  title: 108-015 - Fix cover page rendering from model
3
3
  priority: P0
4
- status: open
4
+ status: done
5
5
  depends_on: [108-001]
6
6
  ---
7
7
 
8
8
  # 108-015: Render Cover Page from Model (Not Template)
9
9
 
10
+ The DIS fixture regression in `spec/isodoc/docx/adapter_spec.rb` verifies that the cover shows the document's own metadata, including “Second edition”, and that the generated DOCX omits the template's ISO 15926 cover text and ISO document variables.
11
+
10
12
  ## Problem
11
13
 
12
14
  The cover page content (doc number, title, TC/SC, edition, date, stage, warning) is currently rendered from the template DOCX content. This means:
@@ -72,3 +72,14 @@ The cover page layout differs significantly between output and reference. The re
72
72
 
73
73
  ## Location
74
74
  - `lib/isodoc/iso/docx/adapter.rb` — cover page rendering
75
+
76
+ ## Status (2026-11-20): DONE
77
+
78
+ Measured by converting a stage-30 (CD) presentation XML built from `spec/examples/rice.adoc` with the iso-simple template (the one stages below 40 select).
79
+
80
+ Cover paragraphs 0-12 (13 paragraphs, then the cover sectPr paragraph at 13) match the reference CD structure: `17301`, `ISO/CD 17301-1 (draft 2016-05-01)`, `TC 34/SC 4/WG 3`, `Second edition`, `Date: 2016-05-01`, one em-dash title paragraph, blank, `CD stage`, blank, `zzwarninghdr` (1), `zzwarning` (2), unstyled U+00A0 spacer. The copyright block (`zzCopyright`) starts after the cover sectPr.
81
+
82
+ - Compact cover: `CoverRenderer`, spec `cover_renderer_spec.rb` "compact cover for stages before DIS".
83
+ - Warning styles: `zzwarninghdr`/`zzwarning` in the iso-simple template (template.dotx, styles.yml, style_mapping.yml `warning_header`/`warning`). The iso-dis template has no such styles; DIS keeps Notice.
84
+ - Spacer: `BoilerplateRenderer#render_license` appends one nbsp paragraph after a license statement (none when there is no statement). Spec: boilerplate_renderer_spec.rb "#render_license on the simple (WD/CD) template" (4 examples; removing the spacer line turns the spacer example red).
85
+ - Copyright address consolidation is P1-005 (DONE).
@@ -69,3 +69,14 @@ The cover page has wrong paragraph structure compared to reference. Multiple dif
69
69
 
70
70
  ## Location
71
71
  - `lib/isodoc/iso/docx/adapter.rb` — `render_cover`, `render_copyright_block`, `extract_edition_text`
72
+
73
+ ## Status (2026-11-20): DONE
74
+
75
+ Measured by converting a stage-30 (CD) presentation XML built from `spec/examples/rice.adoc` with the iso-simple template (the one stages below 40 select).
76
+
77
+ Cover paragraphs 0-12 (13 paragraphs, then the cover sectPr paragraph at 13) match the reference CD structure: `17301`, `ISO/CD 17301-1 (draft 2016-05-01)`, `TC 34/SC 4/WG 3`, `Second edition`, `Date: 2016-05-01`, one em-dash title paragraph, blank, `CD stage`, blank, `zzwarninghdr` (1), `zzwarning` (2), unstyled U+00A0 spacer. The copyright block (`zzCopyright`) starts after the cover sectPr.
78
+
79
+ - Compact cover: `CoverRenderer`, spec `cover_renderer_spec.rb` "compact cover for stages before DIS".
80
+ - Warning styles: `zzwarninghdr`/`zzwarning` in the iso-simple template (template.dotx, styles.yml, style_mapping.yml `warning_header`/`warning`). The iso-dis template has no such styles; DIS keeps Notice.
81
+ - Spacer: `BoilerplateRenderer#render_license` appends one nbsp paragraph after a license statement (none when there is no statement). Spec: boilerplate_renderer_spec.rb "#render_license on the simple (WD/CD) template" (4 examples; removing the spacer line turns the spacer example red).
82
+ - Copyright address consolidation is P1-005 (DONE).
@@ -1,15 +1,21 @@
1
1
  ---
2
2
  title: 108-016 - Render boilerplate from model (copyright, license, address)
3
3
  priority: P0
4
- status: open
4
+ status: done
5
5
  depends_on: [108-001, 108-015]
6
6
  ---
7
7
 
8
8
  # 108-016: Render Boilerplate from Model
9
9
 
10
- ## Problem
10
+ ## Resolution
11
11
 
12
- The adapter does not render the boilerplate (copyright-statement, license-statement). The boilerplate is available in `model.boilerplate` but `visit_root` never visits it.
12
+ `BoilerplateRenderer` renders the model's license statements on the cover.
13
+ After the cover section break it renders copyright statements and the
14
+ copyright address, followed by legal and feedback statements. The adapter
15
+ then inserts the page break before Contents.
16
+
17
+ `spec/isodoc/docx/boilerplate_renderer_spec.rb` verifies the order in the
18
+ saved DOCX and checks the layout when legal and feedback are absent.
13
19
 
14
20
  ## Model Structure
15
21
 
@@ -45,43 +51,7 @@ Para: [zzWarning] "This document is not..."
45
51
  Para: [zzWarning] "Recipients of this draft..."
46
52
  ```
47
53
 
48
- ## Fix
49
-
50
- Add `visit_boilerplate` method:
51
-
52
- ```ruby
53
- def visit_boilerplate(boilerplate, doc)
54
- return unless boilerplate
55
-
56
- # License/warning goes on cover page (before sectPr)
57
- boilerplate.license_statement&.each do |stmt|
58
- visit_boilerplate_clause(stmt, doc, :license)
59
- end
60
-
61
- # After cover page sectPr, start copyright page
62
- doc.section_break # New page for copyright
63
-
64
- # Copyright block
65
- boilerplate.copyright_statement&.each do |stmt|
66
- visit_boilerplate_clause(stmt, doc, :copyright)
67
- end
68
- end
69
-
70
- def visit_boilerplate_clause(clause, doc, type)
71
- # Render title with appropriate style
72
- if clause.title
73
- style = type == :copyright ? :copyright_hdr : :warning_hdr
74
- para = build_paragraph(style: @resolver.paragraph_style(style))
75
- @inline_renderer.render(clause.title, para)
76
- doc << para
77
- end
78
-
79
- # Render content paragraphs
80
- walk_mixed_content(clause, doc)
81
- end
82
- ```
83
-
84
54
  ## Files to Change
85
55
 
86
- - `lib/isodoc/iso/docx/adapter.rb` — add visit_boilerplate, visit_boilerplate_clause
87
- - `data/iso-dis/style_mapping.yml` — add zzCopyrightHdr, zzWarning, zzwarninghdr mappings
56
+ - `lib/isodoc/iso/docx/boilerplate_renderer.rb`
57
+ - `spec/isodoc/docx/boilerplate_renderer_spec.rb`
@@ -1,45 +1,24 @@
1
1
  ---
2
2
  title: 108-018 - Fix note/example count mismatch
3
3
  priority: P2
4
- status: open
4
+ status: done
5
5
  ---
6
6
 
7
7
  # 108-018: Fix Note/Example Count Mismatch
8
8
 
9
- ## Problem
9
+ Reference source: `spec/fixtures/iso/is/document-en.dis.presentation.xml`.
10
10
 
11
- ### Notes:
12
- - Latest: 6 paragraphs with `Note` style
13
- - Reference: 15 paragraphs with `Note` style
11
+ - 9 notes with `Note` or `Noteindent`: one clause note, three table notes,
12
+ and five term notes. The three table notes render inside table cells.
13
+ - 1 figure note with `Figurenote`.
14
+ - 2 examples with `Example` or `Exampleindent`: one term example and the
15
+ annex example titled “Sample Code”.
16
+ - 15 definitions with `Definition`, all inside terms.
14
17
 
15
- ### Examples:
16
- - Latest: 2 paragraphs with `Example` style
17
- - Reference: 4 paragraphs with `Example` style
18
+ `spec/isodoc/docx/dis_note_example_spec.rb` matches each source element
19
+ to a separate styled paragraph using text from its first paragraph
20
+ or the Sample Code label. Bibliography status notes, footnotes, code
21
+ callouts, and definition lists are outside these counts.
18
22
 
19
- ### Definition:
20
- - Latest: 15 paragraphs with `Definition` style
21
- - Reference: 16 paragraphs with `Definition` style
22
-
23
- ## Possible Causes
24
-
25
- 1. **Note rendering**: The adapter renders notes via `visit_note`, but some notes may be:
26
- - Inside terms (termnote) — rendered via `render_term_notes`
27
- - Inside tables — not being rendered
28
- - Inside examples — nested notes
29
- - General notes in clause text
30
-
31
- 2. **Example rendering**: Some examples may have a `name` (fmt_name) that gets its own paragraph with Example style, plus the example body. The count suggests some examples are missing.
32
-
33
- 3. **Definition**: One definition paragraph is missing. Could be a term definition that's not being rendered.
34
-
35
- ## Investigation Needed
36
-
37
- 1. Count all `<note>` elements in the presentation XML
38
- 2. Count all `<example>` elements in the presentation XML
39
- 3. Trace which ones are rendered vs skipped in the adapter
40
- 4. Check if table notes and example notes are being rendered
41
-
42
- ## Files to Change
43
-
44
- - `lib/isodoc/iso/docx/adapter.rb` — visit_note, visit_example, render_term_notes
45
- - `lib/isodoc/iso/docx/inline.rb` — note/example rendering
23
+ The historical `spec/examples/rice.docx` includes table footnotes and
24
+ code callouts in its style totals and has different definition content.
@@ -1,25 +1,127 @@
1
- # 071: Fix Paragraph Count Mismatch (291 vs 349)
2
-
3
- ## Problem
4
- The output has 291 body paragraphs while the reference has 349. That's 58 fewer paragraphs — a significant content loss. This is a combination of all the other issues.
5
-
6
- ## Breakdown of missing paragraphs:
7
- | Issue | Missing paras | Notes |
8
- |-------|--------------|-------|
9
- | TOC entries | ~26 | Full TOC with page numbers |
10
- | Annex headings | ~10 | 5 annexes × 2 paragraphs each (label + title) |
11
- | Annex separators | ~5 | Empty paragraphs before annex headings |
12
- | Missing preamble text | ~4 | Terms section preambles |
13
- | Missing figure content | ~5 | Key, NOTE, sub-figure descriptions |
14
- | Missing Annex D table | ~5 | Table rows for interlab test results |
15
- | Extra in cover page | ~-6 | Cover is longer, offsetting some loss |
16
- | **Total** | **~58** | Matches observed delta |
17
-
18
- ## Fix
19
- Fix each individual issue (059-070) and the paragraph count will naturally match.
20
-
21
- ## Priority
22
- **SUMMARY** — This is the aggregate metric of all other issues.
23
-
24
- ## Location
25
- - See individual issues 059-070
1
+ ---
2
+ title: P2-011 - Paragraph count mismatch
3
+ priority: P2
4
+ status: done
5
+ ---
6
+
7
+ # P2-011: Paragraph count mismatch
8
+
9
+ ## Closed (2026-11-20): recorded layout choice
10
+
11
+ Closed by decision. On rice the totals match (515 = 515); the remaining
12
+ +16 body / -16 table-cell split is the layout choices listed below (figure
13
+ key as body paragraphs, footnotes in `footnotes.xml`, admonition wrappers)
14
+ plus edition content. None is a renderer defect, and the paragraph count is
15
+ not an oracle. Open items stay on their own cards (P1-003, P2-007, P1-005,
16
+ P2-010).
17
+
18
+ ## Re-measurement on base 6455ca2f (2026-11-19, batches 3-4)
19
+
20
+ Same method (rice.presentation.xml through `Processor#output(..., :docx)`,
21
+ reference `spec/examples/rice.docx`, body children plus `w:tc` paragraphs).
22
+
23
+ | | 7774b78e output | 6455ca2f output | reference | delta now |
24
+ |---|---|---|---|---|
25
+ | body paragraphs | 353 | 365 | 349 | +16 |
26
+ | table-cell paragraphs | 150 | 150 | 166 | -16 |
27
+ | total | 503 | 515 | 515 | 0 |
28
+
29
+ The totals now match, but by cancellation, not by correctness: the body
30
+ excess (+16) and the table deficit (-16) are the same structural choices
31
+ listed below. Batches 3-4 added 12 body paragraphs since 7774b78e; the
32
+ diff of the paragraph sequences (text, 243 differing paragraphs each way)
33
+ shows they are the items already classified, not new defects:
34
+
35
+ - Annex C figure key and legend: output emits KeyTitle/KeyText body
36
+ paragraphs, the reference puts them in a table (about +10 body, -10 table);
37
+ the reference table-cell paragraphs also hold the Annex E callout key
38
+ (3) and the Table 2/3 footnote bodies (`aOrganic ...`, `b`, `c`, `d`,
39
+ `aParboiled rice.`; text is in `footnotes.xml` in the output, -5).
40
+ - Admonition wrappers (Box-begin, Warningtitle, Warningtext, Box-end) +6 vs
41
+ one reference paragraph.
42
+ - Edition content (CD 2016 vs DIS 2023): reference-only patent notice (6
43
+ paragraphs), cover warning block (4), third IEC Electropedia link block,
44
+ two more bibliography entries; output-only 5 list items, DIS cover
45
+ metadata lines, bilingual title (P2-007), the extra `brown rice`
46
+ admitted-term paragraph and the Foreword feedback paragraph.
47
+ - Empty body paragraphs: output 28, reference 19 (Box-begin/Box-end,
48
+ formula spacers, KeyTitle for stem-only terms), unchanged judgement.
49
+
50
+ Verdict: no bounded renderer bug found in an unowned area, so no code was
51
+ changed. The belief "remaining gap is edition difference plus known design
52
+ choices" holds for the paragraph count; the count is not an oracle. The
53
+ remaining actionable items stay with their cards: P1-003 (figure key and
54
+ sub-figures), P2-007 (cover/title), P1-005 (copyright address), P2-010
55
+ (example label), and the BUG 020 judgement item below.
56
+
57
+ ## Re-measurement on base 7774b78e (2026-11-19)
58
+
59
+ Source `spec/examples/rice.presentation.xml` converted with
60
+ `Metanorma::Iso::Processor#output(..., :docx)`; reference is the committed
61
+ `spec/examples/rice.docx`. Paragraphs counted structurally (body children,
62
+ table cell paragraphs counted once, nested tables not double counted).
63
+
64
+ | | output | reference | delta |
65
+ |---|---|---|---|
66
+ | body paragraphs | 353 | 349 | +4 |
67
+ | table-cell paragraphs | 150 | 166 | -16 |
68
+ | total | 503 | 515 | -12 |
69
+
70
+ The card's "291 vs 349" is stale: the body count is now above the
71
+ reference. The remaining total gap is 12, not 58.
72
+
73
+ Caveat: `rice.docx` is a Word-authored ISO/CD 17301-1 (2016, second edition);
74
+ the presentation XML is ISO/DIS 17301-1:2023 (third edition). Text and
75
+ structure differ by edition, so a paragraph diff cannot be driven to zero
76
+ and is not a renderer-correctness oracle.
77
+
78
+ Per section, body (output - reference): cover +2, TOC -1, foreword +1,
79
+ introduction -3, terms -3, specs -2, clauses 6-9 +9, Annex A -1, B -4,
80
+ C +11, D -1, E -2, bibliography -2 (sum +4).
81
+
82
+ ## Classified differences (output minus reference)
83
+
84
+ | Cause | Count | Example | Owner / verdict |
85
+ |---|---|---|---|
86
+ | Edition content differs (CD 2016 vs DIS 2023) | about -4 net | patent notice paragraphs in the reference introduction; 5 list items "method; test material; ..." only in output; 2 more references in reference bibliography | not a bug |
87
+ | Cover and middle title (bilingual DIS title) | +4 | `Reference number of working document: 17301`; MainTitle1/2 twice | P2-007, not touched |
88
+ | Copyright address emitted twice (`zzCopyright` plus `zzCopyrightaddress`) | +1 | `ISO copyright office CP 401 ...` | P1-005 / boilerplate, not touched |
89
+ | Word-native footnotes instead of footnote paragraphs below table and figure | -6 | `aOrganic extraneous matter includes foreign seeds...` (text is present in footnotes.xml) | design, kept |
90
+ | Number-only inline-header sub-clauses dropped by design (BUG 020) | -7 | `4.2.1`, `4.2.2`, `B.5.1` to `B.5.5` | judgement, see below |
91
+ | Annex `variant-title-toc` hidden paragraphs absent | -5 | `Annex CGelatinization` | toc_builder lane |
92
+ | Admonition box wrappers (Box-begin, Warningtitle, Warningtext, Box-end) vs one paragraph | +6 | `WARNING - Only use paddy or parboiled rice...` | style choice |
93
+ | Example label and body as two paragraphs | +2 | `EXAMPLE` / `Foreign seeds, husks, bran, sand, dust.` | P2-010 territory |
94
+ | Figure key as KeyTitle/KeyText paragraphs; reference uses a table | +10 body, -10 table, net 0 | Figure C.1 key | P1-003 / figure lane |
95
+ | Sub-figures a), b), c) as Figuretitle paragraphs | part of Annex C +11 | `a) Initial stages ...` | P1-003, not touched |
96
+ | Code callout paragraph vs callout table | about +1 | `This is an annotation` | style choice |
97
+ | Empty body paragraphs | output 28, reference 21 | | see below |
98
+
99
+ Rows are measured from a sequence diff of paragraph text and styles; the
100
+ per-row counts are approximate where text differs by edition. Only the
101
+ three totals and the per-section sum are exact.
102
+
103
+ ## Word-specific spacer paragraphs
104
+
105
+ The reference has 19 unstyled blank paragraphs (Word page and section
106
+ spacing); the output has 10 plus 18 styled empties (Box-begin/Box-end,
107
+ KeyTitle for stem-only terms, Formula). Do not reproduce the spacers: the
108
+ output uses page-break and spacing properties, and adding blanks would
109
+ raise the count without changing the layout.
110
+
111
+ ## Fix status
112
+
113
+ No simple renderer bug in an unowned file was found. Rendered text
114
+ losses seen while diffing (`paddy (3.1)` cross-reference text) are inline
115
+ xref issues, not paragraph-count causes, and belong to the hyperlink lane.
116
+ The ± in `100 mm ± 5 mm` is NOT lost: it is a lone-operator inline stem
117
+ rendered as `<m:oMath><m:r><m:t>±</m:t></m:r></m:oMath>` between the `w:t`
118
+ runs (measured on rice DOCX, pinned in stem_renderer_spec.rb). A `w:t`-only
119
+ text extractor does not see it.
120
+
121
+ Open judgement item: BUG 020 skips the heading paragraph of untitled
122
+ inline-header sub-clauses, which also drops the clause number (4.2.1 and
123
+ similar) from the document. A fix would prefix the number as a run on the
124
+ first body paragraph (as the ISO HTML does), not emit a heading. It
125
+ touches `inline.rb` and `section_renderer.rb`, and is guarded by
126
+ `adapter_spec.rb` BUG 020 and `toc_entries_spec.rb`, so it needs a
127
+ decision rather than a drive-by change.
@@ -25,11 +25,26 @@ rId32/rId33 while the document_rels used rId12/rId13 — mismatch caused
25
25
  Fix: `wire_parts_to_rels` now calls `allocator.alloc_rid` when allocator is
26
26
  present, so the rIds match the allocator's records and survive integrity checks.
27
27
 
28
- ## Remaining work
29
- - Multiple section breaks between major sections (cover, body, annex)
30
- - Per-section header/footer content (document ref, page number)
31
- - Preserve template page margins instead of hardcoding
28
+ ## Remaining work — DONE (2026-11-19)
29
+ - Section breaks: already present (cover, front matter, body) via
30
+ `SectionManager`; measured on rice output: 3 sectPr, cover/front in pPr,
31
+ body final. Annexes stay in the body section, as in the 2016 reference
32
+ (no annex break; annex headers are not a DIS requirement).
33
+ - Per-section header/footer: already wired (cover blank parts, front and body
34
+ template parts rewritten with document ref and PAGE field).
35
+ - Template margins: front matter and body sectPr now take pgMar from the DIS
36
+ template's own section 2 and 3 (left/right 851, bottom 567, footer 283)
37
+ instead of the hardcoded 1077/720. The cover keeps the reference-style
38
+ layout (851/737, gutter 567); the template's cover sectPr is a plain page.
39
+ Falls back to the old constants when a template has no such section.
40
+ - Proof: `section_manager_spec.rb` DIS example expects template margins; with
41
+ the template lookup replaced by the constants it fails (got 1077/720/720).
32
42
 
33
43
  ## Files
34
44
  - `lib/isodoc/iso/docx/adapter.rb` — `apply_final_section`, `apply_header_footer`
35
45
  - `lib/uniword/docx/reconciler/body.rb` — `wire_parts_to_rels` uses allocator
46
+
47
+ ### Re-measured on batch4 tip 6455ca2f (2026-11-19, no code change)
48
+ rice output has 3 sectPr (cover and front matter in pPr, body final), same
49
+ count and order as spec/examples/rice.docx. Cover, front and body each carry
50
+ header/footer references (reference body has footers only). Nothing left to do.
@@ -1,6 +1,6 @@
1
1
  # 12: List item style is wrong
2
2
 
3
- ## Status: PENDING
3
+ ## Status: DONE
4
4
 
5
5
  ## Symptom
6
6
 
@@ -14,3 +14,13 @@ Investigate UnorderedListRenderer and the style it assigns to list
14
14
  item paragraphs. Check the style mapping YAML for `:list_paragraph`
15
15
  and `:list_continue_1` to ensure they map to the correct DIS
16
16
  template style.
17
+
18
+ ## Proof (2026-11-19)
19
+
20
+ Already fixed by #1798 (ListContinue1..4 / ListNumber1..4 by depth) and
21
+ #1808 (ordered list numbering). On origin/grind/1609 (19c1878f), converting
22
+ `spec/examples/rice.presentation.xml` yields 12 top-level bullet paragraphs,
23
+ all `ListContinue1`, numId 3 (dash), ilvl 0, matching REF-001 row
24
+ "bullet / — / ListContinue1 / 3". `list_paragraph` maps to BodyText but no
25
+ list item uses it. Pinned by the rice example in
26
+ `spec/isodoc/docx/renderers/unordered_list_renderer_spec.rb`.
@@ -1,13 +1,18 @@
1
1
  # 020 — Fix cross-reference text concatenation
2
2
 
3
- ## Status: KNOWN BUG (also in REF)
3
+ ## Status: NOT REPRODUCIBLE in the DOCX adapter output (2026-11-19)
4
4
 
5
- Cross-references concatenate with adjacent text: `"3.1husked rice"`,
6
- `"Note13.5,Note1"`, `").B.3.2B.3.1"`.
5
+ The card reported cross-references concatenating with adjacent text:
6
+ `"3.1husked rice"`, `"Note13.5,Note1"`, `").B.3.2B.3.1"`.
7
7
 
8
- This is a presentation XML issue — the formatted text includes both the
9
- xref label and adjacent content in the same element. The inline renderer
10
- faithfully renders the content as-is.
8
+ Measured on the rice sample (`spec/examples/rice.presentation.xml`) through
9
+ the adapter: no hyperlink edge touches alphanumeric text without the source
10
+ spacing, and the strings come from joining separate paragraphs (TermNum
11
+ `3.1` and Terms `paddy` are different `w:p`) or table cells in a flat text
12
+ dump, not from xref runs. `(B.3.2) ... (B.3.1)` renders with its spaces and
13
+ punctuation intact. No code change needed; behaviour is pinned by
14
+ `spec/isodoc/docx/xref_spacing_spec.rb`.
11
15
 
12
- Both the old pipeline (REF) and our adapter have this behavior. Fix would
13
- require changes to the presentation XML generation, not the DOCX adapter.
16
+ Side observation (not a pipeline case): a bare `<fmt-xref>` directly under
17
+ `<p>`, without the `<semx element="xref">` wrapper that presentation XML
18
+ always emits, renders no text at all.
@@ -122,3 +122,19 @@ has TOC1..TOC9, so all level lookups succeed.
122
122
  `BiblioEntry` if at entry level).
123
123
  - `toc_builder_spec.rb` (extend):
124
124
  - TOC level 1 uses `TOC1` from YAML, no string fallback.
125
+
126
+ ## Status: DONE (2026-11-19)
127
+
128
+ Re-located chains on base 6455ca2f; the table lines above are stale.
129
+ - `grep -E 'paragraph_style\([^)]+\)\s*\|\|' lib/isodoc/iso/docx/` = 0 matches
130
+ (the `ref_norm`/`normref`, `biblio_entry`/`list_paragraph`, `normref`/`body_text`
131
+ and TOC chains were already gone).
132
+ - Last chain removed: `StyleResolver#heading_style` (`annex_heading_style(level) ||
133
+ heading_style(level)`). Both templates now map `annex_heading1: Heading1`
134
+ explicitly (`data/iso-dis` and `data/iso-simple` style_mapping.yml). Rice never
135
+ reached the fallback (traced); level 1 inside an annex uses `:annex`.
136
+ - Kept, not a fallback: `figure_title_annex`/`table_title_annex` are selected by
137
+ `in_annex` (iso-simple maps them to distinct AnnexFigureTitle/AnnexTableTitle;
138
+ DIS maps them equal) - a context key choice with one lookup, no `||`.
139
+ - Output: rice `document.xml` before/after, DIS and Simple, identical except random
140
+ image `docPr` ids/names.
@@ -167,3 +167,10 @@ end
167
167
  - Each pattern matches expected sample.
168
168
  - No value in `paragraph_styles` / `character_styles` matches an
169
169
  excluded pattern.
170
+
171
+ ## Status: DONE — `DocxStyleMapping#excluded?`, `StyleMappingValidator#excluded_styles_in_mapping`, globs added to iso-dis style_mapping.yml, `excluded_styles_ref` header; specs in style_mapping_spec.rb and style_mapping_validator_spec.rb green, integrity spec confirms zero leaks.
172
+
173
+ Follow-up (#1728 P2-016 pass): the loader reads only `excluded_styles` `globs` and `style_ids`, so the nested category layout above is inert and was NOT used. Audit-listed names were added as flat globs under `globs`, grouped by category, excluding any name that matches a currently mapped style. Not added: `BodyTextindent[0-9]+` (lowercase; matches mapped `BodyTextindent1`) and bare `*Char` (matches universal `BodyTextChar`). New spec: `spec/isodoc/docx/style_mapping_excluded_styles_spec.rb` (red proof: mapping `note` to `GridTable1Light` fails it; restored, green).
174
+
175
+ ## Known follow-up (2026-11-19)
176
+ - StyleResolver::SPAN_CLASS_TO_STYLE still emits span style ids that match excluded globs: stdpublisher0, stddocnumber, stdyear, stddoctitle, stddocpartnumber, stdpublisher, citesec, citeapp, citefig, citetbl, notelabel, termnotelabel, examplelabel, boldtitle, nonboldtitle. None is defined in the DIS template, so these runs get no rStyle today and output is unchanged. The exclusion list is only checked against mapping values, not this table. "stem" alone was removed from the globs (commit "restore annex heading fallback, unexclude stem").
@@ -73,3 +73,7 @@ expect(generated).to be_xml_equivalent_to(doc)
73
73
  ```
74
74
 
75
75
  All 17+ reference files pass this test.
76
+
77
+ ## Status (2026-11-20)
78
+
79
+ DONE (measured). In a worktree of metanorma/sts-ruby origin/main (8279d6b), `bundle exec rspec spec/round_trip/reference_docs_spec.rb` over the 17 reference files (2 ISO STS, 15 NISO STS) gave 34 examples, 0 failures, 0 pending (PENDING_FILES is empty); each file passes both "parses without error" and "round-trips without data loss". The harness (Steps 1-2) already exists on sts-ruby main; no open sts-ruby PRs. Caveats: the comparison strips processing instructions before comparing (lutaml-model drops them), so the PI sub-item (item 13) is waived, not proven; the 17 files came from a local mn-samples-iso-private checkout at a different commit than the submodule pointer in sts-ruby origin/main. Count of files: 17. Remaining: 0 files failing.
@@ -4,6 +4,8 @@
4
4
 
5
5
  Comparing elements found in reference STS XML vs sts-ruby model classes.
6
6
 
7
+ Status: 16 "Verify mapping" rows checked against sts-ruby origin/main (8279d6b): 14 mapped, 2 gaps (`target`, `named-content` in `Paragraph`).
8
+
7
9
  ### Front (iso-meta) — Sts::IsoSts::IsoMeta
8
10
 
9
11
  | STS Element | sts-ruby Class | Status |
@@ -14,18 +16,18 @@ Comparing elements found in reference STS XML vs sts-ruby model classes.
14
16
  | `title-wrap/compl` | `TitleCompl` | Present |
15
17
  | `title-wrap/full` | `TitleFull` | Present |
16
18
  | `doc-ident` | `DocumentIdentification` | Present |
17
- | `doc-ident/sdo` | — | Verify mapping |
18
- | `doc-ident/proj-id` | — | Verify mapping |
19
- | `doc-ident/language` | — | Verify mapping |
20
- | `doc-ident/release-version` | — | Verify mapping |
21
- | `doc-ident/urn` | — | Verify mapping |
19
+ | `doc-ident/sdo` | `Sdo` (lib/sts/iso_sts/document_identification.rb:18) | Mapped |
20
+ | `doc-ident/proj-id` | `ProjId` (lib/sts/iso_sts/document_identification.rb:19) | Mapped |
21
+ | `doc-ident/language` | `Language` (lib/sts/iso_sts/document_identification.rb:20) | Mapped |
22
+ | `doc-ident/release-version` | `ReleaseVersion` (lib/sts/iso_sts/document_identification.rb:21) | Mapped |
23
+ | `doc-ident/urn` | `Urn` (lib/sts/iso_sts/document_identification.rb:22) | Mapped |
22
24
  | `std-ident` | `StandardIdentification` | Present |
23
- | `std-ident/originator` | — | Verify mapping |
24
- | `std-ident/doc-type` | — | Verify mapping |
25
- | `std-ident/doc-number` | — | Verify mapping |
26
- | `std-ident/part-number` | — | Verify mapping |
25
+ | `std-ident/originator` | `Originator` (lib/sts/iso_sts/standard_identification.rb:22) | Mapped |
26
+ | `std-ident/doc-type` | `DocType` (lib/sts/iso_sts/standard_identification.rb:23) | Mapped |
27
+ | `std-ident/doc-number` | `DocNumber` (lib/sts/iso_sts/standard_identification.rb:24) | Mapped |
28
+ | `std-ident/part-number` | `PartNumber` (lib/sts/iso_sts/standard_identification.rb:25) | Mapped |
27
29
  | `std-ident/edition` | `Edition` | Present |
28
- | `std-ident/version` | — | Verify mapping |
30
+ | `std-ident/version` | `Version` (lib/sts/iso_sts/standard_identification.rb:27) | Mapped |
29
31
  | `content-language` | `NisoSts::ContentLanguage` | Present |
30
32
  | `std-ref[@type]` | `StdRef` | Present |
31
33
  | `doc-ref` | `DocRef` | Present |
@@ -42,9 +44,9 @@ Comparing elements found in reference STS XML vs sts-ruby model classes.
42
44
  | `permissions/copyright-year` | `CopyrightYear` | Present |
43
45
  | `permissions/copyright-holder` | `CopyrightHolder` | Present |
44
46
  | `custom-meta-group` | `NisoSts::CustomMetaGroup` | Present |
45
- | `custom-meta-group/custom-meta` | — | Verify mapping |
46
- | `custom-meta/meta-name` | — | Verify mapping |
47
- | `custom-meta/meta-value` | — | Verify mapping |
47
+ | `custom-meta-group/custom-meta` | `CustomMeta` (lib/sts/iso_sts/custom_meta_group.rb:14) | Mapped |
48
+ | `custom-meta/meta-name` | `MetaName` (lib/sts/iso_sts/custom_meta.rb:31) | Mapped |
49
+ | `custom-meta/meta-value` | `MetaValue` (lib/sts/iso_sts/custom_meta.rb:32) | Mapped |
48
50
  | `is-proof` | `NisoSts::IsProof` | Present |
49
51
 
50
52
  ### Body — Sts::IsoSts::Body / Sts::IsoSts::Sec
@@ -98,7 +100,7 @@ Comparing elements found in reference STS XML vs sts-ruby model classes.
98
100
  | `tbx:see` | `TbxIsoTml::See` | Present |
99
101
  | `tbx:entailedTerm` | `TbxIsoTml::EntailedTerm` | Present |
100
102
  | `tbx:subjectField` | `TbxIsoTml::SubjectField` | Present |
101
- | `tbx:usageNote` | — | Verify mapping |
103
+ | `tbx:usageNote` | `TermInformationGroup#usage_note`, string (lib/sts/tbx_iso_tml/term_information_group.rb:26) | Mapped |
102
104
  | `tbx:grammaticalGender` | `TbxIsoTml::GrammaticalGender` | Present |
103
105
  | `tbx:grammaticalNumber` | `TbxIsoTml::GrammaticalNumber` | Present |
104
106
  | `tbx:pronunciation` | `TbxIsoTml::Pronunciation` | Present |
@@ -143,8 +145,8 @@ Comparing elements found in reference STS XML vs sts-ruby model classes.
143
145
  | `inline-formula` | `InlineFormula` | Present |
144
146
  | `fn` | `TbxIsoTml::Fn` | Present |
145
147
  | `break` | `Break` | Present |
146
- | `target` | — | Verify mapping |
147
- | `named-content` | — | Verify mapping |
148
+ | `target` | `Target` class exists (lib/sts/iso_sts/target.rb), but not mapped in `Paragraph` (lib/sts/{iso,niso}_sts/paragraph.rb); dropped on round trip | Gap |
149
+ | `named-content` | `NamedContent` class exists (lib/sts/iso_sts/named_content.rb), but not mapped in `Paragraph` (lib/sts/{iso,niso}_sts/paragraph.rb); dropped on round trip | Gap |
148
150
  | `graphic` (inline) | `Graphic` | Present |
149
151
  | `mml:math` | `Mathml2::Math` | Present |
150
152
 
@@ -173,3 +175,12 @@ Without proper ordered/mixed content support, the text nodes, bold, and xref wou
173
175
  3. For each failure: identify the missing/wrong model attribute
174
176
  4. Fix the model
175
177
  5. Re-run until all pass
178
+
179
+ ## Status (2026-11-20)
180
+
181
+ CLOSED on the card's own scope, with one dependency follow-up outside this repo.
182
+
183
+ - Execution order (harness, run, fix, rerun): 17 of 17 reference files round-trip in sts-ruby main (34 examples, 0 failures), as recorded under P3-001.
184
+ - The 14 "Mapped" rows: every `lib/sts/...rb:LINE` reference in this card was read in sts-ruby origin/main (da0c5e6) and in the installed sts 0.6.14 gem; all 14 lines are the `map_element` for the named element, in both. Command: `grep -o 'lib/sts/[a-z_/]*\.rb:[0-9]*' <this card> | sort -u`, then `git show origin/main:<file> | sed -n <line>p`.
185
+ - The 2 gaps (`target`, `named-content` in `Paragraph`): mapped in sts-ruby origin/main (da0c5e6): lib/sts/iso_sts/paragraph.rb:88-89 and lib/sts/niso_sts/paragraph.rb:76-77, commit 7fc8f84. NOT in a release: `git merge-base --is-ancestor 7fc8f84 v0.6.14` fails and `git tag --contains da0c5e6` lists no tag; the installed sts 0.6.14 (the version `metanorma-iso.gemspec` allows, `~> 0.6.14`) has no such mapping and drops both on a round trip: `Sts::IsoSts::Standard.from_xml('<standard><body><sec><p>a <named-content content-type="x">nc</named-content> <target id="t1"/> b</p></sec></body></standard>').to_xml` yields `<p>a b</p>`.
186
+ - Remaining outside this card: a sts release that includes 7fc8f84, then a dependency bump here (not done: no version bumps in a feature branch). The converter does not emit `target` or `named-content` today, so no output of this repo is affected.
@@ -149,3 +149,18 @@ end
149
149
  - [ ] Each transformer has unit tests covering happy path and edge cases
150
150
  - [ ] At least 3 end-to-end tests with real documents
151
151
  - [ ] All tests pass in CI (`bundle exec rake`)
152
+
153
+ ## Status (2026-11-20)
154
+
155
+ Phase 1 DONE: spec/round_trip/reference_docs_spec.rb exists in sts-ruby main and passes (34 examples, 0 failures; 17 files).
156
+
157
+ Phase 2, measured on this branch:
158
+
159
+ - Transformer files: 30 in lib/metanorma/iso/sts/transformer. 27 have a spec of the same name in spec/sts/transformer/ (28 spec files there; this change adds 7: footnote_collector, id_generator, nbsp_processor, provision_index, rendered_text_extractor, source_document, source_order). The other 3 are specified under a different file name: document_transformer in spec/sts/transformer/transformer_spec.rb:19, model_builder in spec/sts/std_meta_spec.rb:72 and :97, requirement_transformer in spec/sts/requirement_table_spec.rb:14.
160
+ - The spec file names in the "Test Architecture" tree above (cross_ref_transformer_spec, bib_ref_transformer_spec, footnote_transformer_spec) were never created under those names; xref and eref handling sit in inline_transformer and reference_transformer and are specified there.
161
+ - Happy path and edge cases for the 7 new specs: 72 examples, 0 failures, 1 pending (`bundle exec rspec` on those 8 files, with sts_schema_validation_spec from P3-004). The pending example is a real defect in `NbspProcessor`: the "Note N to entry" rule never fires, because the NOTE rule runs first and `\s` does not match U+00A0 (`"Note 1 to entry"` becomes `"Note\u00A01 to entry"`). Not fixed here (lib/ is outside this change).
162
+ - End-to-end tests: 2 run, not 3. spec/sts/calendar_notation_e2e_a_spec.rb and spec/sts/sts_e2e_b_spec.rb convert a whole Metanorma XML document to STS (25 examples, 0 failures, 2 pending known gaps in the second). Both inputs are invented documents written for the spec, not ISO reference documents. spec/sts/rice_e2e_spec.rb is excluded by `--tag ~rice_e2e` in .rspec and its input spec/examples/rice.xml is gitignored and absent from a fresh checkout, so it contributes 0 examples. The iso_8601_1 input/expected pair was not created.
163
+ - Found while checking the rice route: converting the public spec/examples/rice.presentation.xml raises `NoMethodError: undefined method 'ul' for ... AdmonitionBlock` at lib/metanorma/iso/sts/transformer/note_transformer.rb:93 (`extract_lists`). Reproduce: `Metanorma::Iso::Sts.convert(File.read("spec/examples/rice.presentation.xml"))`.
164
+ - Full-suite CI status on this branch: NOT RUN here.
165
+
166
+ Remaining: a third real-document end-to-end test (needs the rice crash fixed, or a public ISO document); the NbspProcessor rule fix.