metanorma-iso 1.8.5 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,7 @@ module IsoDoc
45
45
  prefix_name(node, " — ", lbl, "name")
46
46
  end
47
47
 
48
- def eref_localities1_zh(target, type, from, to, n, delim)
48
+ def eref_localities1_zh(target, type, from, upto, node, delim)
49
49
  subsection = from&.text&.match(/\./)
50
50
  ret = if delim == ";"
51
51
  ";"
@@ -53,32 +53,31 @@ module IsoDoc
53
53
  type == "list" ? "" : delim
54
54
  end
55
55
  ret += " 第#{from.text}" if from
56
- ret += "–#{to.text}" if to
56
+ ret += "–#{upto.text}" if upto
57
57
  loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
58
58
  ret += " #{loc}" unless subsection && type == "clause" ||
59
59
  type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
60
- n["droploc"] == "true"
60
+ node["droploc"] == "true"
61
61
  ret += ")" if type == "list"
62
62
  ret
63
63
  end
64
64
 
65
- def eref_localities1(target, type, from, to, delim, n, lang = "en")
65
+ def eref_localities1(target, type, from, upto, delim, node, lang = "en")
66
66
  return "" if type == "anchor"
67
67
 
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, to, n, delim))
72
- ret = if delim == ";"
73
- ";"
71
+ return l10n(eref_localities1_zh(target, type, from, upto, node, delim))
72
+ ret = if delim == ";" then ";"
74
73
  else
75
74
  type == "list" ? "" : delim
76
75
  end
77
- ret += eref_locality_populate(type, n) unless subsection &&
76
+ ret += eref_locality_populate(type, node) unless subsection &&
78
77
  type == "clause" || type == "list" ||
79
78
  target.match(/^IEV$|^IEC 60050-/)
80
79
  ret += " #{from.text}" if from
81
- ret += "–#{to.text}" if to
80
+ ret += "–#{upto.text}" if upto
82
81
  ret += ")" if type == "list"
83
82
  l10n(ret)
84
83
  end
@@ -113,6 +112,16 @@ module IsoDoc
113
112
  end
114
113
  end
115
114
 
115
+ def concept1(node)
116
+ node&.at(ns("./refterm"))&.remove
117
+ node&.at(ns("./renderterm"))&.name = "em"
118
+ r = node.at(ns("./xref | ./eref | ./termref"))
119
+ r.name == "termref" and
120
+ r.replace(@i18n.term_defined_in.sub(/%/, r.to_xml)) or
121
+ r.replace("(#{r.to_xml})")
122
+ node.replace(node.children)
123
+ end
124
+
116
125
  include Init
117
126
  end
118
127
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.8.5".freeze
3
+ VERSION = "1.8.6".freeze
4
4
  end
5
5
  end
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
29
29
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
31
31
 
32
- spec.add_dependency "isodoc", "~> 1.6.2"
33
- spec.add_dependency "metanorma-standoc", "~> 1.9.0"
32
+ spec.add_dependency "isodoc", "~> 1.7.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.10.0"
34
34
  spec.add_dependency "mn2sts", "~> 1.8.0"
35
35
  spec.add_dependency "ruby-jing"
36
36
  spec.add_dependency "tokenizer", "~> 0.3.0"
@@ -390,4 +390,284 @@ RSpec.describe IsoDoc do
390
390
  </iso-standard>
391
391
  OUTPUT
392
392
  end
393
+
394
+ it "processes concept markup" do
395
+ input = <<~INPUT
396
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
397
+ <preface><foreword>
398
+ <p>
399
+ <ul>
400
+ <li><concept><refterm>term</refterm>
401
+ <xref target='clause1'/>
402
+ </concept></li>
403
+ <li><concept><refterm>term</refterm>
404
+ <renderterm>term</renderterm>
405
+ <xref target='clause1'/>
406
+ </concept></li>
407
+ <li><concept><refterm>term</refterm>
408
+ <renderterm>w[o]rd</renderterm>
409
+ <xref target='clause1'>Clause #1</xref>
410
+ </concept></li>
411
+ <li><concept><refterm>term</refterm>
412
+ <renderterm>term</renderterm>
413
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
414
+ </concept></li>
415
+ <li><concept><refterm>term</refterm>
416
+ <renderterm>word</renderterm>
417
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>
418
+ </concept></li>
419
+ <li><concept><refterm>term</refterm>
420
+ <renderterm>word</renderterm>
421
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
422
+ <locality type='clause'>
423
+ <referenceFrom>3.1</referenceFrom>
424
+ </locality>
425
+ <locality type='figure'>
426
+ <referenceFrom>a</referenceFrom>
427
+ </locality>
428
+ </eref>
429
+ </concept></li>
430
+ <li><concept><refterm>term</refterm>
431
+ <renderterm>word</renderterm>
432
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
433
+ <localityStack>
434
+ <locality type='clause'>
435
+ <referenceFrom>3.1</referenceFrom>
436
+ </locality>
437
+ </localityStack>
438
+ <localityStack>
439
+ <locality type='figure'>
440
+ <referenceFrom>b</referenceFrom>
441
+ </locality>
442
+ </localityStack>
443
+ </eref>
444
+ </concept></li>
445
+ <li><concept><refterm>term</refterm>
446
+ <renderterm>word</renderterm>
447
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
448
+ <localityStack>
449
+ <locality type='clause'>
450
+ <referenceFrom>3.1</referenceFrom>
451
+ </locality>
452
+ </localityStack>
453
+ <localityStack>
454
+ <locality type='figure'>
455
+ <referenceFrom>b</referenceFrom>
456
+ </locality>
457
+ </localityStack>
458
+ The Aforementioned Citation
459
+ </eref>
460
+ </concept></li>
461
+ <li><concept><refterm>term</refterm>
462
+ <renderterm>word</renderterm>
463
+ <termref base='IEV' target='135-13-13'/>
464
+ </concept></li>
465
+ <li><concept><refterm>term</refterm>
466
+ <renderterm>word</renderterm>
467
+ <termref base='IEV' target='135-13-13'>The IEV database</termref>
468
+ </concept></li>
469
+ </ul>
470
+ </p>
471
+ </foreword></preface>
472
+ <sections>
473
+ <clause id="clause1"><title>Clause 1</title></clause>
474
+ </sections>
475
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
476
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
477
+ <bibitem id="ISO712" type="standard">
478
+ <title format="text/plain">Cereals or cereal products</title>
479
+ <title type="main" format="text/plain">Cereals and cereal products</title>
480
+ <docidentifier type="ISO">ISO 712</docidentifier>
481
+ <contributor>
482
+ <role type="publisher"/>
483
+ <organization>
484
+ <name>International Organization for Standardization</name>
485
+ </organization>
486
+ </contributor>
487
+ </bibitem>
488
+ </references></bibliography>
489
+ </iso-standard>
490
+ INPUT
491
+ presxml = <<~OUTPUT
492
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
493
+ <preface><foreword displayorder="1">
494
+ <p>
495
+ <ul>
496
+ <li>
497
+ (<xref target="clause1">Clause 2</xref>)
498
+ </li>
499
+ <li>
500
+ <em>term</em>
501
+ (<xref target="clause1">Clause 2</xref>)
502
+ </li>
503
+ <li>
504
+ <em>w[o]rd</em>
505
+ (<xref target="clause1">Clause #1</xref>)
506
+ </li>
507
+ <li>
508
+ <em>term</em>
509
+ (<eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>)
510
+ </li>
511
+ <li>
512
+ <em>word</em>
513
+ (<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>)
514
+ </li>
515
+ <li>
516
+ <em>word</em>
517
+ (<eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
518
+ <referenceFrom>3.1</referenceFrom>
519
+ </locality><locality type="figure">
520
+ <referenceFrom>a</referenceFrom>
521
+ </locality>ISO 712, 3.1, Figure a</eref>)
522
+ </li>
523
+ <li>
524
+ <em>word</em>
525
+ (<eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
526
+ <locality type="clause">
527
+ <referenceFrom>3.1</referenceFrom>
528
+ </locality>
529
+ </localityStack><localityStack>
530
+ <locality type="figure">
531
+ <referenceFrom>b</referenceFrom>
532
+ </locality>
533
+ </localityStack>ISO 712, 3.1; Figure b</eref>)
534
+ </li>
535
+ <li>
536
+ <em>word</em>
537
+ (<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
538
+ <localityStack>
539
+ <locality type="clause">
540
+ <referenceFrom>3.1</referenceFrom>
541
+ </locality>
542
+ </localityStack>
543
+ <localityStack>
544
+ <locality type="figure">
545
+ <referenceFrom>b</referenceFrom>
546
+ </locality>
547
+ </localityStack>
548
+ The Aforementioned Citation
549
+ </eref>)
550
+ </li>
551
+ <li>
552
+ <em>word</em>
553
+ [term defined in <termref base="IEV" target="135-13-13"/>]
554
+ </li>
555
+ <li>
556
+ <em>word</em>
557
+ [term defined in <termref base="IEV" target="135-13-13">The IEV database</termref>]
558
+ </li>
559
+ </ul>
560
+ </p>
561
+ </foreword></preface>
562
+ <sections>
563
+ <clause id="clause1" displayorder="3"><title depth="1">2<tab/>Clause 1</title></clause>
564
+ </sections>
565
+ <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1<tab/>Normative References</title>
566
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
567
+ <bibitem id="ISO712" type="standard">
568
+ <title format="text/plain">Cereals or cereal products</title>
569
+ <title type="main" format="text/plain">Cereals and cereal products</title>
570
+ <docidentifier type="ISO">ISO 712</docidentifier>
571
+ <contributor>
572
+ <role type="publisher"/>
573
+ <organization>
574
+ <name>International Organization for Standardization</name>
575
+ </organization>
576
+ </contributor>
577
+ </bibitem>
578
+ </references></bibliography>
579
+ </iso-standard>
580
+ OUTPUT
581
+ output = <<~OUTPUT
582
+ #{HTML_HDR}
583
+ <br/>
584
+ <div>
585
+ <h1 class='ForewordTitle'>Foreword</h1>
586
+ <p>
587
+ <ul>
588
+ <li>
589
+ (
590
+ <a href='#clause1'>Clause 2</a>
591
+ )
592
+ </li>
593
+ <li>
594
+ <i>term</i>
595
+ (
596
+ <a href='#clause1'>Clause 2</a>
597
+ )
598
+ </li>
599
+ <li>
600
+ <i>w[o]rd</i>
601
+ (
602
+ <a href='#clause1'>Clause #1</a>
603
+ )
604
+ </li>
605
+ <li>
606
+ <i>term</i>
607
+ (
608
+ <a href='#ISO712'>ISO 712</a>
609
+ )
610
+ </li>
611
+ <li>
612
+ <i>word</i>
613
+ (
614
+ <a href='#ISO712'>The Aforementioned Citation</a>
615
+ )
616
+ </li>
617
+ <li>
618
+ <i>word</i>
619
+ (
620
+ <a href='#ISO712'>ISO 712, 3.1, Figure a</a>
621
+ )
622
+ </li>
623
+ <li>
624
+ <i>word</i>
625
+ (
626
+ <a href='#ISO712'>ISO 712, 3.1; Figure b</a>
627
+ )
628
+ </li>
629
+ <li>
630
+ <i>word</i>
631
+ (
632
+ <a href='#ISO712'> The Aforementioned Citation </a>
633
+ )
634
+ </li>
635
+ <li>
636
+ <i>word</i>
637
+ [term defined in Termbase IEV, term ID 135-13-13]
638
+ </li>
639
+ <li>
640
+ <i>word</i>
641
+ [term defined in Termbase IEV, term ID 135-13-13]
642
+ </li>
643
+ </ul>
644
+ </p>
645
+ </div>
646
+ <p class='zzSTDTitle1'/>
647
+ <div>
648
+ <h1>1&#160; Normative References</h1>
649
+ <p>
650
+ The following documents are referred to in the text in such a way that
651
+ some or all of their content constitutes requirements of this
652
+ document. For dated references, only the edition cited applies. For
653
+ undated references, the latest edition of the referenced document
654
+ (including any amendments) applies.
655
+ </p>
656
+ <p id='ISO712' class='NormRef'>
657
+ ISO 712,
658
+ <i>Cereals and cereal products</i>
659
+ </p>
660
+ </div>
661
+ <div id='clause1'>
662
+ <h1>2&#160; Clause 1</h1>
663
+ </div>
664
+ </div>
665
+ </body>
666
+ </html>
667
+ OUTPUT
668
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
669
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
670
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
671
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
672
+ end
393
673
  end
@@ -701,7 +701,7 @@ RSpec.describe IsoDoc do
701
701
  </clause>
702
702
  </clause>
703
703
  </sections>
704
- <indexsect id='_'>
704
+ <indexsect id='_' displayorder="2">
705
705
  <title>Index</title>
706
706
  <ul>
707
707
  <li>
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.8.5
4
+ version: 1.8.6
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-06-21 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.2
19
+ version: 1.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.2
26
+ version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-standoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.9.0
33
+ version: 1.10.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.9.0
40
+ version: 1.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mn2sts
43
43
  requirement: !ruby/object:Gem::Requirement