metanorma-jis 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bbc9bfd3ed93ebd4eb27838a31bae9b074c79c280f0eee5c476475de1239a9c
4
- data.tar.gz: 3404f0677c547960ef888d5503ed89b942a21c33812bb3ae042c9ed7d09f5fdb
3
+ metadata.gz: 7b71b1b65b6b087e5dd836fd09c79edf376791e5611ff0128fe00fb70db2a3a7
4
+ data.tar.gz: a237948040d108d1753d270b73b38f6ff28d233d3756ff9146bcc308ce46755f
5
5
  SHA512:
6
- metadata.gz: '0839e480d352f8971eda023631979408b4ac4f352b06673b17e5ee02f3280842c2e51a40b9cd1bb091494f54cc9cc4235453d8d8ee18458bad55f43fe9228ec3'
7
- data.tar.gz: bcaf0551aa3d35711b213137019a580eb84ae83c4b13a409c76644fc2af6eb577e06d46acb65260a48699598537064a6354fb35072392137161405097bc22798
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
@@ -1,4 +1,5 @@
1
1
  <div id="boilerplate-copyright-destination"/>
2
+ <div id="boilerplate-feedback-destination"/>
2
3
 
3
4
  <nav>
4
5
 
@@ -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-inner-cover-note"/>
132
+ <div id="boilerplate-copyright-destination"/>
133
+ <div id="boilerplate-feedback-destination"/>
133
134
  <div id="boilerplate-contributors"/>
134
135
 
@@ -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
@@ -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
- japaanese-industrial-standard: 日本産業規格
16
+ japanese-industrial-standard: 日本産業規格
16
17
  technical-specification: 標準仕様書
17
18
  technical-report: 標準報告書
18
19
  publicly-available-specification: Publicly Available Specification
@@ -1,3 +1,6 @@
1
+ require "japanese_calendar"
2
+ require "twitter_cldr"
3
+
1
4
  module IsoDoc
2
5
  module JIS
3
6
  class I18n < IsoDoc::Iso::I18n
@@ -10,6 +13,28 @@ module IsoDoc
10
13
  y = load_file("i18n-#{yaml_lang(lang, script)}.yaml")
11
14
  y.empty? ? load_file("i18n-en.yaml").merge(super) : super.deep_merge(y)
12
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
37
+ end
13
38
  end
14
39
  end
15
40
  end
@@ -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="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
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="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
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
@@ -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 = case @lang
9
- when "ja", "en" then @lang
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] and
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
- set(:doctitlepart, @c.encode(tp[:part].text, :hexadecimal)) if tp[:part]
17
+ set_encoded(:doctitlepart, tp[:part])
25
18
  set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
26
- set(:doctitleamd, @c.encode(tp[:amd].text, :hexadecimal)) if tp[:amd]
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] and
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] and
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
- set(:docsubtitleamd, @c.encode(tp[:amd].text, :hexadecimal)) if tp[:amd]
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 += " &#x2014; " if @meta.get[intro] && @meta.get[main]
117
+ ret += @meta.get[main]
118
+ ret += " &#x2014; " 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,82 +142,15 @@ module IsoDoc
179
142
  elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
180
143
  end
181
144
 
182
- def toc_title_insert_pt(docxml)
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 move_introduction(doc)
196
- source = doc.at(ns("//preface/introduction")) or return
197
- dest = doc.at(ns("//sections")) ||
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, "zzSTDTitle2")
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 =
229
- middle_title_para(style, :doctitleintro, :doctitlemain, :doctitlepart)
230
- if a = @meta.get[:doctitlepart]
231
- ret += "<p class='zzSTDTitle1'>"
232
- b = @meta.get[:doctitlepartlabel] and ret += "#{b}: "
233
- ret += "<br/><strong>#{a}</strong></p>"
234
- end
235
- out.previous = ret
236
- end
237
-
238
- def middle_subtitle_main(out, style)
239
- t = @meta.get[:docsubtitlemain]
240
- (t && !t.empty?) or return
241
- ret = middle_title_para(style, :docsubtitleintro, :docsubtitlemain,
242
- :docsubtitlepart)
243
- if a = @meta.get[:docsubtitlepart]
244
- ret += "<p class='zzSTDTitle2'>"
245
- b = @meta.get[:docsubtitlepartlabel] and ret += "#{b}: "
246
- 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)
247
153
  end
248
- out.previous = ret
249
- end
250
-
251
- def middle_title_para(style, intro, main, part)
252
- ret = "<p class='#{style}'>#{@meta.get[intro]}"
253
- ret += " &#x2014; " if @meta.get[intro] && @meta.get[main]
254
- ret += @meta.get[main]
255
- ret += " &#x2014; " if @meta.get[main] && @meta.get[part]
256
- ret += "</p>"
257
- ret
258
154
  end
259
155
 
260
156
  include Init
@@ -715,27 +715,36 @@
715
715
  </define>
716
716
  <define name="ruby">
717
717
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
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="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
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="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
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">
@@ -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({})
@@ -15,8 +15,7 @@ module Metanorma
15
15
  org_contributor(node, xml,
16
16
  { source: ["publisher", "pub"], role: "author",
17
17
  default: JIS_HASH })
18
- node.attr("doctype") == "expert-commentary" and
19
- personal_author(node, xml)
18
+ personal_author(node, xml)
20
19
  end
21
20
 
22
21
  def metadata_publisher(node, xml)
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.1.5".freeze
3
+ VERSION = "0.1.7".freeze
4
4
  end
5
5
  end
6
6
 
@@ -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 = `git ls-files -- {spec}/*`.split("\n")
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.5
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-12-10 00:00:00.000000000 Z
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