metanorma-jis 0.0.2 → 0.0.3
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/lib/html2doc/lists.rb +41 -6
- data/lib/isodoc/jis/base_convert.rb +38 -0
- data/lib/isodoc/jis/html/isodoc.css +19 -33
- data/lib/isodoc/jis/html/isodoc.scss +16 -32
- data/lib/isodoc/jis/html/word_jis_intro.html +4 -3
- data/lib/isodoc/jis/html/word_jis_titlepage.html +6 -0
- data/lib/isodoc/jis/html/wordstyle.css +37 -109
- data/lib/isodoc/jis/html/wordstyle.scss +48 -132
- data/lib/isodoc/jis/html_convert.rb +11 -0
- data/lib/isodoc/jis/i18n-ja.yaml +5 -0
- data/lib/isodoc/jis/jis.international-standard.xsl +11095 -0
- data/lib/isodoc/jis/presentation_xml_convert.rb +88 -0
- data/lib/isodoc/jis/word_cleanup.rb +143 -0
- data/lib/isodoc/jis/word_convert.rb +222 -90
- data/lib/isodoc/jis/xref.rb +7 -0
- data/lib/metanorma/jis/cleanup.rb +42 -0
- data/lib/metanorma/jis/converter.rb +9 -15
- data/lib/metanorma/jis/front.rb +25 -0
- data/lib/metanorma/jis/processor.rb +1 -1
- data/lib/metanorma/jis/relaton-jis.rng +3 -109
- data/lib/metanorma/jis/validate.rb +26 -0
- data/lib/metanorma/jis/version.rb +1 -1
- metadata +6 -2
data/lib/metanorma/jis/front.rb
CHANGED
@@ -57,6 +57,31 @@ module Metanorma
|
|
57
57
|
title_amd(node, xml, lang, at) if @amd
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
def metadata_id(node, xml)
|
62
|
+
if id = node.attr("docidentifier")
|
63
|
+
xml.docidentifier id, **attr_code(type: "JIS")
|
64
|
+
else iso_id(node, xml)
|
65
|
+
end
|
66
|
+
xml.docnumber node.attr("docnumber")
|
67
|
+
end
|
68
|
+
|
69
|
+
def iso_id(node, xml)
|
70
|
+
id = case doctype(node)
|
71
|
+
when "japanese-industrial-standard", "amendment" then "JIS"
|
72
|
+
when "technical-report" then "TR"
|
73
|
+
when "technical-specification" then "TS"
|
74
|
+
else "JIS"
|
75
|
+
end
|
76
|
+
a = node.attr("docseries") and id += " #{a}"
|
77
|
+
a = node.attr("docnumber") and id += " #{a}"
|
78
|
+
yr = iso_id_year(node)
|
79
|
+
origyr = node.attr("created-date") || yr
|
80
|
+
a = node.attr("amendment-number") and
|
81
|
+
id += ":#{origyr}/AMD #{a}"
|
82
|
+
id += ":#{yr}"
|
83
|
+
xml.docidentifier id, type: "JIS"
|
84
|
+
end
|
60
85
|
end
|
61
86
|
end
|
62
87
|
end
|
@@ -6,9 +6,6 @@
|
|
6
6
|
<attribute name="schema-version"/>
|
7
7
|
</optional>
|
8
8
|
<ref name="doctype"/>
|
9
|
-
<optional>
|
10
|
-
<ref name="docsubtype"/>
|
11
|
-
</optional>
|
12
9
|
<ref name="editorialgroup"/>
|
13
10
|
<zeroOrMore>
|
14
11
|
<ref name="ics"/>
|
@@ -18,93 +15,12 @@
|
|
18
15
|
<ref name="stagename"/>
|
19
16
|
</optional>
|
20
17
|
</define>
|
21
|
-
<define name="bdate">
|
22
|
-
<element name="date">
|
23
|
-
<attribute name="type">
|
24
|
-
<choice>
|
25
|
-
<ref name="BibliographicDateType"/>
|
26
|
-
<text/>
|
27
|
-
</choice>
|
28
|
-
</attribute>
|
29
|
-
<choice>
|
30
|
-
<group>
|
31
|
-
<element name="from">
|
32
|
-
<ref name="ISO8601Date"/>
|
33
|
-
</element>
|
34
|
-
<optional>
|
35
|
-
<element name="to">
|
36
|
-
<ref name="ISO8601Date"/>
|
37
|
-
</element>
|
38
|
-
</optional>
|
39
|
-
</group>
|
40
|
-
<element name="on">
|
41
|
-
<choice>
|
42
|
-
<ref name="ISO8601Date"/>
|
43
|
-
<value>--</value>
|
44
|
-
<value>–</value>
|
45
|
-
</choice>
|
46
|
-
</element>
|
47
|
-
</choice>
|
48
|
-
</element>
|
49
|
-
</define>
|
50
|
-
<define name="organization">
|
51
|
-
<element name="organization">
|
52
|
-
<oneOrMore>
|
53
|
-
<ref name="orgname"/>
|
54
|
-
</oneOrMore>
|
55
|
-
<optional>
|
56
|
-
<ref name="abbreviation"/>
|
57
|
-
</optional>
|
58
|
-
<optional>
|
59
|
-
<ref name="uri"/>
|
60
|
-
</optional>
|
61
|
-
<zeroOrMore>
|
62
|
-
<ref name="org-identifier"/>
|
63
|
-
</zeroOrMore>
|
64
|
-
<zeroOrMore>
|
65
|
-
<ref name="contact"/>
|
66
|
-
</zeroOrMore>
|
67
|
-
<optional>
|
68
|
-
<ref name="technical-committee"/>
|
69
|
-
</optional>
|
70
|
-
<optional>
|
71
|
-
<ref name="subcommittee"/>
|
72
|
-
</optional>
|
73
|
-
<optional>
|
74
|
-
<ref name="workgroup"/>
|
75
|
-
</optional>
|
76
|
-
<optional>
|
77
|
-
<ref name="secretariat"/>
|
78
|
-
</optional>
|
79
|
-
</element>
|
80
|
-
</define>
|
81
18
|
<define name="DocumentType">
|
82
19
|
<choice>
|
83
|
-
<value>
|
84
|
-
<value>draft-for-development</value>
|
85
|
-
<value>published-document</value>
|
86
|
-
<value>privately-subscribed-standard</value>
|
87
|
-
<value>publicly-available-specification</value>
|
88
|
-
<value>flex-standard</value>
|
89
|
-
<value>international-standard</value>
|
90
|
-
<value>technical-specification</value>
|
20
|
+
<value>japanese-industrial-standard</value>
|
91
21
|
<value>technical-report</value>
|
92
|
-
<value>
|
93
|
-
<value>
|
94
|
-
<value>industry-technical-agreement</value>
|
95
|
-
<value>standard</value>
|
96
|
-
<value>european-workshop-agreement</value>
|
97
|
-
<value>fast-track-standard</value>
|
98
|
-
<value>expert-commentary</value>
|
99
|
-
</choice>
|
100
|
-
</define>
|
101
|
-
<define name="DocumentSubtype">
|
102
|
-
<choice>
|
103
|
-
<value>specification</value>
|
104
|
-
<value>method-of-test</value>
|
105
|
-
<value>method-of-specifying</value>
|
106
|
-
<value>vocabulary</value>
|
107
|
-
<value>code-of-practice</value>
|
22
|
+
<value>technical-specification</value>
|
23
|
+
<value>amendment</value>
|
108
24
|
</choice>
|
109
25
|
</define>
|
110
26
|
<define name="structuredidentifier">
|
@@ -126,11 +42,6 @@
|
|
126
42
|
</element>
|
127
43
|
</define>
|
128
44
|
</include>
|
129
|
-
<define name="updates_document_type">
|
130
|
-
<element name="updates-document-type">
|
131
|
-
<ref name="DocumentType"/>
|
132
|
-
</element>
|
133
|
-
</define>
|
134
45
|
<define name="ISOProjectGroup">
|
135
46
|
<zeroOrMore>
|
136
47
|
<ref name="agency"/>
|
@@ -148,21 +59,11 @@
|
|
148
59
|
<ref name="secretariat"/>
|
149
60
|
</optional>
|
150
61
|
</define>
|
151
|
-
<define name="approvalgroup">
|
152
|
-
<element name="approvalgroup">
|
153
|
-
<ref name="ISOProjectGroup"/>
|
154
|
-
</element>
|
155
|
-
</define>
|
156
62
|
<define name="agency">
|
157
63
|
<element name="agency">
|
158
64
|
<text/>
|
159
65
|
</element>
|
160
66
|
</define>
|
161
|
-
<define name="horizontal">
|
162
|
-
<element name="horizontal">
|
163
|
-
<data type="boolean"/>
|
164
|
-
</element>
|
165
|
-
</define>
|
166
67
|
<define name="documentnumber">
|
167
68
|
<element name="project-number">
|
168
69
|
<optional>
|
@@ -221,11 +122,4 @@
|
|
221
122
|
<text/>
|
222
123
|
</element>
|
223
124
|
</define>
|
224
|
-
<define name="coverimages">
|
225
|
-
<element name="coverimages">
|
226
|
-
<oneOrMore>
|
227
|
-
<ref name="image"/>
|
228
|
-
</oneOrMore>
|
229
|
-
</element>
|
230
|
-
</define>
|
231
125
|
</grammar>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module JIS
|
3
|
+
class Converter < ISO::Converter
|
4
|
+
def doctype_validate(xmldoc)
|
5
|
+
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
6
|
+
%w(japanese-industrial-standard technical-report
|
7
|
+
technical-specification amendment).include? doctype or
|
8
|
+
@log.add("Document Attributes", nil,
|
9
|
+
"#{doctype} is not a recognised document type")
|
10
|
+
end
|
11
|
+
|
12
|
+
def script_validate(xmldoc)
|
13
|
+
script = xmldoc&.at("//bibdata/script")&.text
|
14
|
+
%w(Jpan Latn).include?(script) or
|
15
|
+
@log.add("Document Attributes", nil,
|
16
|
+
"#{script} is not a recognised script")
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate(doc)
|
20
|
+
content_validate(doc)
|
21
|
+
schema_validate(formattedstr_strip(doc.dup),
|
22
|
+
File.join(File.dirname(__FILE__), "jis.rng"))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-jis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|
@@ -258,9 +258,11 @@ files:
|
|
258
258
|
- lib/isodoc/jis/i18n-ja.yaml
|
259
259
|
- lib/isodoc/jis/i18n.rb
|
260
260
|
- lib/isodoc/jis/init.rb
|
261
|
+
- lib/isodoc/jis/jis.international-standard.xsl
|
261
262
|
- lib/isodoc/jis/metadata.rb
|
262
263
|
- lib/isodoc/jis/pdf_convert.rb
|
263
264
|
- lib/isodoc/jis/presentation_xml_convert.rb
|
265
|
+
- lib/isodoc/jis/word_cleanup.rb
|
264
266
|
- lib/isodoc/jis/word_convert.rb
|
265
267
|
- lib/isodoc/jis/xref.rb
|
266
268
|
- lib/metanorma-jis.rb
|
@@ -268,6 +270,7 @@ files:
|
|
268
270
|
- lib/metanorma/jis/basicdoc.rng
|
269
271
|
- lib/metanorma/jis/biblio-standoc.rng
|
270
272
|
- lib/metanorma/jis/biblio.rng
|
273
|
+
- lib/metanorma/jis/cleanup.rb
|
271
274
|
- lib/metanorma/jis/converter.rb
|
272
275
|
- lib/metanorma/jis/front.rb
|
273
276
|
- lib/metanorma/jis/isodoc.rng
|
@@ -276,6 +279,7 @@ files:
|
|
276
279
|
- lib/metanorma/jis/processor.rb
|
277
280
|
- lib/metanorma/jis/relaton-jis.rng
|
278
281
|
- lib/metanorma/jis/reqt.rng
|
282
|
+
- lib/metanorma/jis/validate.rb
|
279
283
|
- lib/metanorma/jis/version.rb
|
280
284
|
- metanorma-jis.gemspec
|
281
285
|
homepage: https://github.com/metanorma/metanorma-jis
|