metanorma-jis 1.2.0 → 1.2.1.pre.alpha.2

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +21 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG.adoc +34 -0
  5. data/CLAUDE.md +124 -0
  6. data/Gemfile +13 -3
  7. data/Gemfile.lock +1386 -0
  8. data/README.adoc +168 -60
  9. data/data/jis/doctype_overrides.yml +37 -0
  10. data/data/jis/document_properties.yml +54 -0
  11. data/data/jis/style_mapping.yml +157 -0
  12. data/data/jis/template.docx +0 -0
  13. data/lib/isodoc/jis/docx/adapter.rb +127 -0
  14. data/lib/isodoc/jis/docx/body_renderer.rb +147 -0
  15. data/lib/isodoc/jis/docx/cover_renderer.rb +55 -0
  16. data/lib/isodoc/jis/docx/errors.rb +15 -0
  17. data/lib/isodoc/jis/docx/inline_renderer.rb +111 -0
  18. data/lib/isodoc/jis/docx/model/cover.rb +64 -0
  19. data/lib/isodoc/jis/docx/model/namespace.rb +19 -0
  20. data/lib/isodoc/jis/docx/model/root.rb +36 -0
  21. data/lib/isodoc/jis/docx/model/sections/jis_annex_section.rb +29 -0
  22. data/lib/isodoc/jis/docx/model/sections/jis_clause_section.rb +28 -0
  23. data/lib/isodoc/jis/docx/model/sections/jis_commentary_section.rb +28 -0
  24. data/lib/isodoc/jis/docx/model/sections/jis_index_section.rb +31 -0
  25. data/lib/isodoc/jis/docx/model/sections/jis_sections.rb +23 -0
  26. data/lib/isodoc/jis/docx/model/sections.rb +18 -0
  27. data/lib/isodoc/jis/docx/model/terms/jis_term.rb +24 -0
  28. data/lib/isodoc/jis/docx/model/terms.rb +13 -0
  29. data/lib/isodoc/jis/docx/model.rb +39 -0
  30. data/lib/isodoc/jis/docx/renderers/base.rb +44 -0
  31. data/lib/isodoc/jis/docx/renderers/blocks.rb +125 -0
  32. data/lib/isodoc/jis/docx/renderers/clause.rb +65 -0
  33. data/lib/isodoc/jis/docx/renderers/order.rb +132 -0
  34. data/lib/isodoc/jis/docx/renderers/paragraph.rb +45 -0
  35. data/lib/isodoc/jis/docx/renderers/registry.rb +80 -0
  36. data/lib/isodoc/jis/docx/renderers/sections.rb +96 -0
  37. data/lib/isodoc/jis/docx/renderers/table.rb +65 -0
  38. data/lib/isodoc/jis/docx/renderers.rb +36 -0
  39. data/lib/isodoc/jis/docx/section_manager.rb +59 -0
  40. data/lib/isodoc/jis/docx/style_mapping.rb +32 -0
  41. data/lib/isodoc/jis/docx/style_resolver.rb +32 -0
  42. data/lib/isodoc/jis/docx/walker.rb +45 -0
  43. data/lib/isodoc/jis/docx.rb +23 -0
  44. data/lib/isodoc/jis/html_convert.rb +0 -5
  45. data/lib/isodoc/jis/init.rb +1 -5
  46. data/lib/isodoc/jis/jis.international-standard.xsl +402 -204
  47. data/lib/isodoc/jis/metadata.rb +21 -1
  48. data/lib/isodoc/jis/pdf_convert.rb +0 -3
  49. data/lib/isodoc/jis/presentation_list.rb +5 -6
  50. data/lib/isodoc/jis/presentation_section.rb +1 -5
  51. data/lib/isodoc/jis/presentation_table.rb +4 -8
  52. data/lib/isodoc/jis/presentation_xml_convert.rb +3 -7
  53. data/lib/isodoc/jis.rb +19 -0
  54. data/lib/metanorma/jis/citation_style.rb +111 -0
  55. data/lib/metanorma/jis/converter.rb +5 -9
  56. data/lib/metanorma/jis/document/metadata/jis_bib_data_extension_type.rb +10 -0
  57. data/lib/metanorma/jis/document/metadata/jis_bibliographic_item.rb +15 -0
  58. data/lib/metanorma/jis/document/metadata.rb +12 -0
  59. data/lib/metanorma/jis/document/root.rb +30 -0
  60. data/lib/metanorma/jis/document/sections/jis_annex_section.rb +20 -0
  61. data/lib/metanorma/jis/document/sections.rb +9 -0
  62. data/lib/metanorma/jis/document.rb +68 -0
  63. data/lib/metanorma/jis/front.rb +49 -12
  64. data/lib/metanorma/jis/html/renderer.rb +16 -0
  65. data/lib/metanorma/jis/html.rb +15 -0
  66. data/lib/metanorma/jis/isostandard.rng +1 -1
  67. data/lib/metanorma/jis/jis-style-en.yml +84 -0
  68. data/lib/metanorma/jis/jis-style-ja.yml +74 -0
  69. data/lib/metanorma/jis/jis_elements.rb +42 -0
  70. data/lib/metanorma/jis/log.rb +1 -1
  71. data/lib/metanorma/jis/processor.rb +11 -12
  72. data/lib/metanorma/jis/registers.rb +28 -0
  73. data/lib/metanorma/jis/{isodoc.rng → standoc.rng} +2 -2
  74. data/lib/metanorma/jis/validate.rb +8 -0
  75. data/lib/metanorma/jis/version.rb +1 -1
  76. data/lib/metanorma/jis.rb +11 -1
  77. data/lib/metanorma-jis.rb +3 -12
  78. data/metanorma-jis.gemspec +3 -1
  79. data/reference-docs/JDT2023/Admini.txt +46 -0
  80. data/reference-docs/JDT2023/CreateShortCut.vbs +58 -0
  81. data/reference-docs/JDT2023/JDT2023.ico +0 -0
  82. data/reference-docs/JDT2023/JDT2023_Start.Bat +5 -0
  83. data/reference-docs/JDT2023/JDT2023_Start.VBS +19 -0
  84. data/reference-docs/JDT2023/JIS_Control.dotm +0 -0
  85. data/reference-docs/JDT2023/JIS_NewStyle.dotm +0 -0
  86. data/reference-docs/JDT2023/JIStemplate.ini +31 -0
  87. data/reference-docs/JDT2023/Nextstyle.txt +33 -0
  88. data/reference-docs/JDT2023/StyleCheck.txt +1 -0
  89. data/reference-docs/JDT2023/Version.ini +4 -0
  90. data/reference-docs/JDT2023/Yougolst.txt +362 -0
  91. data/reference-docs/JDT2023/manual/manual.pdf +0 -0
  92. data/reference-docs/JDT2023/option.txt +10 -0
  93. data/reference-docs/JDT2023/unconditional.txt +204 -0
  94. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A3/346/250/252/A3/346/250/252/347/231/275/347/264/231/343/201/262/343/201/252/345/275/242.docx +0 -0
  95. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/346/250/252/A4/346/250/252/347/231/275/347/264/231/343/201/262/343/201/252/345/275/242.docx +0 -0
  96. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/346/250/252//346/227/247)JIS/343/201/250/345/233/275/351/232/233/350/246/217/346/240/274/343/201/250/343/201/256/345/257/276/346/257/224/350/241/250.docx +0 -0
  97. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/347/270/246/JIS/343/201/250/345/233/275/351/232/233/350/246/217/346/240/274/343/201/250/343/201/256/345/257/276/346/257/224/350/241/250.docx +0 -0
  98. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/347/270/246//345/217/202/350/200/203/346/226/207/347/214/256.docx +0 -0
  99. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/347/270/246//347/224/250/350/252/236.docx +0 -0
  100. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/A4/347/270/246//347/224/250/350/252/236/347/264/242/345/274/225.docx +0 -0
  101. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/001_default.vbs +9 -0
  102. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/002_default.vbs +9 -0
  103. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/003_default.vbs +9 -0
  104. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/antares.lnk +0 -0
  105. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/sirius-a.lnk +0 -0
  106. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/yugao3.lnk +0 -0
  107. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut//343/203/207/343/203/220/343/202/244/343/202/271/343/201/250/343/203/227/343/203/252/343/203/263/343/202/277/343/203/274.lnk +0 -0
  108. data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut//351/247/205/343/201/231/343/201/261/343/201/202/343/201/250.lnk +0 -0
  109. data/reference-docs/JDT2023//344/275/277/347/224/250/350/250/261/350/253/276.txt +25 -0
  110. data/reference-docs/JDT2023//345/210/251/347/224/250/344/270/215/345/217/257Style.txt +1 -0
  111. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/JIS_NEW_/343/201/276/343/201/210/343/201/214/343/201/215.txt +211 -0
  112. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/JIS_NEW_/346/234/254/346/226/207.txt +176 -0
  113. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TR_NEW_/343/201/276/343/201/210/343/201/214/343/201/215.txt +25 -0
  114. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TR_NEW_/346/234/254/346/226/207.txt +151 -0
  115. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TS_NEW_/343/201/276/343/201/210/343/201/214/343/201/215.txt +24 -0
  116. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TS_NEW_/346/234/254/346/226/207.txt +151 -0
  117. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//343/201/276/343/201/210/343/201/214/343/201/215_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +5 -0
  118. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//346/234/254/346/226/207_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +29 -0
  119. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//347/233/256/346/254/241_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +7 -0
  120. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//347/264/242/345/274/225_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +3 -0
  121. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//350/247/243/350/252/254_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +6 -0
  122. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//350/277/275/350/243/234_NEW_/343/201/276/343/201/210/343/201/214/343/201/215.txt +19 -0
  123. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//350/277/275/350/243/234_NEW_/346/234/254/346/226/207.txt +103 -0
  124. data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207//351/231/204/345/261/236/346/233/270_/343/202/277/343/202/244/343/203/210/343/203/253/343/203/226/343/203/255/343/203/203/343/202/257.txt +5 -0
  125. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/Fig1.bmp +0 -0
  126. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/346/234/254/346/226/207.dotx +0 -0
  127. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/346/234/254/346/226/207_MOD.dotx +0 -0
  128. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/347/264/242/345/274/225.dotx +0 -0
  129. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/241/250/347/264/231_JIS.dotx +0 -0
  130. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/241/250/347/264/231_TR.dotx +0 -0
  131. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/241/250/347/264/231_TS.dotx +0 -0
  132. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/241/250/347/264/231_/350/277/275/350/243/234.dotx +0 -0
  133. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/247/243/350/252/254.dotx +0 -0
  134. data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/JDT_/350/277/275/350/243/234_/345/233/275/351/232/233/350/246/217/346/240/274/346/214/207/347/244/272/347/204/241/343/201/227_/346/234/254/346/226/207.dotx +0 -0
  135. metadata +149 -24
  136. data/lib/html2doc/lists.rb +0 -157
  137. data/lib/isodoc/jis/html/htmlstyle.css +0 -50
  138. data/lib/isodoc/jis/html/isodoc.css +0 -12579
  139. data/lib/isodoc/jis/html/style-human.css +0 -1494
  140. data/lib/isodoc/jis/html/style-iso.css +0 -1540
  141. data/lib/isodoc/jis/html/word_jis_intro.html +0 -7
  142. data/lib/isodoc/jis/html/word_jis_titlepage.html +0 -135
  143. data/lib/isodoc/jis/html/wordstyle.css +0 -3581
  144. data/lib/isodoc/jis/html/wordstyle.scss +0 -3342
  145. data/lib/isodoc/jis/word_cleanup.rb +0 -147
  146. data/lib/isodoc/jis/word_convert.rb +0 -143
  147. data/lib/isodoc/jis/word_figure.rb +0 -100
  148. data/lib/isodoc/jis/word_table.rb +0 -56
  149. data/lib/relaton/render-jis/config.yml +0 -104
  150. data/lib/relaton/render-jis/fields.rb +0 -19
  151. data/lib/relaton/render-jis/general.rb +0 -29
  152. data/lib/relaton/render-jis/parse.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41ed633ae82eeba0b4cc6e96a3648e189b71fc20e0b0cf751cb513533ea26d91
4
- data.tar.gz: bbb19bd39b02105cebff6eba058c66d78d6d3e50fbeb56716995bd0b75e88c7f
3
+ metadata.gz: d0a27d2b251d8c1116603ded8d522eb6e523c2d20bdddb0e2ff69ad1c38b7a11
4
+ data.tar.gz: 4b61a1cdbec630a94d85fe686b9bc87316900a18c240b69e0a65a4342b60d613
5
5
  SHA512:
6
- metadata.gz: 80fdd530e51886b1aa85cf8c3eed317ba5fc766af95aeda274356c4a76219929f1b38cd4d110a6aa9c96508635fda49dc997de76873f06cbe3d23687a840785c
7
- data.tar.gz: e40ec0a3e09f8be4fd51f7b511194bd973307025e9f73eef32e8529158b3bd459b60cb05b8d49cdee6fe1bfebb84094d188d1e6bead04cb325997a4b04674fb0
6
+ metadata.gz: 84fc130d7051fa1b7cc6044043e1182874c71118b85880cca00b2638d0d527069b47cc0160cf64dd07a03d03a31b825d86302524c6ce8a0a997e3ff14e16a2c2
7
+ data.tar.gz: 888db147eaf79aefe5be58c862c8e45704bc172a9fbb0106c9b76ced59d4d5eee27916ec36fc3280a410564b741f7475ed8f4eaf98c8f1e45f34720f914c7102
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ # Build artifacts
2
+ *.gem
3
+ *.rbc
4
+ coverage/
5
+ tmp/
6
+
7
+ # Test data
8
+ *.adoc.err.html
9
+ *.html.err.html
10
+ *.asciidoc.log.txt
11
+ .rspec_status
12
+
13
+ # Local files
14
+ test.doc
15
+ test.pdf
16
+ test.presentation.xml
17
+ test_alt.html
18
+ tmp_inspect_styles.rb
19
+
20
+ # Cached reference data
21
+ spec/relatondb/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --order defined
data/CHANGELOG.adoc ADDED
@@ -0,0 +1,34 @@
1
+ = Changelog
2
+
3
+ == Unreleased
4
+
5
+ === Breaking changes
6
+
7
+ * Removed `.doc` (MHTML) output. The legacy Word path (`IsoDoc::Jis::WordConvert`, `Html2Doc::Jis`) has been deleted. Use `.docx` instead.
8
+
9
+ === Added
10
+
11
+ * Native DOCX output via `IsoDoc::Jis::Docx::Adapter` — visually faithful to the JDT2023 template.
12
+ ** Builds the OOXML package programmatically from `data/jis/*.yml` (no committed `.docx` template).
13
+ ** Per-section assembly: cover, body, annexes, bibliography, index, commentary.
14
+ ** JIS-specific renderers for cover (4 doctypes), commentary, dual-alphabet index, list flattening.
15
+ * `Metanorma::Jis::Document` — vendored document model with typed `Cover`, `JisCommentarySection`, `JisIndexSection`, etc. Uses lutaml-model exclusively.
16
+ * `Metanorma::Jis::Boilerplate` — Liquid-based boilerplate rendering. Replaces JDT2023's VBA macros. Templates for cover (JIS/TR/TS/追補), foreword, body title block, commentary preface.
17
+ * `Metanorma::Jis::StyleCheck` — terminology and citation checker. Emits findings via `Metanorma::Jis::Log` with stable rule IDs.
18
+ * `data/jis/` — extracted facts from JDT2023 DOTX/DOTM: 925 unique stylesIds, 50+ header/footer XMLs, 9 section layouts, Shift_JIS-decoded style-rule files.
19
+ * Scripts: `scripts/extract_jis_templates.rb`, `scripts/validate_style_mapping.rb`.
20
+ * Code-quality regression specs (`spec/code_quality_spec.rb`) — enforces no `require_relative`, no `send` on private methods, no `instance_variable_set/get`, no `respond_to?`, no `double()`.
21
+
22
+ === Changed
23
+
24
+ * Refactored every internal load to Ruby `autoload`. Removed all `require_relative` from `lib/`.
25
+ * `presentation_section.rb`, `presentation_list.rb`, `presentation_table.rb` converted from class-reopens to autoloadable modules included in `PresentationXMLConvert`.
26
+ * `front.rb`, `log.rb` converted to autoloadable `Front`, `Log` modules included in `Converter`.
27
+ * `Processor#output_formats`: `:doc` → `:docx`.
28
+
29
+ === Removed
30
+
31
+ * `lib/isodoc/jis/word_convert.rb`, `word_cleanup.rb`, `word_table.rb`, `word_figure.rb`.
32
+ * `lib/html2doc/lists.rb` (and `lib/html2doc/` directory).
33
+ * `lib/isodoc/jis/html/word_jis_intro.html`, `word_jis_titlepage.html`, `wordstyle.scss`.
34
+ * `spec/isodoc/word_spec.rb` and other WordConvert-dependent spec files.
data/CLAUDE.md ADDED
@@ -0,0 +1,124 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ `metanorma-jis` is a Ruby gem that lets you author **Japanese Industrial Standards (JIS)** in AsciiDoc and emit XML, HTML, Word (`.doc`), and PDF. It is a thin flavor on top of [`metanorma-iso`](https://github.com/metanorma/metanorma-iso) — the JIS document model is the ISO document model with Japanese-specific rendering tweaks (fonts, layout, boilerplate, doctypes).
8
+
9
+ - Ruby `>= 3.3.0`; gemspec pins `metanorma-iso ~> 3.4.2`.
10
+ - XML root tag: `jis-standard`; XML namespace: `https://www.metanorma.org/ns/jis`.
11
+ - Doctypes inherit from ISO plus `japanese-industrial-standard` (default), and JIS-specific document subtypes (TR, TS, 追補/amendment) drive cover-page selection.
12
+ - Default language is `ja` (auto-set in `init_i18n` if missing); `jp` is normalized to `ja`.
13
+
14
+ ## Build and Test Commands
15
+
16
+ ```bash
17
+ bundle install
18
+ bundle exec rspec spec/isodoc/word_spec.rb:42 # one test by line number
19
+ bundle exec rspec spec/isodoc/word_spec.rb # one file
20
+ bundle exec rubocop # lint
21
+ bundle exec rake build # build the gem
22
+ ```
23
+
24
+ - Follow `metanorma-iso/CLAUDE.md` spec-safety rules: avoid running the full suite (`bundle exec rake`); run **one targeted spec file at a time**. The ISO backend's full suite leaks memory and can kill the shell — JIS inherits that risk via `metanorma-iso ~> 3.4.2`.
25
+ - Use `canon diff FILE1 FILE2` for semantic XML diffs; **never** `xmldiff`. Canon is at `/Users/mulgogi/.local/share/mise/installs/ruby/3.4.8/bin/canon` (see `metanorma-iso/CLAUDE.md`).
26
+ - **Never use Python.** Ruby only.
27
+
28
+ ## Architecture
29
+
30
+ ### Inheritance from `metanorma-iso`
31
+
32
+ Every JIS class subclasses its ISO counterpart and overrides only what differs. Read `metanorma-iso/CLAUDE.md` first — most architecture, conventions, and pitfalls are documented there.
33
+
34
+ ```
35
+ Metanorma::Standoc::Converter
36
+ └── Metanorma::Iso::Converter (metanorma-iso)
37
+ └── Metanorma::Jis::Converter (lib/metanorma/jis/converter.rb)
38
+
39
+ IsoDoc::XslfoPdfConvert
40
+ └── IsoDoc::Iso::PdfConvert
41
+ └── IsoDoc::Jis::PdfConvert (lib/isodoc/jis/pdf_convert.rb)
42
+
43
+ IsoDoc::Iso::WordConvert → IsoDoc::Jis::WordConvert (lib/isodoc/jis/word_convert.rb)
44
+ IsoDoc::Iso::HtmlConvert → IsoDoc::Jis::HtmlConvert
45
+ ```
46
+
47
+ ### Layer 1 — AsciiDoc → JIS XML (`lib/metanorma/jis/`)
48
+
49
+ - `converter.rb` — `Metanorma::Jis::Converter < Iso::Converter`, registered as `:jis`. Sets `XML_ROOT_TAG = "jis-standard"`, `XML_NAMESPACE`, default doctype, default language. Routes output via `html_converter`, `doc_converter`, `pdf_converter`, `presentation_xml_converter`.
50
+ - `front.rb` — JIS-specific metadata (publisher = "Japanese Industrial Standards", committee contributors, multilingual titles, document identifiers via `pubid`).
51
+ - `cleanup.rb` — JIS-specific boilerplate (`boilerplate-ja.adoc`, `boilerplate-en.adoc`) and normative-reference preface wording.
52
+ - `validate.rb` — JIS-specific document model validation.
53
+ - `*.rng` — RelaxNG schemas (inherited unchanged from ISO unless noted).
54
+ - `boilerplate-ja.adoc`, `boilerplate-en.adoc` — Japanese/English boilerplate text injected into documents.
55
+
56
+ ### Layer 2 — JIS XML → rendered output (`lib/isodoc/jis/`)
57
+
58
+ - `base_convert.rb` — shared rendering mixins used by HTML and Word.
59
+ - `html_convert.rb` / `html/*.scss` / `html/*.html` — HTML output and SCSS stylesheets. The HTML templates (`html_jis_titlepage.html`, `html_jis_intro.html`, `word_jis_titlepage.html`, `word_jis_intro.html`) drive both HTML and Word rendering.
60
+ - `pdf_convert.rb` + `jis.international-standard.xsl` — PDF via XSL-FO.
61
+ - `word_convert.rb` + `word_cleanup.rb` + `word_table.rb` + `word_figure.rb` — **legacy** Word `.doc` (HTML → `Html2Doc::Jis` → MHTML) path. See "DOCX port (in progress)" below.
62
+ - `presentation_xml_convert.rb` + `presentation_*.rb` — presentation XML intermediate; `presentation_section.rb`, `presentation_table.rb`, `presentation_list.rb` carry JIS-specific cross-ref / numbering / list rendering.
63
+ - `metadata.rb` — JIS document metadata extraction for rendering.
64
+ - `i18n.rb` + `i18n-en.yaml` + `i18n-ja.yaml` — labels in English and Japanese.
65
+ - `xref.rb` — JIS cross-reference formatting (e.g., "表 X-Y", "図 X-Y", "附属書 X").
66
+ - `init.rb` — factories for metadata, xref, i18n, bib renderer.
67
+
68
+ ### Supporting modules
69
+
70
+ - `lib/html2doc/lists.rb` — `Html2Doc::Jis < ::Html2Doc`; JIS-specific list-to-paragraph flattening (lists are rendered as indented paragraphs with hanging tabs, not as Word list styles).
71
+ - `lib/relaton/render-jis/` — JIS bibliographic reference rendering (`config.yml`, `general.rb`, `parse.rb`, `fields.rb`).
72
+
73
+ ### Registration entry points
74
+
75
+ - `lib/metanorma-jis.rb` — top-level entry: requires the converter, then registers `Metanorma::Jis::Processor` with `Metanorma::Registry` (if a registry is loaded).
76
+ - `lib/metanorma/jis/processor.rb` — registers output formats: `html`, `pdf`, `doc`. **No `:docx` format yet** — adding DOCX output is the open task (see below).
77
+
78
+ ## DOCX port (in progress)
79
+
80
+ The current Word output is **legacy HTML→MHTML** via `Html2Doc::Jis` (produces `.doc`). The goal is to add true DOCX output that mirrors the JIS Word template in `reference-docs/JDT2023/`, using the same **Uniword-based DOCX Adapter** architecture that `metanorma-iso` uses (see `metanorma-iso/lib/isodoc/iso/docx/` and `metanorma-iso/data/iso-dis/`).
81
+
82
+ ### Reference template layout (`reference-docs/JDT2023/`)
83
+
84
+ The official "JDT2023" template distribution from the Japanese Standards Association. Key contents:
85
+
86
+ - `JIS_Control.dotm` (1.7 MB) and `JIS_NewStyle.dotm` (423 KB) — Word macro-enabled templates that carry the style library and the VBA automation (style checking, generation hooks). Source for style extraction, NOT for redistribution.
87
+ - `レイアウト/` (Layout) — per-section `.dotx` templates, each a separate Word section with its own page setup:
88
+ - `JDT_本文.dotx` (main body), `JDT_本文_MOD.dotx` (modified-adoption body)
89
+ - `JDT_表紙_JIS.dotx`, `JDT_表紙_TR.dotx`, `JDT_表紙_TS.dotx`, `JDT_表紙_追補.dotx` (doctype-specific covers)
90
+ - `JDT_索引.dotx` (index), `JDT_解説.dotx` (commentary / 解説附属書)
91
+ - `JDT_追補_国際規格指示無し_本文.dotx` (amendment without international-standard direction)
92
+ - `定型文/` (fixed phrases) — boilerplate snippets per doctype (`JIS_NEW_本文.txt`, `TR_NEW_まえがき.txt`, `追補_NEW_本文.txt`, …) and per title-block (`本文_タイトルブロック.txt`, `目次_タイトルブロック.txt`, `索引_タイトルブロック.txt`, `解説_タイトルブロック.txt`, `附属書_タイトルブロック.txt`, `まえがき_タイトルブロック.txt`). Shift_JIS encoded.
93
+ - `ひな形/` (templates) — blank `.docx` files for A3 横, A4 横, A4 縦, plus a 用語 (glossary), 用語索引 (index), 参考文献 (references), and JIS-国際規格対比表 (comparison table).
94
+ - `manual/manual.pdf` — operator manual (Japanese).
95
+ - `StyleCheck.txt`, `Yougolst.txt`, `Nextstyle.txt`, `unconditional.txt`, `利用不可Style.txt` — style metadata and style-usage rules used by the VBA checker. Shift_JIS encoded.
96
+ - `JIStemplate.ini`, `Version.ini`, `option.txt`, `Admini.txt`, `CreateShortCut.vbs`, `JDT2023_Start.Bat`, `JDT2023_Start.VBS`, `JDT2023.ico` — installer / launcher configuration (Windows-only, not relevant to DOCX rendering).
97
+ - `使用許諾.txt` — license terms for the JDT2023 distribution.
98
+
99
+ These files are **reference source material** — never delete (see global rule "NEVER DELETE SOURCE FILES"). Encoding is Shift_JIS; decode with `File.read(path, encoding: "Shift_JIS")` when parsing.
100
+
101
+ ### How `metanorma-iso` does DOCX (the pattern to mirror)
102
+
103
+ 1. `lib/metanorma/iso/processor.rb` registers `:doc` and `:docx`; both routes call `IsoDoc::Iso::Docx::Adapter.new(template: ...).convert(xml_input, outname)`.
104
+ 2. `lib/isodoc/iso/docx.rb` autoloads the Adapter module from the parent namespace.
105
+ 3. `lib/isodoc/iso/docx/adapter.rb` — `Adapter` orchestrates renderer objects (cover, boilerplate, sections, TOC, inline, formula, etc.). Renderers are registered in a `Renderers::Registry` keyed by model class (MECE, OCP-friendly).
106
+ 4. `lib/isodoc/iso/docx_style_mapping.rb` — `DocxTemplates` resolves template + style-mapping paths; `DocxStyleMapping` loads `style_mapping.yml`.
107
+ 5. `data/iso-dis/` and `data/iso-simple/` — one directory per template variant, each with:
108
+ - `template.docx` (or `.dotx`) — the reference DOCX
109
+ - `styles.yml` — extracted style library
110
+ - `numbering.yml` — extracted numbering definitions
111
+ - `style_mapping.yml` — semantic-key → DOCX styleId mapping
112
+ - `doc_defaults.yml` — default run/paragraph properties
113
+ - `document_metadata.yml` — docProps/custom.xml values
114
+
115
+ The Adapter reads the semantic presentation XML → builds a `Metanorma::IsoDocument::Root` model → walks it via renderers → writes DOCX through Uniword. The template DOCX is loaded once via `Uniword.load(template_path)` and its body is cleared before each render.
116
+
117
+ ## Key Patterns
118
+
119
+ - The converter hierarchy is `Standoc → Iso → Jis`; validation and cleanup extend their ISO counterparts via separate modules.
120
+ - JIS XML namespace is `https://www.metanorma.org/ns/jis`; root tag `jis-standard`. All XPath queries inside IsoDoc use `ns(...)` to resolve the namespace.
121
+ - The `Html2Doc::Jis` helper (`lib/html2doc/lists.rb`) flattens ordered/unordered lists into indented paragraphs with hanging tabs — JIS-style lists are NOT Word list styles. This is legacy and only used by the `.doc` path; the new DOCX path should mirror `metanorma-iso/lib/html2doc/lists.rb` (`Html2Doc::IsoDIS`) or the Uniword list renderers.
122
+ - The `presentation_section.rb`, `presentation_table.rb`, `presentation_list.rb` modules carry JIS-specific numbering and cross-reference rules that the DOCX renderers will need to consume from the presentation XML.
123
+ - PDF is rendered through XSL-FO (`jis.international-standard.xsl`); DOCX is the only format not yet produced natively.
124
+ - `Gemfile.devel` (if present) can point to local checkouts of `metanorma-iso`, `isodoc`, etc. for cross-repo development.
data/Gemfile CHANGED
@@ -1,9 +1,19 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
3
-
4
1
  source "https://rubygems.org"
5
2
  git_source(:github) { |repo| "https://github.com/#{repo}" }
6
3
 
7
4
  gemspec
8
5
 
6
+
7
+ gem "metanorma-standoc", "~> 3.5.1.pre.alpha" # Standoc::Document rename
8
+ gem "metanorma-document", "~> 0.5.2.pre.alpha"
9
+ gem "isodoc", "~> 3.7.4.pre.alpha"
10
+ gem "relaton-render", "~> 3.0" # slot forms; bare from-only dates; item-language routing
11
+ gem "pubid", "~> 2.0"
12
+
9
13
  eval_gemfile("Gemfile.devel") rescue nil
14
+
15
+ gem "metanorma-mirror", github: "metanorma/metanorma-mirror", branch: "main" # TEMPORARY audit chain
16
+ gem "metanorma-iso", github: "metanorma/metanorma-iso", branch: "main"
17
+ gem "metanorma-utils", "~> 2.0" # GcBudget + table cell buffer
18
+ gem "metanorma-core", "~> 0.2.5.pre.alpha" # published flavor/taste table (metanorma-core#18)
19
+ gem "lutaml-model", "~> 0.8" # tracking; relaton floors ~> 0.8.113