metanorma-iso 1.9.0.1 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require "isodoc"
2
2
 
3
3
  module IsoDoc
4
4
  module Iso
5
- class Metadata < IsoDoc::Metadata
5
+ class Metadata < IsoDoc::Metadata
6
6
  def initialize(lang, script, i18n)
7
7
  super
8
8
  set(:tc, "XXXX")
@@ -14,17 +14,17 @@ module IsoDoc
14
14
  set(:obsoletes_part, nil)
15
15
  end
16
16
 
17
- def status_abbrev(stage, substage, iter, draft, doctype)
17
+ def status_abbrev(stage, _substage, iter, draft, doctype)
18
18
  return "" unless stage
19
19
 
20
20
  if %w(technical-report technical-specification).include?(doctype)
21
21
  stage = "DTS" if stage == "DIS"
22
22
  stage = "FDTS" if stage == "FDIS"
23
23
  end
24
- if %w(PWI NWIP WD CD).include?(stage)
25
- stage += iter if iter
24
+ if %w(PWI NWIP WD CD).include?(stage) && iter
25
+ stage += iter
26
26
  end
27
- stage = "Pre" + stage if draft =~ /^0\./
27
+ stage = "Pre#{stage}" if /^0\./.match?(draft)
28
28
  stage
29
29
  end
30
30
 
@@ -48,14 +48,14 @@ module IsoDoc
48
48
  end
49
49
 
50
50
  def unpublished(status)
51
- status.to_i > 0 && status.to_i < 60
51
+ status.to_i.positive? && status.to_i < 60
52
52
  end
53
53
 
54
54
  def docid(isoxml, _out)
55
55
  dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
56
56
  set(:docnumber, dn&.text)
57
57
  tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
58
- set(:tc_docnumber, tcdn.map { |n| n.text })
58
+ set(:tc_docnumber, tcdn.map(&:text))
59
59
  dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
60
60
  set(:docnumber_lang, dn&.text)
61
61
  dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
@@ -87,6 +87,7 @@ module IsoDoc
87
87
 
88
88
  def part_title(part, partnum, subpartnum, lang)
89
89
  return "" unless part
90
+
90
91
  suffix = @c.encode(part.text, :hexadecimal)
91
92
  partnum = "#{partnum}&ndash;#{subpartnum}" if partnum && subpartnum
92
93
  suffix = "#{part_label(lang)}&nbsp;#{partnum}: " + suffix if partnum
@@ -125,10 +126,14 @@ module IsoDoc
125
126
  end
126
127
 
127
128
  def title_parts(isoxml, lang)
128
- [isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='#{lang}']")),
129
- isoxml.at(ns("//bibdata//title[@type='title-main' and @language='#{lang}']")),
130
- isoxml.at(ns("//bibdata//title[@type='title-part' and @language='#{lang}']")),
131
- isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='#{lang}']"))]
129
+ [isoxml.at(ns("//bibdata//title[@type='title-intro' and "\
130
+ "@language='#{lang}']")),
131
+ isoxml.at(ns("//bibdata//title[@type='title-main' and "\
132
+ "@language='#{lang}']")),
133
+ isoxml.at(ns("//bibdata//title[@type='title-part' and "\
134
+ "@language='#{lang}']")),
135
+ isoxml.at(ns("//bibdata//title[@type='title-amd' and "\
136
+ "@language='#{lang}']"))]
132
137
  end
133
138
 
134
139
  def title(isoxml, _out)
@@ -139,7 +144,10 @@ module IsoDoc
139
144
  set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
140
145
  main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
141
146
  set(:doctitle, main)
142
- set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
147
+ if intro
148
+ set(:doctitleintro,
149
+ @c.encode(intro ? intro.text : "", :hexadecimal))
150
+ end
143
151
  set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
144
152
  set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
145
153
  set(:doctitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
@@ -155,7 +163,10 @@ module IsoDoc
155
163
  set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
156
164
  main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
157
165
  set(:docsubtitle, main)
158
- set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
166
+ if intro
167
+ set(:docsubtitleintro,
168
+ @c.encode(intro ? intro.text : "", :hexadecimal))
169
+ end
159
170
  set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
160
171
  set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
161
172
  set(:docsubtitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
@@ -173,8 +184,8 @@ module IsoDoc
173
184
 
174
185
  def tc(xml)
175
186
  tc_num = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@number"))
176
- tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@type"))&.
177
- text || "TC"
187
+ tc_type = xml.at(ns("//bibdata/ext/editorialgroup/technical-committee/@type"))
188
+ &.text || "TC"
178
189
  if tc_num
179
190
  tcid = "#{tc_type} #{tc_num.text}"
180
191
  set(:tc, tcid)
@@ -212,7 +223,8 @@ module IsoDoc
212
223
  ics = []
213
224
  isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
214
225
  set(:ics, ics.empty? ? nil : ics.join(", "))
215
- a = isoxml.at(ns("//bibdata/ext/horizontal")) and set(:horizontal, a.text)
226
+ a = isoxml.at(ns("//bibdata/ext/horizontal")) and set(:horizontal,
227
+ a.text)
216
228
  end
217
229
  end
218
230
  end
@@ -68,7 +68,8 @@ module IsoDoc
68
68
  subsection = from&.text&.match(/\./)
69
69
  type = type.downcase
70
70
  lang == "zh" and
71
- return l10n(eref_localities1_zh(target, type, from, upto, node, delim))
71
+ return l10n(eref_localities1_zh(target, type, from, upto, node,
72
+ delim))
72
73
  ret = if delim == ";" then ";"
73
74
  else
74
75
  type == "list" ? "" : delim
@@ -117,27 +118,35 @@ module IsoDoc
117
118
  concept_term(f, m)
118
119
  end
119
120
  docxml.xpath(ns("//concept")).each do |node|
120
- concept_render(node, node["ital"] || "false", node["ref"] || "false")
121
+ concept_render(node, ital: node["ital"] || "false",
122
+ ref: node["ref"] || "false",
123
+ linkref: node["linkref"] || "true",
124
+ linkmention: node["linkmention"] || "false")
121
125
  end
122
126
  end
123
127
 
124
128
  def concept_term(node, seen)
125
129
  term = node&.at(ns("./refterm"))&.to_xml
126
130
  if term && seen[term]
127
- concept_render(node, node["ital"] || "false", node["ref"] || "false")
128
- else concept_render(node, node["ital"] || "true", node["ref"] || "true")
131
+ concept_render(node, ital: node["ital"] || "false",
132
+ ref: node["ref"] || "false",
133
+ linkref: node["linkref"] || "true",
134
+ linkmention: node["linkmention"] || "false")
135
+ else concept_render(node, ital: node["ital"] || "true",
136
+ ref: node["ref"] || "true",
137
+ linkref: node["linkref"] || "true",
138
+ linkmention: node["linkmention"] || "false")
129
139
  end
130
140
  seen[term] = true if term
131
141
  seen
132
142
  end
133
143
 
134
- def concept1_ref(node, ref)
135
- if r = node.at(ns("./xref | ./eref | ./termref"))
136
- return r.remove if ref == "false"
137
-
138
- r.name == "termref" and
139
- r.replace(@i18n.term_defined_in.sub(/%/, r.to_xml)) or
140
- r.replace("(#{r.to_xml})")
144
+ def concept1_ref_content(ref)
145
+ if ref.name == "termref"
146
+ ref.replace(@i18n.term_defined_in.sub(/%/,
147
+ ref.to_xml))
148
+ else
149
+ ref.replace("(#{ref.to_xml})")
141
150
  end
142
151
  end
143
152
 
@@ -160,7 +169,7 @@ module IsoDoc
160
169
  # i = display_order_at(docxml, "//sections/definitions", i)
161
170
  # i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
162
171
  i = display_order_xpath(docxml, "//sections/clause[not(@type = 'scope')] | "\
163
- "//sections/terms | //sections/definitions", i)
172
+ "//sections/terms | //sections/definitions", i)
164
173
  i = display_order_xpath(docxml, "//annex", i)
165
174
  i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
166
175
  display_order_xpath(docxml, "//indexsect", i)
@@ -31,7 +31,7 @@ module Metanorma
31
31
  "Cambria Math" => nil,
32
32
  "Times New Roman" => nil,
33
33
  "Source Han Sans" => nil,
34
- "Courier" => nil,
34
+ "Source Han Sans Normal" => nil,
35
35
  "Courier New" => nil,
36
36
  }
37
37
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.9.0.1".freeze
3
+ VERSION = "1.9.4".freeze
4
4
  end
5
5
  end
@@ -212,6 +212,8 @@ RSpec.describe Asciidoctor::ISO do
212
212
  :pub-fax: 4444444
213
213
  :pub-email: x@example.com
214
214
  :pub-uri: http://www.example.com
215
+ :docstage:
216
+ :docsubstage:
215
217
  INPUT
216
218
  expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
217
219
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -304,7 +306,6 @@ RSpec.describe Asciidoctor::ISO do
304
306
  <phone type='fax'>4444444</phone>
305
307
  <email>x@example.com</email>
306
308
  <uri>http://www.example.com</uri>
307
- #{' '}
308
309
  </organization>
309
310
  </owner>
310
311
  </copyright>
@@ -48,11 +48,11 @@ RSpec.describe Asciidoctor::ISO do
48
48
  <mi>r</mi>
49
49
  <mo>=</mo>
50
50
  <mn>1</mn>
51
- <mi>%</mi>
51
+ <mo>%</mo>
52
52
  <mi>r</mi>
53
53
  <mo>=</mo>
54
54
  <mn>1</mn>
55
- <mi>%</mi>
55
+ <mo>%</mo>
56
56
  </math>
57
57
  </stem>
58
58
  </formula>
@@ -586,4 +586,43 @@ RSpec.describe Asciidoctor::ISO do
586
586
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
587
587
  .to be_equivalent_to xmlpp(output)
588
588
  end
589
+
590
+ it "processes nested terms" do
591
+ input = <<~INPUT
592
+ #{ASCIIDOC_BLANK_HDR}
593
+ == Terms and Definitions
594
+
595
+ [.term]
596
+ === Term1
597
+
598
+ definition
599
+
600
+ ==== Term11
601
+ definition2
602
+ INPUT
603
+ output = <<~OUTPUT
604
+ #{BLANK_HDR}
605
+ <sections>
606
+ <terms id='_' obligation='normative'>
607
+ <title>Terms and definitions</title>
608
+ #{TERM_BOILERPLATE}
609
+ <term id='term-term1'>
610
+ <preferred>Term1</preferred>
611
+ <definition>
612
+ <p id='_'>definition</p>
613
+ </definition>
614
+ <term id='term-term11'>
615
+ <preferred>Term11</preferred>
616
+ <definition>
617
+ <p id='_'>definition2</p>
618
+ </definition>
619
+ </term>
620
+ </term>
621
+ </terms>
622
+ </sections>
623
+ </iso-standard>
624
+ OUTPUT
625
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
626
+ .to be_equivalent_to xmlpp(output)
627
+ end
589
628
  end
@@ -230,11 +230,11 @@ RSpec.describe Asciidoctor::ISO do
230
230
  <mi>r</mi>
231
231
  <mo>=</mo>
232
232
  <mn>1</mn>
233
- <mi>%</mi>
233
+ <mo>%</mo>
234
234
  <mi>r</mi>
235
235
  <mo>=</mo>
236
236
  <mn>1</mn>
237
- <mi>%</mi>
237
+ <mo>%</mo>
238
238
  </math>
239
239
  </stem>
240
240
  <note id="_">
@@ -26,7 +26,7 @@ RSpec.describe Asciidoctor::ISO do
26
26
  <title>Clause</title>
27
27
  <p id="_">
28
28
  <eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>
29
- <fn reference="1">The standard is in press</fn>
29
+ <fn reference="1"><p id="_">The standard is in press</p></fn>
30
30
  <eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>A.
31
31
  <fn reference="2">
32
32
  <p id="_">a footnote</p></fn>
@@ -131,26 +131,27 @@ RSpec.describe IsoDoc do
131
131
  <sections>
132
132
  </iso-standard>
133
133
  INPUT
134
- expect(xmlpp(output.sub(/<html/, "<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
135
- #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
136
- <br/>
137
- <div>
138
- <h1 class="ForewordTitle">Foreword</h1>
139
- <p>
140
- <span class="stem">(#(A)#)</span>
141
- <span class="stem">
142
- <m:math>
143
- <m:row>X</m:row>
144
- </m:math>
145
- </span>
146
- <span class="stem">Latex?</span>
147
- </p>
148
- </div>
149
- <p class="zzSTDTitle1"/>
150
- </div>
151
- </body>
152
- </html>
153
- OUTPUT
134
+ expect(xmlpp(output.sub(/<html/,
135
+ "<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
136
+ #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
137
+ <br/>
138
+ <div>
139
+ <h1 class="ForewordTitle">Foreword</h1>
140
+ <p>
141
+ <span class="stem">(#(A)#)</span>
142
+ <span class="stem">
143
+ <m:math>
144
+ <m:row>X</m:row>
145
+ </m:math>
146
+ </span>
147
+ <span class="stem">Latex?</span>
148
+ </p>
149
+ </div>
150
+ <p class="zzSTDTitle1"/>
151
+ </div>
152
+ </body>
153
+ </html>
154
+ OUTPUT
154
155
  end
155
156
 
156
157
  it "overrides AsciiMath delimiters" do
@@ -232,163 +233,165 @@ RSpec.describe IsoDoc do
232
233
  end
233
234
 
234
235
  it "processes eref content" do
235
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
236
- <iso-standard xmlns="http://riboseinc.com/isoxml">
237
- <preface>
238
- <foreword>
239
- <p>
240
- <eref bibitemid="IEV" citeas="IEV" type="inline">
241
- <locality type="clause">
242
- <referenceFrom>1-2-3</referenceFrom>
243
- </locality>
244
- </eref>
245
- <eref bibitemid="ISO712" citeas="ISO 712" type="inline"/>
246
- <eref bibitemid="ISO712" type="inline"/>
247
- <eref bibitemid="ISO712" type="inline">
248
- <locality type="table">
249
- <referenceFrom>1</referenceFrom>
250
- </locality>
251
- </eref>
252
- <eref bibitemid="ISO712" type="inline">
253
- <locality type="table">
254
- <referenceFrom>1</referenceFrom>
255
- <referenceTo>1</referenceTo>
256
- </locality>
257
- </eref>
258
- <eref bibitemid="ISO712" type="inline">
259
- <locality type="clause">
260
- <referenceFrom>1</referenceFrom>
261
- </locality>
262
- <locality type="table">
263
- <referenceFrom>1</referenceFrom>
264
- </locality>
265
- </eref>
266
- <eref bibitemid="ISO712" type="inline">
267
- <locality type="clause">
268
- <referenceFrom>1</referenceFrom>
269
- </locality>
270
- <locality type="list">
271
- <referenceFrom>a</referenceFrom>
272
- </locality>
273
- </eref>
274
- <eref bibitemid="ISO712" type="inline">
275
- <locality type="clause">
276
- <referenceFrom>1</referenceFrom>
277
- </locality>
278
- </eref>
279
- <eref bibitemid="ISO712" type="inline">
280
- <locality type="clause">
281
- <referenceFrom>1.5</referenceFrom>
282
- </locality>
283
- </eref>
284
- <eref bibitemid="ISO712" type="inline">
285
- <locality type="table">
286
- <referenceFrom>1</referenceFrom>
287
- </locality>A</eref>
288
- <eref bibitemid="ISO712" type="inline">
289
- <locality type="whole"/>
290
- </eref>
291
- <eref bibitemid="ISO712" type="inline">
292
- <locality type="locality:prelude">
293
- <referenceFrom>7</referenceFrom>
294
- </locality>
295
- </eref>
296
- <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
297
- </p>
298
- </foreword>
299
- </preface>
300
- <bibliography>
301
- <references id="_normative_references" normative="true" obligation="informative">
302
- <title>Normative References</title>
303
- <bibitem id="ISO712" type="standard">
304
- <title format="text/plain">Cereals and cereal products</title>
305
- <docidentifier>ISO 712</docidentifier>
306
- <contributor>
307
- <role type="publisher"/>
308
- <organization>
309
- <abbreviation>ISO</abbreviation>
310
- </organization>
311
- </contributor>
312
- </bibitem>
313
- </references>
314
- </bibliography>
315
- </iso-standard>
316
- INPUT
317
- expect(xmlpp(output).sub(%r{<i18nyaml>.*</i18nyaml>}m, "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
318
- <?xml version='1.0'?>
319
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
320
- <preface>
321
- <foreword displayorder="1">
322
- <p>
323
- <eref bibitemid="IEV" citeas="IEV" type="inline">
324
- <locality type="clause">
325
- <referenceFrom>1-2-3</referenceFrom>
326
- </locality>IEV, 1-2-3</eref>
327
- <eref bibitemid="ISO712" citeas="ISO 712" type="inline">ISO 712</eref>
328
- <eref bibitemid="ISO712" type="inline">ISO 712</eref>
329
- <eref bibitemid="ISO712" type="inline">
330
- <locality type="table">
331
- <referenceFrom>1</referenceFrom>
332
- </locality>ISO 712, Table 1</eref>
333
- <eref bibitemid="ISO712" type="inline">
334
- <locality type="table">
335
- <referenceFrom>1</referenceFrom>
336
- <referenceTo>1</referenceTo>
337
- </locality>ISO 712, Table 1–1</eref>
338
- <eref bibitemid="ISO712" type="inline">
339
- <locality type="clause">
340
- <referenceFrom>1</referenceFrom>
341
- </locality>
342
- <locality type="table">
343
- <referenceFrom>1</referenceFrom>
344
- </locality>ISO 712, Clause 1, Table 1</eref>
345
- <eref bibitemid="ISO712" type="inline">
346
- <locality type="clause">
347
- <referenceFrom>1</referenceFrom>
348
- </locality>
349
- <locality type="list">
350
- <referenceFrom>a</referenceFrom>
351
- </locality>ISO 712, Clause 1 a)</eref>
352
- <eref bibitemid="ISO712" type="inline">
353
- <locality type="clause">
354
- <referenceFrom>1</referenceFrom>
355
- </locality>ISO 712, Clause 1</eref>
356
- <eref bibitemid="ISO712" type="inline">
357
- <locality type="clause">
358
- <referenceFrom>1.5</referenceFrom>
359
- </locality>ISO 712, 1.5</eref>
360
- <eref bibitemid="ISO712" type="inline">
361
- <locality type="table">
362
- <referenceFrom>1</referenceFrom>
363
- </locality>A</eref>
364
- <eref bibitemid="ISO712" type="inline">
365
- <locality type="whole"/>ISO 712, Whole of text</eref>
366
- <eref bibitemid="ISO712" type="inline">
367
- <locality type="locality:prelude">
368
- <referenceFrom>7</referenceFrom>
369
- </locality>ISO 712, Prelude 7</eref>
370
- <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
371
- </p>
372
- </foreword>
373
- </preface>
374
- <bibliography>
375
- <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
376
- <title depth="1">1<tab/>
377
- Normative References</title>
378
- <bibitem id="ISO712" type="standard">
379
- <title format="text/plain">Cereals and cereal products</title>
380
- <docidentifier>ISO 712</docidentifier>
381
- <contributor>
382
- <role type="publisher"/>
383
- <organization>
384
- <abbreviation>ISO</abbreviation>
385
- </organization>
386
- </contributor>
387
- </bibitem>
388
- </references>
389
- </bibliography>
390
- </iso-standard>
391
- OUTPUT
236
+ output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test",
237
+ <<~"INPUT", true)
238
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
239
+ <preface>
240
+ <foreword>
241
+ <p>
242
+ <eref bibitemid="IEV" citeas="IEV" type="inline">
243
+ <locality type="clause">
244
+ <referenceFrom>1-2-3</referenceFrom>
245
+ </locality>
246
+ </eref>
247
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline"/>
248
+ <eref bibitemid="ISO712" type="inline"/>
249
+ <eref bibitemid="ISO712" type="inline">
250
+ <locality type="table">
251
+ <referenceFrom>1</referenceFrom>
252
+ </locality>
253
+ </eref>
254
+ <eref bibitemid="ISO712" type="inline">
255
+ <locality type="table">
256
+ <referenceFrom>1</referenceFrom>
257
+ <referenceTo>1</referenceTo>
258
+ </locality>
259
+ </eref>
260
+ <eref bibitemid="ISO712" type="inline">
261
+ <locality type="clause">
262
+ <referenceFrom>1</referenceFrom>
263
+ </locality>
264
+ <locality type="table">
265
+ <referenceFrom>1</referenceFrom>
266
+ </locality>
267
+ </eref>
268
+ <eref bibitemid="ISO712" type="inline">
269
+ <locality type="clause">
270
+ <referenceFrom>1</referenceFrom>
271
+ </locality>
272
+ <locality type="list">
273
+ <referenceFrom>a</referenceFrom>
274
+ </locality>
275
+ </eref>
276
+ <eref bibitemid="ISO712" type="inline">
277
+ <locality type="clause">
278
+ <referenceFrom>1</referenceFrom>
279
+ </locality>
280
+ </eref>
281
+ <eref bibitemid="ISO712" type="inline">
282
+ <locality type="clause">
283
+ <referenceFrom>1.5</referenceFrom>
284
+ </locality>
285
+ </eref>
286
+ <eref bibitemid="ISO712" type="inline">
287
+ <locality type="table">
288
+ <referenceFrom>1</referenceFrom>
289
+ </locality>A</eref>
290
+ <eref bibitemid="ISO712" type="inline">
291
+ <locality type="whole"/>
292
+ </eref>
293
+ <eref bibitemid="ISO712" type="inline">
294
+ <locality type="locality:prelude">
295
+ <referenceFrom>7</referenceFrom>
296
+ </locality>
297
+ </eref>
298
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
299
+ </p>
300
+ </foreword>
301
+ </preface>
302
+ <bibliography>
303
+ <references id="_normative_references" normative="true" obligation="informative">
304
+ <title>Normative References</title>
305
+ <bibitem id="ISO712" type="standard">
306
+ <title format="text/plain">Cereals and cereal products</title>
307
+ <docidentifier>ISO 712</docidentifier>
308
+ <contributor>
309
+ <role type="publisher"/>
310
+ <organization>
311
+ <abbreviation>ISO</abbreviation>
312
+ </organization>
313
+ </contributor>
314
+ </bibitem>
315
+ </references>
316
+ </bibliography>
317
+ </iso-standard>
318
+ INPUT
319
+ expect(xmlpp(output).sub(%r{<i18nyaml>.*</i18nyaml>}m,
320
+ "")).to be_equivalent_to xmlpp(<<~"OUTPUT")
321
+ <?xml version='1.0'?>
322
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
323
+ <preface>
324
+ <foreword displayorder="1">
325
+ <p>
326
+ <eref bibitemid="IEV" citeas="IEV" type="inline">
327
+ <locality type="clause">
328
+ <referenceFrom>1-2-3</referenceFrom>
329
+ </locality>IEV, 1-2-3</eref>
330
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">ISO 712</eref>
331
+ <eref bibitemid="ISO712" type="inline">ISO 712</eref>
332
+ <eref bibitemid="ISO712" type="inline">
333
+ <locality type="table">
334
+ <referenceFrom>1</referenceFrom>
335
+ </locality>ISO 712, Table 1</eref>
336
+ <eref bibitemid="ISO712" type="inline">
337
+ <locality type="table">
338
+ <referenceFrom>1</referenceFrom>
339
+ <referenceTo>1</referenceTo>
340
+ </locality>ISO 712, Table 1–1</eref>
341
+ <eref bibitemid="ISO712" type="inline">
342
+ <locality type="clause">
343
+ <referenceFrom>1</referenceFrom>
344
+ </locality>
345
+ <locality type="table">
346
+ <referenceFrom>1</referenceFrom>
347
+ </locality>ISO 712, Clause 1, Table 1</eref>
348
+ <eref bibitemid="ISO712" type="inline">
349
+ <locality type="clause">
350
+ <referenceFrom>1</referenceFrom>
351
+ </locality>
352
+ <locality type="list">
353
+ <referenceFrom>a</referenceFrom>
354
+ </locality>ISO 712, Clause 1 a)</eref>
355
+ <eref bibitemid="ISO712" type="inline">
356
+ <locality type="clause">
357
+ <referenceFrom>1</referenceFrom>
358
+ </locality>ISO 712, Clause 1</eref>
359
+ <eref bibitemid="ISO712" type="inline">
360
+ <locality type="clause">
361
+ <referenceFrom>1.5</referenceFrom>
362
+ </locality>ISO 712, 1.5</eref>
363
+ <eref bibitemid="ISO712" type="inline">
364
+ <locality type="table">
365
+ <referenceFrom>1</referenceFrom>
366
+ </locality>A</eref>
367
+ <eref bibitemid="ISO712" type="inline">
368
+ <locality type="whole"/>ISO 712, Whole of text</eref>
369
+ <eref bibitemid="ISO712" type="inline">
370
+ <locality type="locality:prelude">
371
+ <referenceFrom>7</referenceFrom>
372
+ </locality>ISO 712, Prelude 7</eref>
373
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
374
+ </p>
375
+ </foreword>
376
+ </preface>
377
+ <bibliography>
378
+ <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
379
+ <title depth="1">1<tab/>
380
+ Normative References</title>
381
+ <bibitem id="ISO712" type="standard">
382
+ <title format="text/plain">Cereals and cereal products</title>
383
+ <docidentifier>ISO 712</docidentifier>
384
+ <contributor>
385
+ <role type="publisher"/>
386
+ <organization>
387
+ <abbreviation>ISO</abbreviation>
388
+ </organization>
389
+ </contributor>
390
+ </bibitem>
391
+ </references>
392
+ </bibliography>
393
+ </iso-standard>
394
+ OUTPUT
392
395
  end
393
396
 
394
397
  it "processes concept markup" do
@@ -398,7 +401,7 @@ RSpec.describe IsoDoc do
398
401
  <terms id="Terms">
399
402
  <p>
400
403
  <ul>
401
- <li><concept><refterm>term0</refterm>
404
+ <li><concept><refterm>term0</refterm>
402
405
  <xref target='clause1'/>
403
406
  </concept></li>
404
407
  <li><concept><refterm>term1</refterm>
@@ -742,7 +745,7 @@ RSpec.describe IsoDoc do
742
745
  expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
743
746
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
744
747
  end
745
-
748
+
746
749
  it "processes concept attributes" do
747
750
  input = <<~INPUT
748
751
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -776,20 +779,23 @@ RSpec.describe IsoDoc do
776
779
  <renderterm>term</renderterm>
777
780
  <xref target='clause1'/>
778
781
  </concept></li>
782
+ <li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
783
+ <li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
784
+ <li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
785
+ <li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept></li>
779
786
  </ul></p>
780
787
  </terms>
781
788
  </sections>
782
789
  </iso-standard>
783
790
  INPUT
784
791
  presxml = <<~OUTPUT
785
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
792
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
786
793
  <sections>
787
794
  <clause id="clause1" displayorder="1"><title depth="1">1<tab/>Clause 1</title></clause>
788
795
  <terms id="A" displayorder="2"><title>2</title>
789
796
  <p>
790
797
  <ul>
791
798
  <li>
792
-
793
799
  <em>term</em>
794
800
  (<xref target="clause1">Clause 1</xref>)
795
801
  </li>
@@ -803,57 +809,82 @@ RSpec.describe IsoDoc do
803
809
  </li>
804
810
  <li>
805
811
  term
806
-
807
812
  </li>
808
813
  <li>
809
814
  term
810
-
811
815
  </li>
812
816
  <li>
813
817
  term
814
-
815
818
  </li>
819
+ <li><xref target="clause1"><em>term</em></xref> (<xref target="clause1">Clause 1</xref>)</li>
820
+ <li><xref target="clause1"><em>term</em></xref> (Clause 1)</li>
821
+ <li><em>term</em> (<xref target="clause1">Clause 1</xref>)</li>
822
+ <li><em>term</em> (Clause 1)</li>
816
823
  </ul></p>
817
824
  </terms>
818
825
  </sections>
819
826
  </iso-standard>
820
827
  OUTPUT
821
828
  output = <<~OUTPUT
822
- #{HTML_HDR}
823
- <p class='zzSTDTitle1'/>
824
- <div id='clause1'>
825
- <h1>1&#160; Clause 1</h1>
826
- </div>
827
- <div id='A'>
828
- <h1>2</h1>
829
- <p>
830
- <ul>
831
- <li>
832
- <i>term</i>
833
- (
834
- <a href='#clause1'>Clause 1</a>
835
- )
836
- </li>
837
- <li>
838
- term (
839
- <a href='#clause1'>Clause 1</a>
840
- )
841
- </li>
842
- <li>
843
- <i>term</i>
844
- (
845
- <a href='#clause1'>Clause 1</a>
846
- )
847
- </li>
848
- <li> term </li>
849
- <li> term </li>
850
- <li> term </li>
851
- </ul>
852
- </p>
853
- </div>
854
- </div>
855
- </body>
856
- </html>
829
+ #{HTML_HDR}
830
+ <p class='zzSTDTitle1'/>
831
+ <div id='clause1'>
832
+ <h1>1&#160; Clause 1</h1>
833
+ </div>
834
+ <div id='A'>
835
+ <h1>2</h1>
836
+ <p>
837
+ <ul>
838
+ <li>
839
+ <i>term</i>
840
+ (
841
+ <a href='#clause1'>Clause 1</a>
842
+ )
843
+ </li>
844
+ <li>
845
+ term (
846
+ <a href='#clause1'>Clause 1</a>
847
+ )
848
+ </li>
849
+ <li>
850
+ <i>term</i>
851
+ (
852
+ <a href='#clause1'>Clause 1</a>
853
+ )
854
+ </li>
855
+ <li> term </li>
856
+ <li> term </li>
857
+ <li> term </li>
858
+ <li>
859
+ <a href='#clause1'>
860
+ <i>term</i>
861
+ </a>
862
+ (
863
+ <a href='#clause1'>Clause 1</a>
864
+ )
865
+ </li>
866
+ <li>
867
+ <a href='#clause1'>
868
+ <i>term</i>
869
+ </a>
870
+ (Clause 1)
871
+ </li>
872
+ <li>
873
+ <i>term</i>
874
+ (
875
+ <a href='#clause1'>Clause 1</a>
876
+ )
877
+ </li>
878
+ <li>
879
+ <i>term</i>
880
+ (Clause 1)
881
+ </li>
882
+ </ul>
883
+ </p>
884
+ </div>
885
+ </div>
886
+ </body>
887
+ </html>
857
888
  OUTPUT
858
889
  expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
859
890
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)