metanorma-jis 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -8
- data/lib/isodoc/jis/html/html_jis_intro.html +1 -0
- data/lib/isodoc/jis/html/style-human.css +8 -0
- data/lib/isodoc/jis/html/style-iso.css +8 -0
- data/lib/isodoc/jis/html/word_jis_intro.html +0 -1
- data/lib/isodoc/jis/html/word_jis_titlepage.html +2 -1
- data/lib/isodoc/jis/i18n-en.yaml +2 -0
- data/lib/isodoc/jis/i18n-ja.yaml +3 -2
- data/lib/isodoc/jis/i18n.rb +32 -7
- data/lib/isodoc/jis/jis.international-standard.xsl +5 -3
- data/lib/isodoc/jis/metadata.rb +71 -23
- data/lib/isodoc/jis/presentation_section.rb +124 -0
- data/lib/isodoc/jis/presentation_xml_convert.rb +6 -107
- data/lib/isodoc/jis/xref.rb +4 -4
- data/lib/metanorma/jis/basicdoc.rng +26 -17
- data/lib/metanorma/jis/biblio.rng +13 -0
- data/lib/metanorma/jis/boilerplate-en.adoc +12 -0
- data/lib/metanorma/jis/boilerplate-ja.adoc +18 -0
- data/lib/metanorma/jis/cleanup.rb +16 -0
- data/lib/metanorma/jis/converter.rb +4 -4
- data/lib/metanorma/jis/front.rb +9 -117
- data/lib/metanorma/jis/isodoc.rng +11 -1
- data/lib/metanorma/jis/version.rb +1 -1
- data/metanorma-jis.gemspec +2 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b71b1b65b6b087e5dd836fd09c79edf376791e5611ff0128fe00fb70db2a3a7
|
4
|
+
data.tar.gz: a237948040d108d1753d270b73b38f6ff28d233d3756ff9146bcc308ce46755f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3b21634058781599347ebfe3dfc97c490f244a99d275c6193e5f7bbaaa427eb8c5c8e25b22a8ce7cd62a2ee497463085e47a9e0a33e2d84c9499a7f70d9756e
|
7
|
+
data.tar.gz: 3f9b6ab9ec5d19ab995ac9d734a9a96d0b09dcab67a062fd599d08205763610dd5ca2b5a32d2b9cb998395853cf913594f17e200efb48b17c298d4c38865328c
|
data/Gemfile
CHANGED
@@ -4,12 +4,6 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
group :development, :test do
|
8
|
-
gem "rspec"
|
9
|
-
end
|
10
|
-
|
11
|
-
if File.exist? "Gemfile.devel"
|
12
|
-
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
13
|
-
end
|
14
|
-
|
15
7
|
gemspec
|
8
|
+
|
9
|
+
eval_gemfile("Gemfile.devel") rescue nil
|
@@ -139,6 +139,14 @@ a.FootnoteRef, span.FootnoteRef {
|
|
139
139
|
color: red;
|
140
140
|
text-decoration: line-through; }
|
141
141
|
|
142
|
+
ruby {
|
143
|
+
ruby-position: over;
|
144
|
+
-webkit-ruby-position: before; }
|
145
|
+
|
146
|
+
ruby ruby {
|
147
|
+
ruby-position: under;
|
148
|
+
-webkit-ruby-position: after; }
|
149
|
+
|
142
150
|
/* code highlighting with line numbers */
|
143
151
|
table.rouge-line-table td.rouge-gutter {
|
144
152
|
-moz-user-select: none;
|
@@ -139,6 +139,14 @@ a.FootnoteRef, span.FootnoteRef {
|
|
139
139
|
color: red;
|
140
140
|
text-decoration: line-through; }
|
141
141
|
|
142
|
+
ruby {
|
143
|
+
ruby-position: over;
|
144
|
+
-webkit-ruby-position: before; }
|
145
|
+
|
146
|
+
ruby ruby {
|
147
|
+
ruby-position: under;
|
148
|
+
-webkit-ruby-position: after; }
|
149
|
+
|
142
150
|
/* code highlighting with line numbers */
|
143
151
|
table.rouge-line-table td.rouge-gutter {
|
144
152
|
-moz-user-select: none;
|
@@ -2,7 +2,6 @@
|
|
2
2
|
border-bottom-alt:solid windowtext .5pt;mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:
|
3
3
|
solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 0cm 4.0pt;
|
4
4
|
margin-left:5.1pt;margin-right:5.1pt'>
|
5
|
-
<div id="boilerplate-copyright-destination"/>
|
6
5
|
</div>
|
7
6
|
|
8
7
|
|
@@ -129,6 +129,7 @@ documentation.</span><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-si
|
|
129
129
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
130
130
|
</p>
|
131
131
|
|
132
|
-
<div id="boilerplate-
|
132
|
+
<div id="boilerplate-copyright-destination"/>
|
133
|
+
<div id="boilerplate-feedback-destination"/>
|
133
134
|
<div id="boilerplate-contributors"/>
|
134
135
|
|
data/lib/isodoc/jis/i18n-en.yaml
CHANGED
@@ -5,8 +5,10 @@ commentary: Commentary
|
|
5
5
|
commentary_page: Comm.
|
6
6
|
JIS: 日本工業規格
|
7
7
|
permission_footer: Duplication, reprinting, etc. without permission is prohibited by copyright law.
|
8
|
+
chairperson: chairperson
|
8
9
|
doctype_dict:
|
9
10
|
international-standard: International standard
|
11
|
+
japanese-industrial-standard: International standard
|
10
12
|
technical-specification: Technical specification
|
11
13
|
technical-report: Technical report
|
12
14
|
publicly-available-specification: Publicly Available Specification
|
data/lib/isodoc/jis/i18n-ja.yaml
CHANGED
@@ -3,16 +3,17 @@ cancelled_and_replaced: キャンセルされ、%に置き換えられました
|
|
3
3
|
norm_with_refs_pref_all_dated: 次に掲げる引用規格は,この規格に引用されることによって,その一部又は全部がこの規格の要 求事項を構成している。これらの引用規格は,記載の年の版を適用し,その後の改正版(追補を含む。) は適用しない。
|
4
4
|
norm_with_refs_pref_none_dated: 次に掲げる引用規格は,この規格に引用されることによって,その一部又は全部がこの規格の要求事項 を構成している。これらの引用規格は,その最新版(追補を含む。)を適用する。
|
5
5
|
permission_footer: 著作権法により無断での複製,転載等は禁止されております。
|
6
|
-
admitted:
|
6
|
+
admitted: 代替用語
|
7
7
|
table_footnote: 注
|
8
8
|
commentary: 解説
|
9
9
|
commentary_page: 解
|
10
10
|
JIS: 日本工業規格
|
11
11
|
draft_label: 案
|
12
12
|
white-paper: 白紙
|
13
|
+
chairperson: 委員会長
|
13
14
|
doctype_dict:
|
14
15
|
international-standard: 日本産業規格
|
15
|
-
|
16
|
+
japanese-industrial-standard: 日本産業規格
|
16
17
|
technical-specification: 標準仕様書
|
17
18
|
technical-report: 標準報告書
|
18
19
|
publicly-available-specification: Publicly Available Specification
|
data/lib/isodoc/jis/i18n.rb
CHANGED
@@ -1,15 +1,40 @@
|
|
1
|
+
require "japanese_calendar"
|
2
|
+
require "twitter_cldr"
|
3
|
+
|
1
4
|
module IsoDoc
|
2
5
|
module JIS
|
3
6
|
class I18n < IsoDoc::Iso::I18n
|
7
|
+
def load_file(fname)
|
8
|
+
f = File.join(File.dirname(__FILE__), fname)
|
9
|
+
File.exist?(f) ? YAML.load_file(f) : {}
|
10
|
+
end
|
11
|
+
|
4
12
|
def load_yaml1(lang, script)
|
5
|
-
y =
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
y = load_file("i18n-#{yaml_lang(lang, script)}.yaml")
|
14
|
+
y.empty? ? load_file("i18n-en.yaml").merge(super) : super.deep_merge(y)
|
15
|
+
end
|
16
|
+
|
17
|
+
# use Japanese ordinals for era years
|
18
|
+
def japanese_date(date)
|
19
|
+
date.nil? and return date
|
20
|
+
d = date.split(/-/).map(&:to_i)
|
21
|
+
time = Date.new(*d)
|
22
|
+
yr = japanese_year(time)
|
23
|
+
case d.size
|
24
|
+
when 1 then yr
|
25
|
+
when 2 then yr + time.strftime("%-m月")
|
26
|
+
when 3 then yr + time.strftime("%-m月%-d日")
|
27
|
+
else date
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def japanese_year(time)
|
32
|
+
era_yr = time.era_year.to_i.localize(:ja)
|
33
|
+
.to_rbnf_s("SpelloutRules", "spellout-numbering-year")
|
34
|
+
"#{time.strftime('%JN')}#{era_yr}年"
|
35
|
+
rescue
|
36
|
+
time.year.to_s
|
11
37
|
end
|
12
38
|
end
|
13
39
|
end
|
14
40
|
end
|
15
|
-
|
@@ -662,7 +662,8 @@
|
|
662
662
|
|
663
663
|
<fo:block-container absolute-position="fixed" left="0mm" top="200mm" height="69mm" text-align="center" display-align="after" font-family="IPAexMincho">
|
664
664
|
<!-- Revised on July 22, 2019 -->
|
665
|
-
<fo:block font-size="9pt">令和元年<fo:inline font-family="Times New Roman"> 7 </fo:inline>月<fo:inline font-family="Times New Roman"> 22 </fo:inline>日 改正</fo:block>
|
665
|
+
<!-- <fo:block font-size="9pt">令和元年<fo:inline font-family="Times New Roman"> 7 </fo:inline>月<fo:inline font-family="Times New Roman"> 22 </fo:inline>日 改正</fo:block> -->
|
666
|
+
<fo:block font-size="9pt"><xsl:apply-templates select="/*/jis:bibdata/jis:date[@type = 'published']/text()"/> 改正</fo:block>
|
666
667
|
<!-- Japan Industrial Standards Survey Council deliberations -->
|
667
668
|
<!-- 日本産業標準調査会 -->
|
668
669
|
<fo:block font-size="14pt" margin-top="7mm"><xsl:value-of select="/*/jis:bibdata/jis:contributor[jis:role/@type = 'authorizer']/jis:organization/jis:name/jis:variant[@language = 'ja']"/> 審議</fo:block>
|
@@ -10751,6 +10752,7 @@
|
|
10751
10752
|
$namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
|
10752
10753
|
<!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
|
10753
10754
|
<fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
|
10755
|
+
|
10754
10756
|
<fo:list-item>
|
10755
10757
|
<fo:list-item-label end-indent="label-end()">
|
10756
10758
|
<fo:block role="SKIP">
|
@@ -10953,10 +10955,10 @@
|
|
10953
10955
|
|
10954
10956
|
<xsl:variable name="toc_level">
|
10955
10957
|
<!-- https://www.metanorma.org/author/ref/document-attributes/ -->
|
10956
|
-
<xsl:variable name="
|
10958
|
+
<xsl:variable name="pdftoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'PDF TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :toclevels-pdf Number of table of contents levels to render in PDF output; used to override :toclevels:-->
|
10957
10959
|
<xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
|
10958
10960
|
<xsl:choose>
|
10959
|
-
<xsl:when test="$
|
10961
|
+
<xsl:when test="$pdftoclevels != ''"><xsl:value-of select="number($pdftoclevels)"/></xsl:when> <!-- if there is value in xml -->
|
10960
10962
|
<xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
|
10961
10963
|
<xsl:otherwise><!-- default value -->
|
10962
10964
|
2
|
data/lib/isodoc/jis/metadata.rb
CHANGED
@@ -5,25 +5,18 @@ module IsoDoc
|
|
5
5
|
module JIS
|
6
6
|
class Metadata < IsoDoc::Iso::Metadata
|
7
7
|
def title(isoxml, _out)
|
8
|
-
lang =
|
9
|
-
|
10
|
-
else "ja"
|
11
|
-
end
|
12
|
-
# intro, main, part, amd = title_parts(isoxml, lang)
|
8
|
+
lang = @lang
|
9
|
+
%w(en ja).include?(lang) or lang = "ja"
|
13
10
|
tp = title_parts(isoxml, lang)
|
14
11
|
tn = title_nums(isoxml)
|
15
|
-
|
16
|
-
set(:doctitlemain,
|
17
|
-
@c.encode(tp[:main] ? tp[:main].text : "", :hexadecimal))
|
12
|
+
set_encoded(:doctitlemain, tp[:main])
|
18
13
|
main = compose_title(tp, tn, lang)
|
19
14
|
set(:doctitle, main)
|
20
|
-
tp[:intro]
|
21
|
-
set(:doctitleintro,
|
22
|
-
@c.encode(tp[:intro] ? tp[:intro].text : "", :hexadecimal))
|
15
|
+
set_encoded(:doctitleintro, tp[:intro])
|
23
16
|
set(:doctitlepartlabel, part_prefix(tn, lang))
|
24
|
-
|
17
|
+
set_encoded(:doctitlepart, tp[:part])
|
25
18
|
set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
26
|
-
|
19
|
+
set_encoded(:doctitleamd, tp[:amd])
|
27
20
|
set(:doctitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
|
28
21
|
end
|
29
22
|
|
@@ -31,23 +24,23 @@ module IsoDoc
|
|
31
24
|
lang = @lang == "ja" ? "en" : "ja"
|
32
25
|
tp = title_parts(isoxml, lang)
|
33
26
|
tn = title_nums(isoxml)
|
34
|
-
|
35
|
-
set(:docsubtitlemain,
|
36
|
-
@c.encode(tp[:main] ? tp[:main].text : "", :hexadecimal))
|
27
|
+
set_encoded(:docsubtitlemain, tp[:main])
|
37
28
|
main = compose_title(tp, tn, lang)
|
38
29
|
set(:docsubtitle, main)
|
39
|
-
tp[:intro]
|
40
|
-
set(:docsubtitleintro,
|
41
|
-
@c.encode(tp[:intro] ? tp[:intro].text : "", :hexadecimal))
|
30
|
+
set_encoded(:docsubtitleintro, tp[:intro])
|
42
31
|
set(:docsubtitlepartlabel, part_prefix(tn, lang))
|
43
|
-
tp[:part]
|
44
|
-
set(:docsubtitlepart,
|
45
|
-
@c.encode(tp[:part].text, :hexadecimal))
|
32
|
+
set_encoded(:docsubtitlepart, tp[:part])
|
46
33
|
set(:docsubtitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
47
|
-
|
34
|
+
set_encoded(:docsubtitleamd, tp[:amd])
|
48
35
|
set(:docsubtitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
|
49
36
|
end
|
50
37
|
|
38
|
+
def set_encoded(name, field)
|
39
|
+
field or return
|
40
|
+
field.respond_to?(:text) and field = field.text
|
41
|
+
set(name, @c.encode(field, :hexadecimal))
|
42
|
+
end
|
43
|
+
|
51
44
|
PART_LABEL = { en: "Part", ja: "その" }.freeze
|
52
45
|
|
53
46
|
def docid(isoxml, _out)
|
@@ -56,6 +49,61 @@ module IsoDoc
|
|
56
49
|
set(:docnumber, id)
|
57
50
|
set(:docnumber_undated, id.sub(/:\d{4}$/, ""))
|
58
51
|
end
|
52
|
+
|
53
|
+
def bibdate(isoxml, _out)
|
54
|
+
isoxml.xpath(ns("//bibdata/date")).each do |d|
|
55
|
+
val = Common::date_range(d)
|
56
|
+
@lang == "ja" and val = @i18n.japanese_date(val)
|
57
|
+
set("#{d['type'].gsub(/-/, '_')}date".to_sym, val)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def version(isoxml, out)
|
62
|
+
super
|
63
|
+
@lang == "ja" or return
|
64
|
+
revdate = @i18n.japanese_date(isoxml
|
65
|
+
.at(ns("//bibdata/version/revision-date"))&.text)
|
66
|
+
set(:revdate, revdate)
|
67
|
+
set(:draftinfo, draftinfo(get[:draft], revdate))
|
68
|
+
end
|
69
|
+
|
70
|
+
def agency(xml)
|
71
|
+
super
|
72
|
+
investigative_organisation(xml)
|
73
|
+
investigative_committee(xml)
|
74
|
+
end
|
75
|
+
|
76
|
+
def investigative_organisation(xml)
|
77
|
+
xpath = "//bibdata/contributor" \
|
78
|
+
"[xmlns:role/@type = 'authorizer'][xmlns:role/description = " \
|
79
|
+
"'investigative organization']/organization/name"
|
80
|
+
org = xml.at(ns(xpath))
|
81
|
+
if org then set_encoded(:"investigative-organization", org)
|
82
|
+
else set(:"investigative-organization", get[:publisher])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def investigative_committee(xml)
|
87
|
+
xpath = "//bibdata/contributor" \
|
88
|
+
"[xmlns:role/@type = 'authorizer'][xmlns:role/description = " \
|
89
|
+
"'investigative committee']"
|
90
|
+
if o = xml.at(ns("#{xpath}/organization/name"))
|
91
|
+
set_encoded(:"investigative-committee", o)
|
92
|
+
elsif p = xml.at(ns("#{xpath}/person"))
|
93
|
+
investigative_committee_person(p)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def investigative_committee_person(person)
|
98
|
+
n = extract_person_names([person])
|
99
|
+
pos = person.at(ns("./affiliation/name")) || @i18n.chairperson
|
100
|
+
org = person.at(ns("./affiliation/organization/name"))
|
101
|
+
set_encoded(:"investigative-committee", org)
|
102
|
+
unless n.empty?
|
103
|
+
set_encoded(:"investigative-committee-representative-role", pos)
|
104
|
+
set(:"investigative-committee-representative-name", n.first)
|
105
|
+
end
|
106
|
+
end
|
59
107
|
end
|
60
108
|
end
|
61
109
|
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require_relative "init"
|
2
|
+
require "isodoc"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module JIS
|
6
|
+
class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
|
7
|
+
def annex1(elem)
|
8
|
+
elem["commentary"] == "true" and return commentary(elem)
|
9
|
+
lbl = @xrefs.anchor(elem["id"], :label)
|
10
|
+
if t = elem.at(ns("./title"))
|
11
|
+
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
12
|
+
end
|
13
|
+
prefix_name(elem, "<br/>", lbl, "title")
|
14
|
+
end
|
15
|
+
|
16
|
+
def annex(docxml)
|
17
|
+
super
|
18
|
+
move_commentaries_to_end(docxml)
|
19
|
+
end
|
20
|
+
|
21
|
+
def move_commentaries_to_end(docxml)
|
22
|
+
docxml.at(ns("//annex[@commentary = 'true']")) or return
|
23
|
+
b = docxml.at(ns("//bibliography")) ||
|
24
|
+
docxml.at(ns("//annex[last()]")).after(" ").next
|
25
|
+
docxml.xpath(ns("//annex[@commentary = 'true']")).reverse.each do |x|
|
26
|
+
b.next = x.remove
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def commentary(elem)
|
31
|
+
t = elem.elements.first
|
32
|
+
commentary_title_hdr(t)
|
33
|
+
middle_title_main(t, "CommentaryStandardName")
|
34
|
+
end
|
35
|
+
|
36
|
+
def commentary_title_hdr(elem)
|
37
|
+
ret = <<~COMMENTARY
|
38
|
+
<p class="CommentaryStandardNumber">JIS #{@meta.get[:docnumber_undated]}
|
39
|
+
COMMENTARY
|
40
|
+
yr = @meta.get[:docyear] and
|
41
|
+
ret += ": <span class='CommentaryEffectiveYear'>#{yr}</span>"
|
42
|
+
elem.previous = ret
|
43
|
+
end
|
44
|
+
|
45
|
+
def toc_title_insert_pt(docxml)
|
46
|
+
ins = docxml.at(ns("//preface")) ||
|
47
|
+
docxml.at(ns("//sections | //annex | //bibliography"))
|
48
|
+
&.before("<preface> </preface>")
|
49
|
+
&.previous_element or return nil
|
50
|
+
ins.children.last.after(" ").next
|
51
|
+
end
|
52
|
+
|
53
|
+
def preface_rearrange(doc)
|
54
|
+
move_introduction(doc)
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
def move_introduction(doc)
|
59
|
+
source = doc.at(ns("//preface/introduction")) or return
|
60
|
+
dest = doc.at(ns("//sections")) ||
|
61
|
+
doc.at(ns("//preface")).after("<sections> </sections>").next_element
|
62
|
+
dest.children.empty? and dest.children = " "
|
63
|
+
dest.children.first.next = source
|
64
|
+
end
|
65
|
+
|
66
|
+
def middle_title(docxml)
|
67
|
+
s = docxml.at(ns("//sections")) or return
|
68
|
+
elem = s.children.first
|
69
|
+
middle_title_hdr(elem)
|
70
|
+
middle_title_main(elem, "zzSTDTitle1")
|
71
|
+
middle_subtitle_main(elem, "zzSTDTitle2")
|
72
|
+
# middle_title_amd(s.children.first)
|
73
|
+
end
|
74
|
+
|
75
|
+
def middle_title_hdr(out)
|
76
|
+
ret = "<p class='JapaneseIndustrialStandard'>#{@i18n.jis}"
|
77
|
+
@meta.get[:unpublished] and ret += @i18n.l10n("(#{@i18n.draft_label})")
|
78
|
+
ret += ("<tab/>" * 7)
|
79
|
+
ret += "<span class='JIS'>JIS</span></p>"
|
80
|
+
ret += "<p class='StandardNumber'><tab/>#{@meta.get[:docnumber_undated]}"
|
81
|
+
if yr = @meta.get[:docyear]
|
82
|
+
ret += ": <span class='EffectiveYear'>#{yr}</span>"
|
83
|
+
end
|
84
|
+
ret += "</p><p class='IDT'/>"
|
85
|
+
out.previous = ret
|
86
|
+
end
|
87
|
+
|
88
|
+
def middle_title_main(out, style)
|
89
|
+
t = @meta.get[:doctitlemain]
|
90
|
+
(t && !t.empty?) or return
|
91
|
+
ret =
|
92
|
+
middle_title_para(style, :doctitleintro, :doctitlemain, :doctitlepart)
|
93
|
+
if a = @meta.get[:doctitlepart]
|
94
|
+
ret += "<p class='zzSTDTitle1'>"
|
95
|
+
b = @meta.get[:doctitlepartlabel] and ret += "#{b}: "
|
96
|
+
ret += "<br/><strong>#{a}</strong></p>"
|
97
|
+
end
|
98
|
+
out.previous = ret
|
99
|
+
end
|
100
|
+
|
101
|
+
def middle_subtitle_main(out, style)
|
102
|
+
t = @meta.get[:docsubtitlemain]
|
103
|
+
(t && !t.empty?) or return
|
104
|
+
ret = middle_title_para(style, :docsubtitleintro, :docsubtitlemain,
|
105
|
+
:docsubtitlepart)
|
106
|
+
if a = @meta.get[:docsubtitlepart]
|
107
|
+
ret += "<p class='zzSTDTitle2'>"
|
108
|
+
b = @meta.get[:docsubtitlepartlabel] and ret += "#{b}: "
|
109
|
+
ret += "<br/><strong>#{a}</strong></p>"
|
110
|
+
end
|
111
|
+
out.previous = ret
|
112
|
+
end
|
113
|
+
|
114
|
+
def middle_title_para(style, intro, main, part)
|
115
|
+
ret = "<p class='#{style}'>#{@meta.get[intro]}"
|
116
|
+
ret += " — " if @meta.get[intro] && @meta.get[main]
|
117
|
+
ret += @meta.get[main]
|
118
|
+
ret += " — " if @meta.get[main] && @meta.get[part]
|
119
|
+
ret += "</p>"
|
120
|
+
ret
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative "init"
|
2
2
|
require "isodoc"
|
3
|
+
require_relative "presentation_section"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module JIS
|
@@ -134,44 +135,6 @@ module IsoDoc
|
|
134
135
|
"<tr><td border='0' colspan='#{cols}'>#{elem}</td></tr>"
|
135
136
|
end
|
136
137
|
|
137
|
-
def annex1(elem)
|
138
|
-
elem["commentary"] == "true" and return commentary(elem)
|
139
|
-
lbl = @xrefs.anchor(elem["id"], :label)
|
140
|
-
if t = elem.at(ns("./title"))
|
141
|
-
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
142
|
-
end
|
143
|
-
prefix_name(elem, "<br/>", lbl, "title")
|
144
|
-
end
|
145
|
-
|
146
|
-
def annex(docxml)
|
147
|
-
super
|
148
|
-
move_commentaries_to_end(docxml)
|
149
|
-
end
|
150
|
-
|
151
|
-
def move_commentaries_to_end(docxml)
|
152
|
-
docxml.at(ns("//annex[@commentary = 'true']")) or return
|
153
|
-
b = docxml.at(ns("//bibliography")) ||
|
154
|
-
docxml.at(ns("//annex[last()]")).after(" ").next
|
155
|
-
docxml.xpath(ns("//annex[@commentary = 'true']")).reverse.each do |x|
|
156
|
-
b.next = x.remove
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def commentary(elem)
|
161
|
-
t = elem.elements.first
|
162
|
-
commentary_title_hdr(t)
|
163
|
-
middle_title_main(t, "CommentaryStandardName")
|
164
|
-
end
|
165
|
-
|
166
|
-
def commentary_title_hdr(elem)
|
167
|
-
ret = <<~COMMENTARY
|
168
|
-
<p class="CommentaryStandardNumber">JIS #{@meta.get[:docnumber_undated]}
|
169
|
-
COMMENTARY
|
170
|
-
yr = @meta.get[:docyear] and
|
171
|
-
ret += ": <span class='CommentaryEffectiveYear'>#{yr}</span>"
|
172
|
-
elem.previous = ret
|
173
|
-
end
|
174
|
-
|
175
138
|
def tablesource(elem)
|
176
139
|
while elem&.next_element&.name == "source"
|
177
140
|
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
@@ -179,79 +142,15 @@ module IsoDoc
|
|
179
142
|
elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
|
180
143
|
end
|
181
144
|
|
182
|
-
def
|
183
|
-
ins = docxml.at(ns("//preface")) ||
|
184
|
-
docxml.at(ns("//sections | //annex | //bibliography"))
|
185
|
-
&.before("<preface> </preface>")
|
186
|
-
&.previous_element or return nil
|
187
|
-
ins.children.last.after(" ").next
|
188
|
-
end
|
189
|
-
|
190
|
-
def preface_rearrange(doc)
|
191
|
-
move_introduction(doc)
|
145
|
+
def bibdata_i18n(bibdata)
|
192
146
|
super
|
147
|
+
@lang == "ja" and date_translate(bibdata)
|
193
148
|
end
|
194
149
|
|
195
|
-
def
|
196
|
-
|
197
|
-
|
198
|
-
doc.at(ns("//preface")).after("<sections> </sections>").next_element
|
199
|
-
dest.children.empty? and dest.children = " "
|
200
|
-
dest.children.first.next = source
|
201
|
-
end
|
202
|
-
|
203
|
-
def middle_title(docxml)
|
204
|
-
s = docxml.at(ns("//sections")) or return
|
205
|
-
elem = s.children.first
|
206
|
-
middle_title_hdr(elem)
|
207
|
-
middle_title_main(elem, "zzSTDTitle1")
|
208
|
-
middle_subtitle_main(elem)
|
209
|
-
# middle_title_amd(s.children.first)
|
210
|
-
end
|
211
|
-
|
212
|
-
def middle_title_hdr(out)
|
213
|
-
ret = "<p class='JapaneseIndustrialStandard'>#{@i18n.jis}"
|
214
|
-
@meta.get[:unpublished] and ret += @i18n.l10n("(#{@i18n.draft_label})")
|
215
|
-
ret += ("<tab/>" * 7)
|
216
|
-
ret += "<span class='JIS'>JIS</span></p>"
|
217
|
-
ret += "<p class='StandardNumber'><tab/>#{@meta.get[:docnumber_undated]}"
|
218
|
-
if yr = @meta.get[:docyear]
|
219
|
-
ret += ": <span class='EffectiveYear'>#{yr}</span>"
|
220
|
-
end
|
221
|
-
ret += "</p><p class='IDT'/>"
|
222
|
-
out.previous = ret
|
223
|
-
end
|
224
|
-
|
225
|
-
def middle_title_main(out, style)
|
226
|
-
t = @meta.get[:doctitlemain]
|
227
|
-
(t && !t.empty?) or return
|
228
|
-
ret = "<p class='#{style}'>#{@meta.get[:doctitleintro]}"
|
229
|
-
ret += " — " if @meta.get[:doctitleintro] && t
|
230
|
-
ret += t
|
231
|
-
ret += " — " if t && @meta.get[:doctitlepart]
|
232
|
-
ret += "</p>"
|
233
|
-
if a = @meta.get[:doctitlepart]
|
234
|
-
ret += "<p class='zzSTDTitle1'>"
|
235
|
-
b = @meta.get[:doctitlepartlabel] and ret += "#{b}: "
|
236
|
-
ret += "<br/><strong>#{a}</strong></p>"
|
237
|
-
end
|
238
|
-
out.previous = ret
|
239
|
-
end
|
240
|
-
|
241
|
-
def middle_subtitle_main(out)
|
242
|
-
t = @meta.get[:docsubtitlemain]
|
243
|
-
(t && !t.empty?) or return
|
244
|
-
ret = "<p class='zzSTDTitle2'>#{@meta.get[:docsubtitleintro]}"
|
245
|
-
ret += " — " if @meta.get[:docsubtitleintro] && t
|
246
|
-
ret += @meta.get[:docsubtitlemain]
|
247
|
-
ret += " — " if t && @meta.get[:docsubtitlepart]
|
248
|
-
ret += "</p>"
|
249
|
-
if a = @meta.get[:docsubtitlepart]
|
250
|
-
ret += "<p class='zzSTDTitle2'>"
|
251
|
-
b = @meta.get[:docsubtitlepartlabel] and ret += "#{b}: "
|
252
|
-
ret += "<br/><strong>#{a}</strong></p>"
|
150
|
+
def date_translate(bibdata)
|
151
|
+
bibdata.xpath(ns("./date")).each do |d|
|
152
|
+
d.children = @i18n.japanese_date(d.text.strip)
|
253
153
|
end
|
254
|
-
out.previous = ret
|
255
154
|
end
|
256
155
|
|
257
156
|
include Init
|
data/lib/isodoc/jis/xref.rb
CHANGED
@@ -59,11 +59,11 @@ module IsoDoc
|
|
59
59
|
def back_clauses_anchor_names(xml)
|
60
60
|
clause_order_back(xml).each do |a|
|
61
61
|
xml.xpath(ns(a[:path])).each do |c|
|
62
|
-
if c["commentary"] == "true"
|
63
|
-
|
64
|
-
else
|
65
|
-
preface_names(c)
|
62
|
+
if c["commentary"] == "true" then commentary_names(c)
|
63
|
+
else preface_names(c)
|
66
64
|
end
|
65
|
+
x = Nokogiri::XML::NodeSet.new(c.document, [c])
|
66
|
+
sequential_asset_names(x, container: true)
|
67
67
|
a[:multi] or break
|
68
68
|
end
|
69
69
|
end
|
@@ -715,27 +715,36 @@
|
|
715
715
|
</define>
|
716
716
|
<define name="ruby">
|
717
717
|
<element name="ruby">
|
718
|
-
<
|
719
|
-
<
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
718
|
+
<choice>
|
719
|
+
<ref name="ruby_pronunciation"/>
|
720
|
+
<ref name="ruby_annotation"/>
|
721
|
+
</choice>
|
722
|
+
<choice>
|
723
|
+
<text/>
|
724
|
+
<ref name="ruby"/>
|
725
|
+
</choice>
|
725
726
|
</element>
|
726
727
|
</define>
|
727
|
-
<define name="
|
728
|
-
<element name="
|
729
|
-
<
|
730
|
-
|
731
|
-
|
728
|
+
<define name="ruby_pronunciation">
|
729
|
+
<element name="pronunciation">
|
730
|
+
<attribute name="value"/>
|
731
|
+
<optional>
|
732
|
+
<attribute name="script"/>
|
733
|
+
</optional>
|
734
|
+
<optional>
|
735
|
+
<attribute name="lang"/>
|
736
|
+
</optional>
|
732
737
|
</element>
|
733
738
|
</define>
|
734
|
-
<define name="
|
735
|
-
<element name="
|
736
|
-
<
|
737
|
-
|
738
|
-
|
739
|
+
<define name="ruby_annotation">
|
740
|
+
<element name="annotation">
|
741
|
+
<attribute name="value"/>
|
742
|
+
<optional>
|
743
|
+
<attribute name="script"/>
|
744
|
+
</optional>
|
745
|
+
<optional>
|
746
|
+
<attribute name="lang"/>
|
747
|
+
</optional>
|
739
748
|
</element>
|
740
749
|
</define>
|
741
750
|
<define name="br">
|
@@ -374,6 +374,16 @@
|
|
374
374
|
<ref name="image"/>
|
375
375
|
</element>
|
376
376
|
</define>
|
377
|
+
<define name="depiction">
|
378
|
+
<element name="depiction">
|
379
|
+
<optional>
|
380
|
+
<attribute name="scope"/>
|
381
|
+
</optional>
|
382
|
+
<zeroOrMore>
|
383
|
+
<ref name="image"/>
|
384
|
+
</zeroOrMore>
|
385
|
+
</element>
|
386
|
+
</define>
|
377
387
|
<define name="NameWithVariants">
|
378
388
|
<element name="primary">
|
379
389
|
<ref name="LocalizedString"/>
|
@@ -760,6 +770,9 @@
|
|
760
770
|
<optional>
|
761
771
|
<ref name="validity"/>
|
762
772
|
</optional>
|
773
|
+
<optional>
|
774
|
+
<ref name="depiction"/>
|
775
|
+
</optional>
|
763
776
|
</define>
|
764
777
|
<define name="ReducedBibliographicItem">
|
765
778
|
<optional>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
== copyright-statement
|
2
|
+
|
3
|
+
Competent Minister: Minister of Economy, Trade and Industry Established: October 31, 1951 Revised: {{ revdate }}
|
4
|
+
Date of publication in the Official Gazette: {{ announceddate }}
|
5
|
+
Draft creator: Japanese Standards Association
|
6
|
+
(Mita MT Building, 3-13-12 Mita, Minato-ku, Tokyo 108-0073 Tel: 03-4231-8530)
|
7
|
+
Investigative Working Group: {{ investigative-organization }} {{ investigative-committee }}
|
8
|
+
{% if investigative-committee-representative-name %}({{ investigative-committee-representative-role | capitalize }}: {{ investigative-committee-representative-name }}){% endif %}
|
9
|
+
|
10
|
+
== feedback-statement
|
11
|
+
|
12
|
+
Any comments or questions regarding this standard should be directed to the above drafter or the International Standardization Division, Industrial Science and Technology Policy and Environment Bureau, Ministry of Economy, Trade and Industry (Tokyo 100-8901 Tokyo, Japan). Please contact 1-3-1 Kasumigaseki, Chiyoda-ku, Tokyo. In accordance with the provisions of the Industrial Standardization Law, Japanese Industrial Standards shall be reviewed by the Japan Industrial Standards Committee by the date when at least five years have passed. It will be put up for discussion and promptly confirmed, amended or repealed.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
== copyright-statement
|
2
|
+
|
3
|
+
主 務 大 臣:経済産業大臣 制定:昭和 26.10.31 改正:{{ revdate }}
|
4
|
+
|
5
|
+
官 報 掲 載 日:{{ announceddate }}
|
6
|
+
|
7
|
+
原 案 作 成 者:一般財団法人日本規格協会
|
8
|
+
|
9
|
+
(〒108-0073 東京都港区三田 3-13-12 三田 MT ビル TEL 03-4231-8530)
|
10
|
+
|
11
|
+
審 議 部 会:{{ investigative-organization }}{{ investigative-committee }}{% if investigative-committee-representative-name %}({{ investigative-committee-representative-role }} {{ investigative-committee-representative-name }}){% endif %}
|
12
|
+
|
13
|
+
== feedback-statement
|
14
|
+
|
15
|
+
|
16
|
+
この規格についての意見又は質問は,上記原案作成者又は経済産業省産業技術環境局 国際標準課(〒100-8901 東京 都千代田区霞が関 1-3-1)にご連絡ください。
|
17
|
+
|
18
|
+
なお,日本産業規格は,産業標準化法の規定によって,少なくとも 5 年を経過する日までに日本産業標準調査会の審 議に付され,速やかに,確認,改正又は廃止されます。
|
@@ -61,6 +61,22 @@ module Metanorma
|
|
61
61
|
n.delete("keep-separate")
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
def bibdata_cleanup(xmldoc)
|
66
|
+
super
|
67
|
+
bibdata_supply_chairperson_role(xmldoc)
|
68
|
+
end
|
69
|
+
|
70
|
+
def bibdata_supply_chairperson_role(xmldoc)
|
71
|
+
xpath =
|
72
|
+
"//bibdata/contributor" \
|
73
|
+
"[role/@type = 'authorizer'][role/description = " \
|
74
|
+
"'investigative committee']/person/affiliation"
|
75
|
+
xmldoc.xpath(xpath).each do |a|
|
76
|
+
a.at("./name") or next
|
77
|
+
a.children.first.previous = "<name>#{@i18n.chairperson}</name>"
|
78
|
+
end
|
79
|
+
end
|
64
80
|
end
|
65
81
|
end
|
66
82
|
end
|
@@ -25,10 +25,6 @@ module Metanorma
|
|
25
25
|
ret
|
26
26
|
end
|
27
27
|
|
28
|
-
def boilerplate_file(_x_orig)
|
29
|
-
File.join(@libdir, "jis_intro_jp.xml")
|
30
|
-
end
|
31
|
-
|
32
28
|
def section_attributes(node)
|
33
29
|
ret = super
|
34
30
|
if node.attr("style") == "appendix" && node.level == 1 &&
|
@@ -44,6 +40,10 @@ module Metanorma
|
|
44
40
|
.merge("keep-separate": node.attr("keep-separate")))
|
45
41
|
end
|
46
42
|
|
43
|
+
def boilerplate_file(_x_orig)
|
44
|
+
File.join(@libdir, "boilerplate-#{@lang}.adoc")
|
45
|
+
end
|
46
|
+
|
47
47
|
def html_converter(node)
|
48
48
|
if node.nil?
|
49
49
|
IsoDoc::JIS::HtmlConvert.new({})
|
data/lib/metanorma/jis/front.rb
CHANGED
@@ -11,35 +11,13 @@ module Metanorma
|
|
11
11
|
"JIS"
|
12
12
|
end
|
13
13
|
|
14
|
-
# # Like the ISO code, but multilingual
|
15
|
-
# def metadata_author(node, xml)
|
16
|
-
# metadata_contrib_sdo(node, xml, JIS_HASH,
|
17
|
-
# { role: "author", sourcerole: "publisher" })
|
18
|
-
# node.attr("doctype") == "expert-commentary" and
|
19
|
-
# personal_author(node, xml)
|
20
|
-
# end
|
21
|
-
|
22
14
|
def metadata_author(node, xml)
|
23
15
|
org_contributor(node, xml,
|
24
16
|
{ source: ["publisher", "pub"], role: "author",
|
25
17
|
default: JIS_HASH })
|
26
|
-
node
|
27
|
-
personal_author(node, xml)
|
18
|
+
personal_author(node, xml)
|
28
19
|
end
|
29
20
|
|
30
|
-
# def metadata_publisher(node, xml)
|
31
|
-
# metadata_contrib_sdo(node, xml, JIS_HASH,
|
32
|
-
# { role: "publisher", sourcerole: "publisher" })
|
33
|
-
# metadata_contrib_sdo(node, xml, nil,
|
34
|
-
# { role: "authorizer",
|
35
|
-
# sourcerole: "investigative-organization",
|
36
|
-
# desc: "Investigative organization" })
|
37
|
-
# metadata_contrib_sdo(node, xml, nil,
|
38
|
-
# { role: "authorizer",
|
39
|
-
# sourcerole: "investigative-committee",
|
40
|
-
# desc: "Investigative committee" })
|
41
|
-
# end
|
42
|
-
|
43
21
|
def metadata_publisher(node, xml)
|
44
22
|
[{ source: ["publisher", "pub"], role: "publisher", default: JIS_HASH },
|
45
23
|
{ role: "authorizer",
|
@@ -57,60 +35,6 @@ module Metanorma
|
|
57
35
|
JIS_HASH =
|
58
36
|
{ "ja" => "日本工業規格", "en" => "Japanese Industrial Standards" }.freeze
|
59
37
|
|
60
|
-
# def metadata_contrib_sdo(node, xml, default_value, opt)
|
61
|
-
# pub, default = metadata_contrib_extract(node, opt[:sourcerole], default_value)
|
62
|
-
# metadata_contrib_sdo_build(node, xml, pub, default, opt)
|
63
|
-
# end
|
64
|
-
#
|
65
|
-
# def metadata_contrib_sdo_build(node, xml, pub, default, opt)
|
66
|
-
# pub&.each do |p|
|
67
|
-
# xml.contributor do |c|
|
68
|
-
# c.role type: opt[:role] do |r|
|
69
|
-
# opt[:desc] and r.description opt[:desc]
|
70
|
-
# end
|
71
|
-
# c.organization do |a|
|
72
|
-
# organization(a, p, opt[:role] == "publisher", node, default)
|
73
|
-
# end
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
# end
|
77
|
-
#
|
78
|
-
# def metadata_contrib_extract(node, role, default_value)
|
79
|
-
# pub, default = multiling_docattr_csv(node, role, LANGS, default_value)
|
80
|
-
# a = node.attr("#{role}-abbr") and abbr = a # one abbrev for all languages
|
81
|
-
# [pub&.map { |p| { name: p, abbr: abbr } }, default]
|
82
|
-
# end
|
83
|
-
#
|
84
|
-
# def multiling_docattr(node, attr, langs)
|
85
|
-
# ret = node.attr(attr) and return ret
|
86
|
-
# ret = langs.each_with_object({}).each do |l, m|
|
87
|
-
# x = node.attr("#{attr}-#{l}") and m[l] = x
|
88
|
-
# end.compact
|
89
|
-
# ret.empty? and return nil
|
90
|
-
# ret
|
91
|
-
# end
|
92
|
-
#
|
93
|
-
# def multiling_docattr_csv(node, attr, langs, default)
|
94
|
-
# ret = multiling_docattr(node, attr, langs)
|
95
|
-
# not_found = ret.nil?
|
96
|
-
# ret ||= default
|
97
|
-
# ret &&= if ret.is_a?(Hash) then interleave_multiling_docattr(ret)
|
98
|
-
# else csv_split(ret)
|
99
|
-
# end
|
100
|
-
# [ret, not_found]
|
101
|
-
# end
|
102
|
-
#
|
103
|
-
# # TODO abort if CSV count different between different languages
|
104
|
-
# def interleave_multiling_docattr(ret)
|
105
|
-
# h = ret.transform_values { |v| csv_split(v) }
|
106
|
-
# h.each_with_object([]) do |(k, v), m|
|
107
|
-
# v.each_with_index do |v1, i|
|
108
|
-
# m[i] ||= {}
|
109
|
-
# m[i][k] = v1
|
110
|
-
# end
|
111
|
-
# end
|
112
|
-
# end
|
113
|
-
|
114
38
|
def org_organization(node, xml, org)
|
115
39
|
organization(xml, { name: org[:name], abbr: org[:abbr] }.compact,
|
116
40
|
node, !multiling_docattr(node, "publisher", "", LANGS))
|
@@ -120,9 +44,9 @@ module Metanorma
|
|
120
44
|
|
121
45
|
def org_attrs_parse(node, opts)
|
122
46
|
source = opts[:source]&.detect { |s| node.attr(s) }
|
123
|
-
|
124
|
-
|
125
|
-
|
47
|
+
source ||= opts[:source]&.detect do |s|
|
48
|
+
LANGS.detect { |l| node.attr("#{s}-#{l}") }
|
49
|
+
end
|
126
50
|
org_attrs_simple_parse(node, opts, source) ||
|
127
51
|
org_attrs_complex_parse(node, opts, source)
|
128
52
|
end
|
@@ -140,6 +64,7 @@ module Metanorma
|
|
140
64
|
end
|
141
65
|
|
142
66
|
def multiling_docattr(node, attr, suffix, langs)
|
67
|
+
node.nil? and return nil
|
143
68
|
ret = node.attr(attr + suffix) and return ret
|
144
69
|
ret = langs.each_with_object({}).each do |l, m|
|
145
70
|
x = node.attr("#{attr}-#{l}#{suffix}") and m[l] = x
|
@@ -189,28 +114,10 @@ module Metanorma
|
|
189
114
|
multiling_noko_value(a, "subdivision", xml)
|
190
115
|
abbr = org[:abbr]
|
191
116
|
abbr ||= org_abbrev[name_str]
|
192
|
-
default_org && b = node
|
117
|
+
default_org && b = node&.attr("subdivision-abbr") and abbr = b
|
193
118
|
abbr and xml.abbreviation abbr
|
194
119
|
end
|
195
120
|
|
196
|
-
# def metadata_copyright(node, xml)
|
197
|
-
# pub, default = metadata_contrib_extract(node, "copyright-holder", nil)
|
198
|
-
# if default
|
199
|
-
# pub, default = metadata_contrib_extract(node, "publisher", JIS_HASH)
|
200
|
-
# end
|
201
|
-
#
|
202
|
-
# pub&.each do |p|
|
203
|
-
# xml.copyright do |c|
|
204
|
-
# c.from (node.attr("copyright-year") || Date.today.year)
|
205
|
-
# c.owner do |owner|
|
206
|
-
# owner.organization do |o|
|
207
|
-
# organization(o, p, true, node, default)
|
208
|
-
# end
|
209
|
-
# end
|
210
|
-
# end
|
211
|
-
# end
|
212
|
-
# end
|
213
|
-
|
214
121
|
def copyright_parse(node)
|
215
122
|
opt = { source: ["copyright-holder", "publisher", "pub"],
|
216
123
|
role: "publisher", default: JIS_HASH }
|
@@ -231,8 +138,6 @@ module Metanorma
|
|
231
138
|
end
|
232
139
|
|
233
140
|
def metadata_id(node, xml)
|
234
|
-
node.attr("docidentifier") || node.attr("docnumber") or
|
235
|
-
@fatalerror << "No docnumber attribute supplied"
|
236
141
|
if id = node.attr("docidentifier")
|
237
142
|
xml.docidentifier id.sub(/^JIS /, ""), **attr_code(type: "JIS")
|
238
143
|
else iso_id(node, xml)
|
@@ -249,21 +154,8 @@ module Metanorma
|
|
249
154
|
end
|
250
155
|
end
|
251
156
|
|
252
|
-
def
|
253
|
-
|
254
|
-
return
|
255
|
-
params = iso_id_params(node)
|
256
|
-
iso_id_out(xml, params, true)
|
257
|
-
end
|
258
|
-
|
259
|
-
def iso_id_params(node)
|
260
|
-
params = iso_id_params_core(node)
|
261
|
-
params2 = iso_id_params_add(node)
|
262
|
-
if node.attr("updates")
|
263
|
-
orig_id = Pubid::Jis::Identifier::Base.parse(node.attr("updates"))
|
264
|
-
orig_id.edition ||= 1
|
265
|
-
end
|
266
|
-
iso_id_params_resolve(params, params2, node, orig_id)
|
157
|
+
def base_pubid
|
158
|
+
Pubid::Jis::Identifier
|
267
159
|
end
|
268
160
|
|
269
161
|
def iso_id_params_core(node)
|
@@ -290,7 +182,7 @@ module Metanorma
|
|
290
182
|
end
|
291
183
|
|
292
184
|
def iso_id_default(params)
|
293
|
-
|
185
|
+
base_pubid.create(**params)
|
294
186
|
rescue StandardError => e
|
295
187
|
clean_abort("Document identifier: #{e}", xml)
|
296
188
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.9 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -1958,6 +1958,16 @@
|
|
1958
1958
|
<data type="boolean"/>
|
1959
1959
|
</attribute>
|
1960
1960
|
</optional>
|
1961
|
+
<optional>
|
1962
|
+
<attribute name="type">
|
1963
|
+
<choice>
|
1964
|
+
<value>letter</value>
|
1965
|
+
<value>symbol</value>
|
1966
|
+
<value>formula</value>
|
1967
|
+
<value>equation</value>
|
1968
|
+
</choice>
|
1969
|
+
</attribute>
|
1970
|
+
</optional>
|
1961
1971
|
<element name="name">
|
1962
1972
|
<oneOrMore>
|
1963
1973
|
<choice>
|
data/metanorma-jis.gemspec
CHANGED
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
f.match(%r{^(test|spec|features|bin|.github)/}) \
|
28
28
|
|| f.match(%r{Rakefile|bin/rspec})
|
29
29
|
end
|
30
|
-
spec.test_files
|
30
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
31
31
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
32
32
|
|
33
|
+
spec.add_dependency "japanese_calendar", "~> 0"
|
33
34
|
spec.add_dependency "metanorma-iso", "~> 2.6.0"
|
34
35
|
spec.add_dependency "pubid-jis"
|
35
36
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-jis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
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-
|
11
|
+
date: 2023-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: japanese_calendar
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: metanorma-iso
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +276,7 @@ files:
|
|
262
276
|
- lib/isodoc/jis/jis.international-standard.xsl
|
263
277
|
- lib/isodoc/jis/metadata.rb
|
264
278
|
- lib/isodoc/jis/pdf_convert.rb
|
279
|
+
- lib/isodoc/jis/presentation_section.rb
|
265
280
|
- lib/isodoc/jis/presentation_xml_convert.rb
|
266
281
|
- lib/isodoc/jis/table.rb
|
267
282
|
- lib/isodoc/jis/word_cleanup.rb
|
@@ -272,6 +287,8 @@ files:
|
|
272
287
|
- lib/metanorma/jis/basicdoc.rng
|
273
288
|
- lib/metanorma/jis/biblio-standoc.rng
|
274
289
|
- lib/metanorma/jis/biblio.rng
|
290
|
+
- lib/metanorma/jis/boilerplate-en.adoc
|
291
|
+
- lib/metanorma/jis/boilerplate-ja.adoc
|
275
292
|
- lib/metanorma/jis/cleanup.rb
|
276
293
|
- lib/metanorma/jis/converter.rb
|
277
294
|
- lib/metanorma/jis/front.rb
|