metanorma-jis 1.1.6 → 1.2.1.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 +21 -0
- data/.rspec +1 -0
- data/CHANGELOG.adoc +34 -0
- data/CLAUDE.md +124 -0
- data/Gemfile +25 -3
- data/Gemfile.lock +1393 -0
- data/README.adoc +168 -60
- data/data/jis/doctype_overrides.yml +37 -0
- data/data/jis/document_properties.yml +54 -0
- data/data/jis/style_mapping.yml +157 -0
- data/data/jis/template.docx +0 -0
- data/lib/isodoc/jis/docx/adapter.rb +127 -0
- data/lib/isodoc/jis/docx/body_renderer.rb +147 -0
- data/lib/isodoc/jis/docx/cover_renderer.rb +55 -0
- data/lib/isodoc/jis/docx/errors.rb +15 -0
- data/lib/isodoc/jis/docx/inline_renderer.rb +111 -0
- data/lib/isodoc/jis/docx/model/cover.rb +64 -0
- data/lib/isodoc/jis/docx/model/namespace.rb +19 -0
- data/lib/isodoc/jis/docx/model/root.rb +36 -0
- data/lib/isodoc/jis/docx/model/sections/jis_annex_section.rb +29 -0
- data/lib/isodoc/jis/docx/model/sections/jis_clause_section.rb +28 -0
- data/lib/isodoc/jis/docx/model/sections/jis_commentary_section.rb +28 -0
- data/lib/isodoc/jis/docx/model/sections/jis_index_section.rb +31 -0
- data/lib/isodoc/jis/docx/model/sections/jis_sections.rb +23 -0
- data/lib/isodoc/jis/docx/model/sections.rb +18 -0
- data/lib/isodoc/jis/docx/model/terms/jis_term.rb +24 -0
- data/lib/isodoc/jis/docx/model/terms.rb +13 -0
- data/lib/isodoc/jis/docx/model.rb +39 -0
- data/lib/isodoc/jis/docx/renderers/base.rb +44 -0
- data/lib/isodoc/jis/docx/renderers/blocks.rb +125 -0
- data/lib/isodoc/jis/docx/renderers/clause.rb +65 -0
- data/lib/isodoc/jis/docx/renderers/order.rb +132 -0
- data/lib/isodoc/jis/docx/renderers/paragraph.rb +45 -0
- data/lib/isodoc/jis/docx/renderers/registry.rb +80 -0
- data/lib/isodoc/jis/docx/renderers/sections.rb +96 -0
- data/lib/isodoc/jis/docx/renderers/table.rb +65 -0
- data/lib/isodoc/jis/docx/renderers.rb +36 -0
- data/lib/isodoc/jis/docx/section_manager.rb +59 -0
- data/lib/isodoc/jis/docx/style_mapping.rb +32 -0
- data/lib/isodoc/jis/docx/style_resolver.rb +32 -0
- data/lib/isodoc/jis/docx/walker.rb +45 -0
- data/lib/isodoc/jis/docx.rb +23 -0
- data/lib/isodoc/jis/html_convert.rb +0 -5
- data/lib/isodoc/jis/init.rb +1 -5
- data/lib/isodoc/jis/jis.international-standard.xsl +505 -269
- data/lib/isodoc/jis/metadata.rb +21 -1
- data/lib/isodoc/jis/pdf_convert.rb +0 -3
- data/lib/isodoc/jis/presentation_list.rb +5 -6
- data/lib/isodoc/jis/presentation_section.rb +1 -5
- data/lib/isodoc/jis/presentation_table.rb +4 -8
- data/lib/isodoc/jis/presentation_xml_convert.rb +3 -7
- data/lib/isodoc/jis/xref.rb +2 -1
- data/lib/isodoc/jis.rb +19 -0
- data/lib/metanorma/jis/basicdoc.rng +53 -30
- data/lib/metanorma/jis/biblio-standoc.rng +18 -0
- data/lib/metanorma/jis/citation_style.rb +111 -0
- data/lib/metanorma/jis/converter.rb +5 -9
- data/lib/metanorma/jis/document/metadata/jis_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/jis/document/metadata/jis_bibliographic_item.rb +15 -0
- data/lib/metanorma/jis/document/metadata.rb +12 -0
- data/lib/metanorma/jis/document/root.rb +30 -0
- data/lib/metanorma/jis/document/sections/jis_annex_section.rb +20 -0
- data/lib/metanorma/jis/document/sections.rb +9 -0
- data/lib/metanorma/jis/document.rb +68 -0
- data/lib/metanorma/jis/front.rb +49 -12
- data/lib/metanorma/jis/html/renderer.rb +16 -0
- data/lib/metanorma/jis/html.rb +15 -0
- data/lib/metanorma/jis/isostandard.rng +1 -1
- data/lib/metanorma/jis/jis-style-en.yml +84 -0
- data/lib/metanorma/jis/jis-style-ja.yml +74 -0
- data/lib/metanorma/jis/jis_elements.rb +42 -0
- data/lib/metanorma/jis/log.rb +1 -1
- data/lib/metanorma/jis/processor.rb +11 -12
- data/lib/metanorma/jis/registers.rb +28 -0
- data/lib/metanorma/jis/reqt.rng +32 -12
- data/lib/metanorma/jis/{isodoc.rng → standoc.rng} +238 -78
- data/lib/metanorma/jis/validate.rb +8 -0
- data/lib/metanorma/jis/version.rb +1 -1
- data/lib/metanorma/jis.rb +11 -1
- data/lib/metanorma-jis.rb +3 -12
- data/metanorma-jis.gemspec +3 -1
- data/reference-docs/JDT2023/Admini.txt +46 -0
- data/reference-docs/JDT2023/CreateShortCut.vbs +58 -0
- data/reference-docs/JDT2023/JDT2023.ico +0 -0
- data/reference-docs/JDT2023/JDT2023_Start.Bat +5 -0
- data/reference-docs/JDT2023/JDT2023_Start.VBS +19 -0
- data/reference-docs/JDT2023/JIS_Control.dotm +0 -0
- data/reference-docs/JDT2023/JIS_NewStyle.dotm +0 -0
- data/reference-docs/JDT2023/JIStemplate.ini +31 -0
- data/reference-docs/JDT2023/Nextstyle.txt +33 -0
- data/reference-docs/JDT2023/StyleCheck.txt +1 -0
- data/reference-docs/JDT2023/Version.ini +4 -0
- data/reference-docs/JDT2023/Yougolst.txt +362 -0
- data/reference-docs/JDT2023/manual/manual.pdf +0 -0
- data/reference-docs/JDT2023/option.txt +10 -0
- data/reference-docs/JDT2023/unconditional.txt +204 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/001_default.vbs +9 -0
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/002_default.vbs +9 -0
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/003_default.vbs +9 -0
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/antares.lnk +0 -0
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/sirius-a.lnk +0 -0
- data/reference-docs/JDT2023//343/201/262/343/201/252/345/275/242/shortcut/yugao3.lnk +0 -0
- 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
- 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
- data/reference-docs/JDT2023//344/275/277/347/224/250/350/250/261/350/253/276.txt +25 -0
- data/reference-docs/JDT2023//345/210/251/347/224/250/344/270/215/345/217/257Style.txt +1 -0
- 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
- data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/JIS_NEW_/346/234/254/346/226/207.txt +176 -0
- 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
- data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TR_NEW_/346/234/254/346/226/207.txt +151 -0
- 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
- data/reference-docs/JDT2023//345/256/232/345/236/213/346/226/207/TS_NEW_/346/234/254/346/226/207.txt +151 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/reference-docs/JDT2023//357/276/232/357/275/262/357/275/261/357/275/263/357/276/204/Fig1.bmp +0 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- metadata +148 -23
- data/lib/html2doc/lists.rb +0 -157
- data/lib/isodoc/jis/html/htmlstyle.css +0 -50
- data/lib/isodoc/jis/html/isodoc.css +0 -12579
- data/lib/isodoc/jis/html/style-human.css +0 -1494
- data/lib/isodoc/jis/html/style-iso.css +0 -1540
- data/lib/isodoc/jis/html/word_jis_intro.html +0 -7
- data/lib/isodoc/jis/html/word_jis_titlepage.html +0 -135
- data/lib/isodoc/jis/html/wordstyle.css +0 -3581
- data/lib/isodoc/jis/html/wordstyle.scss +0 -3342
- data/lib/isodoc/jis/word_cleanup.rb +0 -147
- data/lib/isodoc/jis/word_convert.rb +0 -143
- data/lib/isodoc/jis/word_figure.rb +0 -100
- data/lib/isodoc/jis/word_table.rb +0 -56
- data/lib/relaton/render-jis/config.yml +0 -104
- data/lib/relaton/render-jis/fields.rb +0 -19
- data/lib/relaton/render-jis/general.rb +0 -29
- data/lib/relaton/render-jis/parse.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9682f14ffe2326302c6ec78b576bcee0f537e37c5440144fc86d6b9e130bdebe
|
|
4
|
+
data.tar.gz: e7cbf80345f8685cf6a51f5c12095bb97d4e347ea80a6fd22470f49e670ccfd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc0c074211f41d57542ed2acce7ddba4e0452ff6ad17335affe749dbfcde0ffa2d48a42325ed1f4cbcff9be7ba0ae5242dee68ade5442b1eca5b6c8c40d925c9
|
|
7
|
+
data.tar.gz: '018dd663ab0b5d41014078f54444943878fc2ea911e5c977a587a0411edc3fa181d810ad17206492d476a3bc077538c56089dc71b6b4f934262d43bc24ffc9eb'
|
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,31 @@
|
|
|
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
|
+
# TEMPORARY: cross-PR branch pins so CI can resolve the in-flight
|
|
7
|
+
# metanorma-standoc namespace rename (Metanorma::Standoc::Document)
|
|
8
|
+
# and the pubid-2 / relaton-bib 2.2 / metanorma-document 0.5 chain.
|
|
9
|
+
# Revert each pin once the corresponding PR merges:
|
|
10
|
+
# - https://github.com/metanorma/metanorma-standoc/pull/1232
|
|
11
|
+
# - https://github.com/metanorma/metanorma-document/pull/45
|
|
12
|
+
|
|
13
|
+
# TEMPORARY: cross-PR branch pins so CI can resolve the in-flight
|
|
14
|
+
# metanorma-standoc namespace rename (Metanorma::Standoc::Document)
|
|
15
|
+
# and the pubid-2 / relaton-bib 2.2 / metanorma-document 0.5 chain.
|
|
16
|
+
# Revert each pin once the corresponding PR merges:
|
|
17
|
+
# - https://github.com/metanorma/metanorma-standoc/pull/1232
|
|
18
|
+
# - https://github.com/metanorma/metanorma-document/pull/45
|
|
19
|
+
gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main" # TEMPORARY audit chain (stacked)
|
|
20
|
+
gem "metanorma-document", github: "metanorma/metanorma-document", branch: "main" # TEMPORARY audit chain
|
|
21
|
+
gem "isodoc", github: "metanorma/isodoc", branch: "main" # merged as #825
|
|
22
|
+
gem "relaton-render", "~> 3.0.0.pre.alpha" # # slot forms; bare from-only dates; item-language routing, github: "metanorma/relaton-render", branch: "main"
|
|
23
|
+
gem "pubid", "~> 2.0.0.pre.alpha"
|
|
24
|
+
|
|
9
25
|
eval_gemfile("Gemfile.devel") rescue nil
|
|
26
|
+
|
|
27
|
+
gem "metanorma-mirror", github: "metanorma/metanorma-mirror", branch: "main" # TEMPORARY audit chain
|
|
28
|
+
gem "metanorma-iso", github: "metanorma/metanorma-iso", branch: "main"
|
|
29
|
+
gem "metanorma-utils", github: "metanorma/metanorma-utils", branch: "main" # GcBudget + table cell buffer, unreleased past 2.0.7 # the audit branch carries the 1.x lib/relaton stack, which cannot boot beside relaton-render 3
|
|
30
|
+
gem "metanorma-core", github: "metanorma/metanorma-core", branch: "main" # TEMPORARY audit chain
|
|
31
|
+
gem "lutaml-model", "= 0.8.106" # LATEST RELEASE; 0.8.97-102 CachedTypeResolver crashes Root.from_xml
|