metanorma-iso 1.10.4 → 1.10.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -131,27 +131,28 @@ RSpec.describe IsoDoc do
131
131
  <sections>
132
132
  </iso-standard>
133
133
  INPUT
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
134
+ expect(xmlpp(output
135
+ .sub(/<html/, "<html xmlns:m='m'")))
136
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
137
+ #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
138
+ <br/>
139
+ <div>
140
+ <h1 class="ForewordTitle">Foreword</h1>
141
+ <p>
142
+ <span class="stem">(#(A)#)</span>
143
+ <span class="stem">
144
+ <m:math>
145
+ <m:row>X</m:row>
146
+ </m:math>
147
+ </span>
148
+ <span class="stem">Latex?</span>
149
+ </p>
150
+ </div>
151
+ <p class="zzSTDTitle1"/>
152
+ </div>
153
+ </body>
154
+ </html>
155
+ OUTPUT
155
156
  end
156
157
 
157
158
  it "overrides AsciiMath delimiters" do
@@ -233,165 +234,166 @@ RSpec.describe IsoDoc do
233
234
  end
234
235
 
235
236
  it "processes eref content" do
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
237
+ output = IsoDoc::Iso::PresentationXMLConvert.new({})
238
+ .convert("test", <<~"INPUT", true)
239
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
240
+ <preface>
241
+ <foreword>
242
+ <p>
243
+ <eref bibitemid="IEV" citeas="IEV" type="inline">
244
+ <locality type="clause">
245
+ <referenceFrom>1-2-3</referenceFrom>
246
+ </locality>
247
+ </eref>
248
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline"/>
249
+ <eref bibitemid="ISO712" type="inline"/>
250
+ <eref bibitemid="ISO712" type="inline">
251
+ <locality type="table">
252
+ <referenceFrom>1</referenceFrom>
253
+ </locality>
254
+ </eref>
255
+ <eref bibitemid="ISO712" type="inline">
256
+ <locality type="table">
257
+ <referenceFrom>1</referenceFrom>
258
+ <referenceTo>1</referenceTo>
259
+ </locality>
260
+ </eref>
261
+ <eref bibitemid="ISO712" type="inline">
262
+ <locality type="clause">
263
+ <referenceFrom>1</referenceFrom>
264
+ </locality>
265
+ <locality type="table">
266
+ <referenceFrom>1</referenceFrom>
267
+ </locality>
268
+ </eref>
269
+ <eref bibitemid="ISO712" type="inline">
270
+ <locality type="clause">
271
+ <referenceFrom>1</referenceFrom>
272
+ </locality>
273
+ <locality type="list">
274
+ <referenceFrom>a</referenceFrom>
275
+ </locality>
276
+ </eref>
277
+ <eref bibitemid="ISO712" type="inline">
278
+ <locality type="clause">
279
+ <referenceFrom>1</referenceFrom>
280
+ </locality>
281
+ </eref>
282
+ <eref bibitemid="ISO712" type="inline">
283
+ <locality type="clause">
284
+ <referenceFrom>1.5</referenceFrom>
285
+ </locality>
286
+ </eref>
287
+ <eref bibitemid="ISO712" type="inline">
288
+ <locality type="table">
289
+ <referenceFrom>1</referenceFrom>
290
+ </locality>A</eref>
291
+ <eref bibitemid="ISO712" type="inline">
292
+ <locality type="whole"/>
293
+ </eref>
294
+ <eref bibitemid="ISO712" type="inline">
295
+ <locality type="locality:prelude">
296
+ <referenceFrom>7</referenceFrom>
297
+ </locality>
298
+ </eref>
299
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
300
+ </p>
301
+ </foreword>
302
+ </preface>
303
+ <bibliography>
304
+ <references id="_normative_references" normative="true" obligation="informative">
305
+ <title>Normative References</title>
306
+ <bibitem id="ISO712" type="standard">
307
+ <title format="text/plain">Cereals and cereal products</title>
308
+ <docidentifier>ISO 712</docidentifier>
309
+ <contributor>
310
+ <role type="publisher"/>
311
+ <organization>
312
+ <abbreviation>ISO</abbreviation>
313
+ </organization>
314
+ </contributor>
315
+ </bibitem>
316
+ </references>
317
+ </bibliography>
318
+ </iso-standard>
319
+ INPUT
320
+ expect(xmlpp(output)
321
+ .sub(%r{<i18nyaml>.*</i18nyaml>}m, ""))
322
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
323
+ <?xml version='1.0'?>
324
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
325
+ <preface>
326
+ <foreword displayorder="1">
327
+ <p>
328
+ <eref bibitemid="IEV" citeas="IEV" type="inline">
329
+ <locality type="clause">
330
+ <referenceFrom>1-2-3</referenceFrom>
331
+ </locality>IEV, 1-2-3</eref>
332
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">ISO 712</eref>
333
+ <eref bibitemid="ISO712" type="inline">ISO 712</eref>
334
+ <eref bibitemid="ISO712" type="inline">
335
+ <locality type="table">
336
+ <referenceFrom>1</referenceFrom>
337
+ </locality>ISO 712, Table 1</eref>
338
+ <eref bibitemid="ISO712" type="inline">
339
+ <locality type="table">
340
+ <referenceFrom>1</referenceFrom>
341
+ <referenceTo>1</referenceTo>
342
+ </locality>ISO 712, Table 1–1</eref>
343
+ <eref bibitemid="ISO712" type="inline">
344
+ <locality type="clause">
345
+ <referenceFrom>1</referenceFrom>
346
+ </locality>
347
+ <locality type="table">
348
+ <referenceFrom>1</referenceFrom>
349
+ </locality>ISO 712, Clause 1, Table 1</eref>
350
+ <eref bibitemid="ISO712" type="inline">
351
+ <locality type="clause">
352
+ <referenceFrom>1</referenceFrom>
353
+ </locality>
354
+ <locality type="list">
355
+ <referenceFrom>a</referenceFrom>
356
+ </locality>ISO 712, Clause 1 a)</eref>
357
+ <eref bibitemid="ISO712" type="inline">
358
+ <locality type="clause">
359
+ <referenceFrom>1</referenceFrom>
360
+ </locality>ISO 712, Clause 1</eref>
361
+ <eref bibitemid="ISO712" type="inline">
362
+ <locality type="clause">
363
+ <referenceFrom>1.5</referenceFrom>
364
+ </locality>ISO 712, 1.5</eref>
365
+ <eref bibitemid="ISO712" type="inline">
366
+ <locality type="table">
367
+ <referenceFrom>1</referenceFrom>
368
+ </locality>A</eref>
369
+ <eref bibitemid="ISO712" type="inline">
370
+ <locality type="whole"/>ISO 712, Whole of text</eref>
371
+ <eref bibitemid="ISO712" type="inline">
372
+ <locality type="locality:prelude">
373
+ <referenceFrom>7</referenceFrom>
374
+ </locality>ISO 712, Prelude 7</eref>
375
+ <eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
376
+ </p>
377
+ </foreword>
378
+ </preface>
379
+ <bibliography>
380
+ <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
381
+ <title depth="1">1<tab/>
382
+ Normative References</title>
383
+ <bibitem id="ISO712" type="standard">
384
+ <title format="text/plain">Cereals and cereal products</title>
385
+ <docidentifier>ISO 712</docidentifier>
386
+ <contributor>
387
+ <role type="publisher"/>
388
+ <organization>
389
+ <abbreviation>ISO</abbreviation>
390
+ </organization>
391
+ </contributor>
392
+ </bibitem>
393
+ </references>
394
+ </bibliography>
395
+ </iso-standard>
396
+ OUTPUT
395
397
  end
396
398
 
397
399
  it "processes concept markup" do
@@ -726,43 +728,67 @@ RSpec.describe IsoDoc do
726
728
  </concept></li>
727
729
  </ul>
728
730
  </term>
731
+ <term id="clause2">
732
+ <ul>
733
+ <li><concept><refterm>term1</refterm>
734
+ <renderterm>term</renderterm>
735
+ <xref target='clause1'/>
736
+ </concept></li>
737
+ <li><concept><refterm>term1</refterm>
738
+ <renderterm>term</renderterm>
739
+ <xref target='clause1'/>
740
+ </concept></li>
741
+ </ul>
742
+ </term>
729
743
  </terms>
730
744
  </sections>
731
745
  </iso-standard>
732
746
  INPUT
733
747
  presxml = <<~OUTPUT
734
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
735
- <preface>
736
- <foreword id='A' displayorder='1'>
737
- <ul>
738
- <li>term</li>
739
- </ul>
740
- </foreword>
741
- </preface>
742
- <sections>
743
- <terms id='Terms' displayorder='2'>
744
- <title>1</title>
745
- <clause id='A' inline-header='true'>
746
- <title>1.1</title>
747
- <ul>
748
- <li> term </li>
749
- </ul>
750
- </clause>
751
- <term id='clause1'>
752
- <name>1.2</name>
753
- <ul>
754
- <li>
755
- <em>term</em>
756
- (
757
- <xref target='clause1'>1.2</xref>
758
- )
759
- </li>
760
- <li>term</li>
761
- </ul>
762
- </term>
763
- </terms>
764
- </sections>
765
- </iso-standard>
748
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
749
+ <preface>
750
+ <foreword id='A' displayorder='1'>
751
+ <ul>
752
+ <li>term</li>
753
+ </ul>
754
+ </foreword>
755
+ </preface>
756
+ <sections>
757
+ <terms id='Terms' displayorder='2'>
758
+ <title>1</title>
759
+ <clause id='A' inline-header='true'>
760
+ <title>1.1</title>
761
+ <ul>
762
+ <li> term </li>
763
+ </ul>
764
+ </clause>
765
+ <term id='clause1'>
766
+ <name>1.2</name>
767
+ <ul>
768
+ <li>
769
+ <em>term</em>
770
+ (
771
+ <xref target='clause1'>1.2</xref>
772
+ )
773
+ </li>
774
+ <li> term </li>
775
+ </ul>
776
+ </term>
777
+ <term id='clause2'>
778
+ <name>1.3</name>
779
+ <ul>
780
+ <li>
781
+ <em>term</em>
782
+ (
783
+ <xref target='clause1'>1.2</xref>
784
+ )
785
+ </li>
786
+ <li> term </li>
787
+ </ul>
788
+ </term>
789
+ </terms>
790
+ </sections>
791
+ </iso-standard>
766
792
  OUTPUT
767
793
  expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
768
794
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
@@ -57,7 +57,9 @@ RSpec.describe IsoDoc::Iso do
57
57
  end
58
58
 
59
59
  it "processes isodoc as ISO: user nominated fonts" do
60
- IsoDoc::Iso::HtmlConvert.new(bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono")
60
+ IsoDoc::Iso::HtmlConvert.new(bodyfont: "Zapf Chancery",
61
+ headerfont: "Comic Sans",
62
+ monospacefont: "Andale Mono")
61
63
  .convert("test", <<~"INPUT", false)
62
64
  <iso-standard xmlns="http://riboseinc.com/isoxml">
63
65
  <preface>
@@ -39,15 +39,15 @@ RSpec.describe IsoDoc do
39
39
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
40
40
  <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
41
41
  </termnote>
42
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
43
- <ul><li>A</li></ul>
44
- <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
45
- </termnote>
46
42
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
47
43
  <ul>
48
44
  <li>A</li>
49
45
  </ul>
50
46
  </termexample>
47
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
48
+ <ul><li>A</li></ul>
49
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
50
+ </termnote>
51
51
  <termsource status="identical">
52
52
  <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
53
53
  </termsource>