metanorma-iso 1.6.1 → 1.7.0

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: 769601244fc001de9523edde3e6b139a897df0c82a255b786659a83a2e32d8a5
4
- data.tar.gz: 1ea613b3740ec30cc508fa5817bed662f3fe539b7bf03e2cf7e40e4ab1e1c8c4
3
+ metadata.gz: 4ec4ec662c484d537eb81f3942a322462babc6f46faa2a4842cb3dd0d933a23a
4
+ data.tar.gz: 1967914fa124dbe03b21d008f615bb84f576665bf7562d85ef4740bf56d953c3
5
5
  SHA512:
6
- metadata.gz: 870aaeca24c5e5878441a8346c2dc0d8d8cdd19604c50399c38b8af18bd29a90ab3c0dd8c8d080b977c35efc794bbfbffa4ca233113c3c3a103d90542981ba90
7
- data.tar.gz: a6bb8b2d6f598ddf12b8982fa1203165d07f94df83a0f2f7d96eba635834b69e0420e7e46e5cfe86b5ba0283a553106a7941cd06be868032dec6e0179dc1fbb4
6
+ metadata.gz: bbd9e8c580bc90dc62eb14bee46daecd43519b76028f80bb13d7076ad34ce5f1ccfe6cac8159d13ecf08aa82c7afb4a8560ea1d74bd442e2387f03afe1ce0491
7
+ data.tar.gz: 240233e6a5eca387b2def2da7660524f28bb11ddbe6d5ee61b9cf829f1baf9ee547ecb411626efa52b8b129434d31e2228a2f7c4c30bacbcf336893ada0f239c
@@ -46,7 +46,7 @@ module Asciidoctor
46
46
 
47
47
  def ol_attrs(node)
48
48
  attr_code(keep_attrs(node).
49
- merge(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node)))
49
+ merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
50
50
  end
51
51
 
52
52
  def outputs(node, ret)
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -85,27 +85,27 @@ module Asciidoctor
85
85
  def title_intro(node, t, lang, at)
86
86
  return unless node.attr("title-intro-#{lang}")
87
87
  t.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
88
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
88
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
89
89
  end
90
90
  end
91
91
 
92
92
  def title_main(node, t, lang, at)
93
93
  t.title **attr_code(at.merge(type: "title-main")) do |t1|
94
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
94
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
95
95
  end
96
96
  end
97
97
 
98
98
  def title_part(node, t, lang, at)
99
99
  return unless node.attr("title-part-#{lang}")
100
100
  t.title(**attr_code(at.merge(type: "title-part"))) do |t1|
101
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
101
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
102
102
  end
103
103
  end
104
104
 
105
105
  def title_amd(node, t, lang, at)
106
106
  return unless node.attr("title-amendment-#{lang}")
107
107
  t.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
108
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
108
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
109
109
  end
110
110
  end
111
111
 
@@ -118,7 +118,7 @@ module Asciidoctor
118
118
  title = "#{title} -- #{part}" if part
119
119
  title = "#{title} -- #{amd}" if amd && @amd
120
120
  t.title **attr_code(at.merge(type: "main")) do |t1|
121
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
121
+ t1 << Metanorma::Utils::asciidoc_sub(title)
122
122
  end
123
123
  end
124
124
 
@@ -789,6 +789,9 @@
789
789
  <attribute name="width"/>
790
790
  </element>
791
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
792
795
  <define name="TextElement" combine="choice">
793
796
  <ref name="concept"/>
794
797
  </define>
@@ -147,7 +147,7 @@ module Asciidoctor
147
147
  end
148
148
 
149
149
  # DRG directives 3.7; but anticipated by standoc
150
- def figure_validate(xmldoc)
150
+ def subfigure_validate(xmldoc)
151
151
  xmldoc.xpath("//figure//figure").each do |f|
152
152
  { footnote: "fn", note: "note", key: "dl" }.each do |k, v|
153
153
  f.xpath(".//#{v}").each do |n|
@@ -157,6 +157,72 @@ module Asciidoctor
157
157
  end
158
158
  end
159
159
 
160
+ def image_name_prefix(xmldoc)
161
+ std = xmldoc&.at("//bibdata/ext/structuredidentifier/project-number") or return
162
+ num = xmldoc&.at("//bibdata/docnumber")&.text or return
163
+ ed = xmldoc&.at("//bibdata/edition")&.text || "1"
164
+ prefix = num
165
+ part = std["part"] and prefix += "-#{std['part']}"
166
+ prefix += "_ed#{ed}"
167
+ amd = std["amendment"] and prefix += "amd#{amd}"
168
+ prefix
169
+ end
170
+
171
+ def image_name_suffix(xmldoc)
172
+ case xmldoc&.at("//bibdata/language")&.text
173
+ when "fr" then "_f"
174
+ when "de" then "_d"
175
+ when "ru" then "_r"
176
+ when "es" then "_s"
177
+ when "ar" then "_a"
178
+ when "en" then "_e"
179
+ else
180
+ "_e"
181
+ end
182
+ end
183
+
184
+ def disjunct_error(i, cond1, cond2, msg1, msg2)
185
+ cond1 && !cond2 and @log.add("Style", i, "image name #{i['src']} #{msg1}")
186
+ !cond1 && cond2 and @log.add("Style", i, "image name #{i['src']} #{msg2}")
187
+ end
188
+
189
+ def image_name_validate1(i, prefix)
190
+ m = %r[(SL)?#{prefix}fig(?<tab>Tab)?(?<annex>[A-Z])?(Text)?(?<num>\d+)
191
+ (?<subfig>[a-z])?(?<key>_key\d+)?(?<lang>_[a-z])?$]x.match(File.basename(i["src"], ".*"))
192
+ if m.nil?
193
+ @log.add("Style", i, "image name #{i['src']} does not match DRG requirements")
194
+ return
195
+ end
196
+ warn i['src']
197
+ disjunct_error(i, i.at("./ancestor::table"), !m[:tab].nil?,
198
+ "is under a table but is not so labelled", "is labelled as under a table but is not")
199
+ disjunct_error(i, i.at("./ancestor::annex"), !m[:annex].nil?,
200
+ "is under an annex but is not so labelled", "is labelled as under an annex but is not")
201
+ disjunct_error(i, i.xpath("./ancestor::figure").size > 1, !m[:subfig].nil?,
202
+ "does not have a subfigure letter but is a subfigure",
203
+ "has a subfigure letter but is not a subfigure")
204
+ lang = image_name_suffix(i.document.root)
205
+ (m[:lang] || "_e") == lang or @log.add("Style", i, "image name #{i['src']} expected to have suffix #{lang}")
206
+ end
207
+
208
+ # DRG directives 3.2
209
+ def image_name_validate(xmldoc)
210
+ prefix = image_name_prefix(xmldoc) or return
211
+ xmldoc.xpath("//image").each do |i|
212
+ if /^ISO_\d+_/.match(File.basename(i["src"]))
213
+ elsif /^(SL)?#{prefix}fig/.match(File.basename(i["src"]))
214
+ image_name_validate1(i, prefix)
215
+ else
216
+ @log.add("Style", i, "image name #{i['src']} does not match DRG requirements: expect #{prefix}fig")
217
+ end
218
+ end
219
+ end
220
+
221
+ def figure_validate(xmldoc)
222
+ image_name_validate(xmldoc)
223
+ subfigure_validate(xmldoc)
224
+ end
225
+
160
226
  def bibdata_validate(doc)
161
227
  doctype_validate(doc)
162
228
  script_validate(doc)
@@ -74,7 +74,7 @@ mso-line-height-rule:exactly'><span lang=EN-GB>{{ docnumber_reference }}{{ draft
74
74
 
75
75
  <p class=MsoHeader style='margin-bottom:18.0pt'><span lang=EN-GB
76
76
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt;font-weight:normal'>©
77
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}</span><span lang=EN-GB
77
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}</span><span lang=EN-GB
78
78
  style='font-weight:normal'><o:p></o:p></span></p>
79
79
 
80
80
  </div>
@@ -93,7 +93,7 @@ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
93
93
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
94
94
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
95
95
  style='mso-tab-count:1'>                                                                                                                                                                           </span>©
96
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
96
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
97
97
 
98
98
  </div>
99
99
 
@@ -129,7 +129,7 @@ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
129
129
  style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
130
130
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:
131
131
  1'>                                                                                                                                                                           </span>©
132
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
132
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
133
133
  </div>
134
134
 
135
135
  <div style='mso-element:footer' id=ef2l>
@@ -144,12 +144,12 @@ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
144
144
  style='mso-element:field-end'></span></span><![endif]--><span lang=EN-GB
145
145
  style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:
146
146
  1'>                                                                                                                                                                           </span>©
147
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
147
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
148
148
  </div>
149
149
 
150
150
  <div style='mso-element:footer' id=f2>
151
151
  <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
152
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
152
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
153
153
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
154
154
  style='mso-element:field-begin'></span> PAGE<span style='mso-spacerun:yes'>  
155
155
  </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
@@ -162,7 +162,7 @@ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span></p>
162
162
 
163
163
  <div style='mso-element:footer' id=f2l>
164
164
  <p class=MsoFooterLandscape style='line-height:12.0pt'><span lang=EN-GB
165
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
165
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<span style='mso-tab-count:1'>                                                                                                                                                                          </span></span><!--[if supportFields]><span
166
166
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
167
167
  style='mso-element:field-begin'></span> PAGE<span style='mso-spacerun:yes'>  
168
168
  </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
@@ -186,7 +186,7 @@ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
186
186
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
187
187
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
188
188
  style='mso-tab-count:1'>                                                                                                                                                                           </span>©
189
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
189
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
190
190
  </div>
191
191
 
192
192
  <div style='mso-element:footer' id=ef3l>
@@ -202,12 +202,12 @@ style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
202
202
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-end'></span></span></b><![endif]--><span
203
203
  lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span
204
204
  style='mso-tab-count:1'>                                                                                                                                                                           </span>©
205
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
205
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
206
206
  </div>
207
207
 
208
208
  <div style='mso-element:footer' id=f3>
209
209
  <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
210
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
210
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
211
211
  style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
212
212
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-begin'></span>
213
213
  PAGE<span style='mso-spacerun:yes'>   </span>\* MERGEFORMAT <span
@@ -221,7 +221,7 @@ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span>
221
221
 
222
222
  <div style='mso-element:footer' id=f3l>
223
223
  <p class=MsoFooterLandscape style='line-height:12.0pt'><span lang=EN-GB
224
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
224
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>© {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
225
225
  style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
226
226
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-begin'></span>
227
227
  PAGE<span style='mso-spacerun:yes'>   </span>\* MERGEFORMAT <span
@@ -242,10 +242,10 @@ lang=EN-GB style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><o:p></o:p></span>
242
242
  {% endif %}
243
243
 
244
244
  <p class=MsoFooter style='margin-top:0cm'><span lang=EN-AU style='font-size:
245
- 10.0pt;mso-ansi-language:EN-AU'>{{ price_based_on | replace: "%", "<span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>NUMPAGES<span style='mso-spacerun:yes'>  </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span><span style='mso-no-proof:yes'>26</span><span style='mso-element:field-end'></span>" }}</span></p>
245
+ 10.0pt;mso-ansi-language:EN-AU'>{{ labels["price_based_on"] | replace: "%", "<span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>NUMPAGES<span style='mso-spacerun:yes'>  </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span><span style='mso-no-proof:yes'>26</span><span style='mso-element:field-end'></span>" }}</span></p>
246
246
 
247
247
  <p class=MsoFooter><span lang=EN-AU style='font-size:10.0pt;'>©
248
- {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ all_rights_reserved }}<o:p></o:p></span></p>
248
+ {{ agency }}&nbsp;{{ docyear }}&nbsp;– {{ labels["all_rights_reserved"] }}<o:p></o:p></span></p>
249
249
 
250
250
  </div>
251
251
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <nav>
4
4
 
5
- <h1 id="content">Contents</h1>
5
+ <h1 id="content">{{ labels["table_of_contents"] }}</h1>
6
6
  <div id="toc"></div>
7
7
 
8
8
  </nav>
@@ -8,7 +8,7 @@
8
8
  {% endif %}
9
9
 
10
10
  {% if revdate %}
11
- <p class="coverpage_docnumber">Date: {{ revdate }}</p>
11
+ <p class="coverpage_docnumber">{{ labels["date"]}}: {{ revdate }}</p>
12
12
  {% endif %}
13
13
 
14
14
  {% if tc_docnumber.size > 0 %}
@@ -8,7 +8,7 @@ margin-left:5.1pt;margin-right:5.1pt'>
8
8
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
9
9
  {% else %}
10
10
 
11
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
11
+ <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
12
12
 
13
13
  WORDTOC
14
14
  {% endif %}
@@ -11,7 +11,7 @@ style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'>
11
11
  {% endif %}
12
12
 
13
13
  {% if revdate %}
14
- <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>Date: {{ revdate }}</span></p>
14
+ <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>{{ labels["date"]}}: {{ revdate }}</span></p>
15
15
  {% endif %}
16
16
 
17
17
  {% if tc_docnumber.size > 0 %}
@@ -19,9 +19,9 @@ module IsoDoc
19
19
 
20
20
  def default_fonts(options)
21
21
  {
22
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
22
+ bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
23
23
  options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
24
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
24
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
25
25
  options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
26
26
  monospacefont: (options[:alt] ? '"Space Mono",monospace' :
27
27
  '"Courier New",monospace'),
@@ -12,3 +12,5 @@ all_rights_reserved: All rights reserved
12
12
  reference_number: Reference Number
13
13
  price_based_on: Price based on % pages
14
14
  under_preparation: Under preparation. (Stage at the time of publication %).
15
+ table_of_contents: Contents
16
+ date: Date
@@ -12,4 +12,4 @@ all_rights_reserved: Tous droits réservés
12
12
  reference_number: Numéro de référence
13
13
  price_based_on: Prix basé sur % pages
14
14
  under_preparation: En cours d'élaboration. (Stade au moment de la publication %).
15
-
15
+ date: Date
@@ -10,4 +10,4 @@ all_rights_reserved: 版权所有
10
10
  reference_number: 参考编号
11
11
  price_based_on: 价格基于%页
12
12
  under_preparation: 制定中(出版时最新状态为%)
13
-
13
+ date: 日期
@@ -1024,20 +1024,20 @@
1024
1024
  <fo:block-container font-weight="bold">
1025
1025
 
1026
1026
  <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1027
- <xsl:variable name="title-toc">
1028
- <xsl:call-template name="getTitle">
1029
- <xsl:with-param name="name" select="'title-toc'"/>
1027
+ <fo:inline font-size="16pt" font-weight="bold">
1028
+ <!-- Contents -->
1029
+ <xsl:call-template name="getLocalizedString">
1030
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1030
1031
  </xsl:call-template>
1031
- </xsl:variable>
1032
- <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
1032
+ </fo:inline>
1033
1033
  <fo:inline keep-together.within-line="always">
1034
1034
  <fo:leader leader-pattern="space"/>
1035
- <xsl:variable name="title-page">
1036
- <xsl:call-template name="getTitle">
1037
- <xsl:with-param name="name" select="'title-page'"/>
1038
- </xsl:call-template>
1039
- </xsl:variable>
1040
- <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
1035
+ <fo:inline font-weight="normal" font-size="10pt">
1036
+ <!-- Page -->
1037
+ <xsl:call-template name="getLocalizedString">
1038
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1039
+ </xsl:call-template>
1040
+ </fo:inline>
1041
1041
  </fo:inline>
1042
1042
  </fo:block>
1043
1043
 
@@ -2534,6 +2534,7 @@
2534
2534
 
2535
2535
 
2536
2536
 
2537
+
2537
2538
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2538
2539
 
2539
2540
 
@@ -2670,7 +2671,7 @@
2670
2671
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2671
2672
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2672
2673
  <xsl:call-template name="add-zero-spaces-java"/>
2673
- </xsl:template><xsl:template match="*[local-name()='table']">
2674
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2674
2675
 
2675
2676
  <xsl:variable name="simple-table">
2676
2677
  <xsl:call-template name="getSimpleTable"/>
@@ -4009,6 +4010,7 @@
4009
4010
 
4010
4011
 
4011
4012
 
4013
+
4012
4014
 
4013
4015
  </xsl:variable>
4014
4016
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4604,7 +4606,7 @@
4604
4606
  </xsl:if> -->
4605
4607
  </fo:inline>
4606
4608
  </xsl:if>
4607
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4609
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4608
4610
  <fo:block-container id="{@id}">
4609
4611
 
4610
4612
  <fo:block>
@@ -4811,6 +4813,12 @@
4811
4813
  <!-- <xsl:text> </xsl:text> -->
4812
4814
  </xsl:template><xsl:template name="getSection">
4813
4815
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4816
+ <!--
4817
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4818
+ <xsl:value-of select="."/>
4819
+ </xsl:for-each>
4820
+ -->
4821
+
4814
4822
  </xsl:template><xsl:template name="getName">
4815
4823
  <xsl:choose>
4816
4824
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4863,6 +4871,10 @@
4863
4871
  <xsl:copy>
4864
4872
  <xsl:apply-templates mode="contents_item"/>
4865
4873
  </xsl:copy>
4874
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4875
+ <xsl:copy>
4876
+ <xsl:apply-templates mode="contents_item"/>
4877
+ </xsl:copy>
4866
4878
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4867
4879
  <xsl:text> </xsl:text>
4868
4880
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4888,6 +4900,7 @@
4888
4900
 
4889
4901
  9
4890
4902
 
4903
+
4891
4904
 
4892
4905
 
4893
4906
 
@@ -5428,6 +5441,7 @@
5428
5441
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5429
5442
  </xsl:if>
5430
5443
 
5444
+
5431
5445
 
5432
5446
 
5433
5447
 
@@ -5439,7 +5453,7 @@
5439
5453
 
5440
5454
 
5441
5455
 
5442
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5456
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5443
5457
  <fo:block break-after="page"/>
5444
5458
  <fo:block>
5445
5459
  <xsl:call-template name="setId"/>
@@ -5447,7 +5461,8 @@
5447
5461
  </fo:block>
5448
5462
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5449
5463
  <fo:block>
5450
- <xsl:call-template name="setId"/>
5464
+ <xsl:call-template name="setId"/>
5465
+
5451
5466
 
5452
5467
  <xsl:apply-templates/>
5453
5468
  </fo:block>
@@ -5619,6 +5634,57 @@
5619
5634
  </xsl:variable>
5620
5635
  <xsl:variable name="result">
5621
5636
  <xsl:choose>
5637
+ <xsl:when test="$format = 'ddMMyyyy'">
5638
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5639
+ <xsl:text> </xsl:text>
5640
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5641
+ </xsl:when>
5642
+ <xsl:when test="$format = 'ddMM'">
5643
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5644
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5645
+ </xsl:when>
5646
+ <xsl:when test="$format = 'short' or $day = ''">
5647
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5648
+ </xsl:when>
5649
+ <xsl:otherwise>
5650
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5651
+ </xsl:otherwise>
5652
+ </xsl:choose>
5653
+ </xsl:variable>
5654
+ <xsl:value-of select="$result"/>
5655
+ </xsl:template><xsl:template name="convertDateLocalized">
5656
+ <xsl:param name="date"/>
5657
+ <xsl:param name="format" select="'short'"/>
5658
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5659
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5660
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5661
+ <xsl:variable name="monthStr">
5662
+ <xsl:choose>
5663
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
5664
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
5665
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
5666
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
5667
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
5668
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
5669
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
5670
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
5671
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
5672
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
5673
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
5674
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
5675
+ </xsl:choose>
5676
+ </xsl:variable>
5677
+ <xsl:variable name="result">
5678
+ <xsl:choose>
5679
+ <xsl:when test="$format = 'ddMMyyyy'">
5680
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5681
+ <xsl:text> </xsl:text>
5682
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5683
+ </xsl:when>
5684
+ <xsl:when test="$format = 'ddMM'">
5685
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5686
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5687
+ </xsl:when>
5622
5688
  <xsl:when test="$format = 'short' or $day = ''">
5623
5689
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5624
5690
  </xsl:when>
@@ -5815,6 +5881,7 @@
5815
5881
 
5816
5882
 
5817
5883
 
5884
+
5818
5885
  </xsl:variable>
5819
5886
  <xsl:if test="$documentNS != $XSLNS">
5820
5887
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -1024,20 +1024,20 @@
1024
1024
  <fo:block-container font-weight="bold">
1025
1025
 
1026
1026
  <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1027
- <xsl:variable name="title-toc">
1028
- <xsl:call-template name="getTitle">
1029
- <xsl:with-param name="name" select="'title-toc'"/>
1027
+ <fo:inline font-size="16pt" font-weight="bold">
1028
+ <!-- Contents -->
1029
+ <xsl:call-template name="getLocalizedString">
1030
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1030
1031
  </xsl:call-template>
1031
- </xsl:variable>
1032
- <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
1032
+ </fo:inline>
1033
1033
  <fo:inline keep-together.within-line="always">
1034
1034
  <fo:leader leader-pattern="space"/>
1035
- <xsl:variable name="title-page">
1036
- <xsl:call-template name="getTitle">
1037
- <xsl:with-param name="name" select="'title-page'"/>
1038
- </xsl:call-template>
1039
- </xsl:variable>
1040
- <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
1035
+ <fo:inline font-weight="normal" font-size="10pt">
1036
+ <!-- Page -->
1037
+ <xsl:call-template name="getLocalizedString">
1038
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1039
+ </xsl:call-template>
1040
+ </fo:inline>
1041
1041
  </fo:inline>
1042
1042
  </fo:block>
1043
1043
 
@@ -2534,6 +2534,7 @@
2534
2534
 
2535
2535
 
2536
2536
 
2537
+
2537
2538
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2538
2539
 
2539
2540
 
@@ -2670,7 +2671,7 @@
2670
2671
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2671
2672
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2672
2673
  <xsl:call-template name="add-zero-spaces-java"/>
2673
- </xsl:template><xsl:template match="*[local-name()='table']">
2674
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2674
2675
 
2675
2676
  <xsl:variable name="simple-table">
2676
2677
  <xsl:call-template name="getSimpleTable"/>
@@ -4009,6 +4010,7 @@
4009
4010
 
4010
4011
 
4011
4012
 
4013
+
4012
4014
 
4013
4015
  </xsl:variable>
4014
4016
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4604,7 +4606,7 @@
4604
4606
  </xsl:if> -->
4605
4607
  </fo:inline>
4606
4608
  </xsl:if>
4607
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4609
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4608
4610
  <fo:block-container id="{@id}">
4609
4611
 
4610
4612
  <fo:block>
@@ -4811,6 +4813,12 @@
4811
4813
  <!-- <xsl:text> </xsl:text> -->
4812
4814
  </xsl:template><xsl:template name="getSection">
4813
4815
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4816
+ <!--
4817
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4818
+ <xsl:value-of select="."/>
4819
+ </xsl:for-each>
4820
+ -->
4821
+
4814
4822
  </xsl:template><xsl:template name="getName">
4815
4823
  <xsl:choose>
4816
4824
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4863,6 +4871,10 @@
4863
4871
  <xsl:copy>
4864
4872
  <xsl:apply-templates mode="contents_item"/>
4865
4873
  </xsl:copy>
4874
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4875
+ <xsl:copy>
4876
+ <xsl:apply-templates mode="contents_item"/>
4877
+ </xsl:copy>
4866
4878
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4867
4879
  <xsl:text> </xsl:text>
4868
4880
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4888,6 +4900,7 @@
4888
4900
 
4889
4901
  9
4890
4902
 
4903
+
4891
4904
 
4892
4905
 
4893
4906
 
@@ -5428,6 +5441,7 @@
5428
5441
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5429
5442
  </xsl:if>
5430
5443
 
5444
+
5431
5445
 
5432
5446
 
5433
5447
 
@@ -5439,7 +5453,7 @@
5439
5453
 
5440
5454
 
5441
5455
 
5442
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5456
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5443
5457
  <fo:block break-after="page"/>
5444
5458
  <fo:block>
5445
5459
  <xsl:call-template name="setId"/>
@@ -5447,7 +5461,8 @@
5447
5461
  </fo:block>
5448
5462
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5449
5463
  <fo:block>
5450
- <xsl:call-template name="setId"/>
5464
+ <xsl:call-template name="setId"/>
5465
+
5451
5466
 
5452
5467
  <xsl:apply-templates/>
5453
5468
  </fo:block>
@@ -5619,6 +5634,57 @@
5619
5634
  </xsl:variable>
5620
5635
  <xsl:variable name="result">
5621
5636
  <xsl:choose>
5637
+ <xsl:when test="$format = 'ddMMyyyy'">
5638
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5639
+ <xsl:text> </xsl:text>
5640
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5641
+ </xsl:when>
5642
+ <xsl:when test="$format = 'ddMM'">
5643
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5644
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5645
+ </xsl:when>
5646
+ <xsl:when test="$format = 'short' or $day = ''">
5647
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5648
+ </xsl:when>
5649
+ <xsl:otherwise>
5650
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5651
+ </xsl:otherwise>
5652
+ </xsl:choose>
5653
+ </xsl:variable>
5654
+ <xsl:value-of select="$result"/>
5655
+ </xsl:template><xsl:template name="convertDateLocalized">
5656
+ <xsl:param name="date"/>
5657
+ <xsl:param name="format" select="'short'"/>
5658
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5659
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5660
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5661
+ <xsl:variable name="monthStr">
5662
+ <xsl:choose>
5663
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
5664
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
5665
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
5666
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
5667
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
5668
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
5669
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
5670
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
5671
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
5672
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
5673
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
5674
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
5675
+ </xsl:choose>
5676
+ </xsl:variable>
5677
+ <xsl:variable name="result">
5678
+ <xsl:choose>
5679
+ <xsl:when test="$format = 'ddMMyyyy'">
5680
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5681
+ <xsl:text> </xsl:text>
5682
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5683
+ </xsl:when>
5684
+ <xsl:when test="$format = 'ddMM'">
5685
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5686
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5687
+ </xsl:when>
5622
5688
  <xsl:when test="$format = 'short' or $day = ''">
5623
5689
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5624
5690
  </xsl:when>
@@ -5815,6 +5881,7 @@
5815
5881
 
5816
5882
 
5817
5883
 
5884
+
5818
5885
  </xsl:variable>
5819
5886
  <xsl:if test="$documentNS != $XSLNS">
5820
5887
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -16,9 +16,9 @@ module IsoDoc
16
16
 
17
17
  def default_fonts(options)
18
18
  {
19
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
19
+ bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
20
20
  '"Cambria",serif'),
21
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
21
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
22
22
  '"Cambria",serif'),
23
23
  monospacefont: '"Courier New",monospace',
24
24
  normalfontsize: "11.0pt",
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.6.1".freeze
3
+ VERSION = "1.7.0".freeze
4
4
  end
5
5
  end
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
31
31
 
32
32
  spec.add_dependency "ruby-jing"
33
- spec.add_dependency "isodoc", "~> 1.4.2"
34
- spec.add_dependency "metanorma-standoc", "~> 1.7.0"
33
+ spec.add_dependency "isodoc", "~> 1.5.0"
34
+ spec.add_dependency "metanorma-standoc", "~> 1.8.0"
35
35
  spec.add_dependency "tokenizer", "~> 0.3.0"
36
36
  spec.add_dependency "twitter_cldr"
37
37
  spec.add_dependency "mn2sts", "~> 1.5.0"
@@ -668,8 +668,8 @@ OUTPUT
668
668
  INPUT
669
669
  html = File.read("test.html", encoding: "utf-8")
670
670
  expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
671
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "SimSun", serif;]m)
672
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "SimHei", sans-serif;]m)
671
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
672
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
673
673
  end
674
674
 
675
675
  it "uses specified fonts" do
@@ -17,12 +17,81 @@ RSpec.describe Asciidoctor::ISO do
17
17
  expect do
18
18
  Metanorma::Compile
19
19
  .new
20
- .compile("spec/assets/xref_error.adoc", type: "iso")
20
+ .compile("spec/assets/xref_error.adoc", type: "iso", :"agree-to-terms" => true)
21
21
  end.to(change { File.exist?("spec/assets/xref_error.err") }
22
22
  .from(false).to(true))
23
23
  end
24
24
  end
25
25
 
26
+ it "Warns of image names not compliant with DRG" do
27
+ FileUtils.rm_f "test.err"
28
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)
29
+ = Document title
30
+ Author
31
+ :docfile: test.adoc
32
+ :nodoc:
33
+ :no-isobib:
34
+ :docnumber: 1000
35
+ :partnumber: 1
36
+ :edition: 2
37
+ :amendment-number: 3
38
+
39
+ .Split-it-right sample divider
40
+ image::spec/examples/rice_images/rice_image1.png[]
41
+ image::spec/examples/rice_images/SL1000-1_ed2amd3fig1.png[]
42
+ image::spec/examples/rice_images/1001_ed2amd3fig1.png[]
43
+ image::spec/examples/rice_images/ISO_1213_1.png[]
44
+ image::spec/examples/rice_images/1000-1_ed2amd3figA.png[]
45
+
46
+ |===
47
+ |a |b
48
+
49
+ a|image::spec/examples/rice_images/1000-1_ed2amd3figTab1.png[]
50
+ a|image::spec/examples/rice_images/1000-1_ed2amd3fig2.png[]
51
+ |===
52
+
53
+ image::spec/examples/rice_images/1000-1_ed2amd3figTab2.png[]
54
+
55
+ image::spec/examples/rice_images/1000-1_ed2amd3figA1.png[]
56
+ image::spec/examples/rice_images/1000-1_ed2amd3fig1a.png[]
57
+
58
+ .Stages of gelatinization
59
+ ====
60
+ image::spec/examples/rice_images/1000-1_ed2amd3fig1b.png[]
61
+
62
+ image::spec/examples/rice_images/1000-1_ed2amd3fig4.png[]
63
+ ====
64
+
65
+ image::spec/examples/rice_images/1000-1_ed2amd3fig5_f.png[]
66
+
67
+ [appendix]
68
+ == Annex
69
+ image::spec/examples/rice_images/1000-1_ed2amd3figA2.png[]
70
+ image::spec/examples/rice_images/1000-1_ed2amd3fig3.png[]
71
+
72
+ INPUT
73
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/rice_image1.png does not match DRG requirements: expect 1000-1_ed2amd3fig"
74
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1001_ed2amd3fig1.png does not match DRG requirements: expect 1000-1_ed2amd3fig"
75
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/SL1000-1_ed2amd3fig1.png does not match DRG requirements: expect 1000-1_ed2amd3fig"
76
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/ISO_1213_1.png does not match DRG requirements: expect 1000-1_ed2amd3fig"
77
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3figA.png does not match DRG requirements"
78
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png does not match DRG requirements"
79
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3figTab1.png is under a table but is not so labelled"
80
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3fig2.png is under a table but is not so labelled"
81
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3figTab2.png is labelled as under a table but is not"
82
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is labelled as under a table but is not"
83
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3figA2.png is under an annex but is not so labelled"
84
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3fig3.png is under an annex but is not so labelled"
85
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3figA1.png is labelled as under an annex but is not"
86
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png is labelled as under an annex but is not"
87
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1b.png has a subfigure letter but is not a subfigure"
88
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3fig4.png does not have a subfigure letter but is a subfigure"
89
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1a.png has a subfigure letter but is not a subfigure"
90
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png has a subfigure letter but is not a subfigure"
91
+ expect(File.read("test.err")).to include "image name spec/examples/rice_images/1000-1_ed2amd3fig5_f.png expected to have suffix _e"
92
+ expect(File.read("test.err")).not_to include "image name spec/examples/rice_images/1000-1_ed2amd3fig1.png expected to have suffix _e"
93
+ end
94
+
26
95
  it "Warns of missing scope" do
27
96
  FileUtils.rm_f "test.err"
28
97
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)
@@ -49,8 +49,8 @@ RSpec.describe IsoDoc::Iso do
49
49
  INPUT
50
50
  html = File.read("test.html", encoding: "utf-8")
51
51
  expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
52
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "SimSun", serif;]m)
53
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "SimHei", sans-serif;]m)
52
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
53
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
54
54
  end
55
55
 
56
56
  it "processes isodoc as ISO: user nominated fonts" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.4.2
33
+ version: 1.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.4.2
40
+ version: 1.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: metanorma-standoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.7.0
47
+ version: 1.8.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.7.0
54
+ version: 1.8.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: tokenizer
57
57
  requirement: !ruby/object:Gem::Requirement