metanorma-standoc 1.10.8 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/asciidoctor/standoc/base.rb +5 -4
- data/lib/asciidoctor/standoc/blocks.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup.rb +20 -11
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
- data/lib/asciidoctor/standoc/cleanup_inline.rb +20 -7
- data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -21
- data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
- data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +54 -79
- data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +179 -0
- data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
- data/lib/asciidoctor/standoc/converter.rb +2 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
- data/lib/asciidoctor/standoc/inline.rb +20 -16
- data/lib/asciidoctor/standoc/isodoc.rng +254 -27
- data/lib/asciidoctor/standoc/lists.rb +1 -3
- data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
- data/lib/asciidoctor/standoc/macros_terms.rb +49 -5
- data/lib/asciidoctor/standoc/ref.rb +101 -75
- data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
- data/lib/asciidoctor/standoc/ref_sect.rb +42 -24
- data/lib/asciidoctor/standoc/reqt.rb +1 -1
- data/lib/asciidoctor/standoc/section.rb +14 -13
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
- data/lib/asciidoctor/standoc/terms.rb +12 -2
- data/lib/asciidoctor/standoc/utils.rb +36 -23
- data/lib/asciidoctor/standoc/validate.rb +25 -16
- data/lib/isodoc/html/htmlstyle.css +1 -1
- data/lib/isodoc/html/htmlstyle.scss +1 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +3 -3
- data/spec/asciidoctor/base_spec.rb +4 -3
- data/spec/asciidoctor/blocks_spec.rb +202 -21
- data/spec/asciidoctor/cleanup_sections_spec.rb +7 -7
- data/spec/asciidoctor/cleanup_spec.rb +23 -197
- data/spec/asciidoctor/cleanup_terms_spec.rb +1205 -0
- data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
- data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
- data/spec/asciidoctor/inline_spec.rb +7 -7
- data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
- data/spec/asciidoctor/macros_plantuml_spec.rb +36 -1
- data/spec/asciidoctor/macros_spec.rb +189 -112
- data/spec/asciidoctor/refs_dl_spec.rb +4 -4
- data/spec/asciidoctor/refs_spec.rb +860 -522
- data/spec/asciidoctor/section_spec.rb +18 -18
- data/spec/asciidoctor/validate_spec.rb +59 -2
- data/spec/spec_helper.rb +3 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +180 -180
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -65
- metadata +11 -8
@@ -40,10 +40,9 @@ module Asciidoctor
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def attr_code(attributes)
|
43
|
-
attributes
|
44
|
-
|
45
|
-
|
46
|
-
end.to_h
|
43
|
+
attributes.compact.transform_values do |v|
|
44
|
+
v.is_a?(String) ? HTMLEntities.new.decode(v) : v
|
45
|
+
end
|
47
46
|
end
|
48
47
|
|
49
48
|
# if the contents of node are blocks, output them to out;
|
@@ -56,7 +55,7 @@ module Asciidoctor
|
|
56
55
|
end
|
57
56
|
|
58
57
|
SUBCLAUSE_XPATH = "//clause[not(parent::sections)]"\
|
59
|
-
|
58
|
+
"[not(ancestor::boilerplate)]".freeze
|
60
59
|
|
61
60
|
def isodoc(lang, script, i18nyaml = nil)
|
62
61
|
conv = html_converter(EmptyAttr.new)
|
@@ -67,29 +66,43 @@ module Asciidoctor
|
|
67
66
|
|
68
67
|
def default_script(lang)
|
69
68
|
case lang
|
70
|
-
when "ar", "fa"
|
71
|
-
|
72
|
-
when "
|
73
|
-
|
74
|
-
when "
|
75
|
-
|
76
|
-
when "
|
77
|
-
|
78
|
-
when "
|
79
|
-
"Grek"
|
80
|
-
when "zh"
|
81
|
-
"Hans"
|
82
|
-
when "ko"
|
83
|
-
"Kore"
|
84
|
-
when "he"
|
85
|
-
"Hebr"
|
86
|
-
when "ja"
|
87
|
-
"Jpan"
|
69
|
+
when "ar", "fa" then "Arab"
|
70
|
+
when "ur" then "Aran"
|
71
|
+
when "ru", "bg" then "Cyrl"
|
72
|
+
when "hi" then "Deva"
|
73
|
+
when "el" then "Grek"
|
74
|
+
when "zh" then "Hans"
|
75
|
+
when "ko" then "Kore"
|
76
|
+
when "he" then "Hebr"
|
77
|
+
when "ja" then "Jpan"
|
88
78
|
else
|
89
79
|
"Latn"
|
90
80
|
end
|
91
81
|
end
|
92
82
|
|
83
|
+
def dl_to_attrs(elem, dlist, name)
|
84
|
+
e = dlist.at("./dt[text()='#{name}']") or return
|
85
|
+
val = e.at("./following::dd/p") || e.at("./following::dd") or return
|
86
|
+
elem[name] = val.text
|
87
|
+
end
|
88
|
+
|
89
|
+
def dl_to_elems(ins, elem, dlist, name)
|
90
|
+
a = elem.at("./#{name}[last()]")
|
91
|
+
ins = a if a
|
92
|
+
dlist.xpath("./dt[text()='#{name}']").each do |e|
|
93
|
+
v = e.at("./following::dd")
|
94
|
+
e = v.elements and e.size == 1 && e.first.name == "p" and v = e.first
|
95
|
+
v.name = name
|
96
|
+
ins.next = v
|
97
|
+
ins = ins.next
|
98
|
+
end
|
99
|
+
ins
|
100
|
+
end
|
101
|
+
|
102
|
+
def term_expr(elem)
|
103
|
+
"<expression><name>#{elem}</name></expression>"
|
104
|
+
end
|
105
|
+
|
93
106
|
class EmptyAttr
|
94
107
|
def attr(_any_attribute)
|
95
108
|
nil
|
@@ -7,7 +7,7 @@ require "iev"
|
|
7
7
|
module Asciidoctor
|
8
8
|
module Standoc
|
9
9
|
module Validate
|
10
|
-
SOURCELOCALITY = "./
|
10
|
+
SOURCELOCALITY = "./origin//locality[@type = 'clause']/"\
|
11
11
|
"referenceFrom".freeze
|
12
12
|
|
13
13
|
def init_iev
|
@@ -21,18 +21,25 @@ module Asciidoctor
|
|
21
21
|
def iev_validate(xmldoc)
|
22
22
|
@iev = init_iev or return
|
23
23
|
xmldoc.xpath("//term").each do |t|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
m << x&.text&.downcase
|
24
|
+
t.xpath(".//termsource").each do |src|
|
25
|
+
(/^IEC 60050-/.match(src&.at("./origin/@citeas")&.text) &&
|
26
|
+
loc = src.xpath(SOURCELOCALITY)&.text) or next
|
27
|
+
iev_validate1(t, loc, xmldoc)
|
29
28
|
end
|
30
|
-
pref.include?(iev.downcase) or
|
31
|
-
@log.add("Bibliography", t, %(Term "#{pref[0]}" does not match ) +
|
32
|
-
%(IEV #{loc} "#{iev}"))
|
33
29
|
end
|
34
30
|
end
|
35
31
|
|
32
|
+
def iev_validate1(term, loc, xmldoc)
|
33
|
+
iev = @iev.fetch(loc,
|
34
|
+
xmldoc&.at("//language")&.text || "en") or return
|
35
|
+
pref = term.xpath("./preferred//name").inject([]) do |m, x|
|
36
|
+
m << x&.text&.downcase
|
37
|
+
end
|
38
|
+
pref.include?(iev.downcase) or
|
39
|
+
@log.add("Bibliography", term, %(Term "#{pref[0]}" does not match ) +
|
40
|
+
%(IEV #{loc} "#{iev}"))
|
41
|
+
end
|
42
|
+
|
36
43
|
def content_validate(doc)
|
37
44
|
@fatalerror = []
|
38
45
|
xref_validate(doc)
|
@@ -40,7 +47,8 @@ module Asciidoctor
|
|
40
47
|
norm_ref_validate(doc)
|
41
48
|
repeat_id_validate(doc.root)
|
42
49
|
iev_validate(doc.root)
|
43
|
-
concept_validate(doc)
|
50
|
+
concept_validate(doc, "concept", "refterm")
|
51
|
+
concept_validate(doc, "related", "preferred//name")
|
44
52
|
@fatalerror.empty? or clean_abort(@fatalerror.join("\n"), doc.to_xml)
|
45
53
|
end
|
46
54
|
|
@@ -57,19 +65,20 @@ module Asciidoctor
|
|
57
65
|
found and @fatalerror << "Numeric reference in normative references"
|
58
66
|
end
|
59
67
|
|
60
|
-
def concept_validate(doc)
|
68
|
+
def concept_validate(doc, tag, refterm)
|
61
69
|
found = false
|
62
|
-
doc.xpath("
|
70
|
+
doc.xpath("//#{tag}/xref").each do |x|
|
63
71
|
next if doc.at("//term[@id = '#{x['target']}']")
|
64
72
|
next if doc.at("//definitions//dt[@id = '#{x['target']}']")
|
65
73
|
|
66
|
-
ref = x&.at("
|
74
|
+
ref = x&.at("../#{refterm}")&.text
|
67
75
|
@log.add("Anchors", x,
|
68
|
-
"
|
76
|
+
"#{tag.capitalize} #{ref} is pointing to "\
|
69
77
|
"#{x['target']}, which is not a term or symbol")
|
70
78
|
found = true
|
71
79
|
end
|
72
|
-
found and
|
80
|
+
found and
|
81
|
+
@fatalerror << "#{tag.capitalize} not cross-referencing term or symbol"
|
73
82
|
end
|
74
83
|
|
75
84
|
def repeat_id_validate1(ids, elem)
|
@@ -103,7 +112,7 @@ module Asciidoctor
|
|
103
112
|
def schema_validate1(file, doc, schema)
|
104
113
|
file.write(doc.to_xml)
|
105
114
|
file.close
|
106
|
-
errors = Jing.new(schema).validate(file.path)
|
115
|
+
errors = Jing.new(schema, encoding: "UTF-8").validate(file.path)
|
107
116
|
warn "Syntax Valid!" if errors.none?
|
108
117
|
errors.each do |e|
|
109
118
|
@log.add("Metanorma XML Syntax",
|
data/metanorma-standoc.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
30
|
-
spec.add_dependency "iev", "~> 0.
|
31
|
-
spec.add_dependency "isodoc", "~> 1.
|
30
|
+
spec.add_dependency "iev", "~> 0.3.0"
|
31
|
+
spec.add_dependency "isodoc", "~> 1.8.0"
|
32
32
|
spec.add_dependency "metanorma-plugin-datastruct"
|
33
33
|
spec.add_dependency "metanorma-plugin-lutaml"
|
34
34
|
spec.add_dependency "ruby-jing"
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
43
43
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
44
44
|
|
45
|
-
spec.add_development_dependency "
|
45
|
+
spec.add_development_dependency "debug"
|
46
46
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
47
47
|
spec.add_development_dependency "guard", "~> 2.14"
|
48
48
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
@@ -959,14 +959,15 @@ QU1FOiB0ZXN0Cgo=
|
|
959
959
|
|
960
960
|
it "process mn2pdf attributes" do
|
961
961
|
node = Nokogiri::XML("<fake/>").at("fake")
|
962
|
-
node[
|
962
|
+
node[Asciidoctor::Standoc::Base::FONTS_MANIFEST] =
|
963
|
+
"passed/as/font/manifest/to/mn2pdf.jar"
|
963
964
|
|
964
965
|
options = Asciidoctor::Standoc::Converter
|
965
966
|
.new(:standoc, header_footer: true)
|
966
967
|
.doc_extract_attributes(node)
|
967
968
|
|
968
|
-
expect(options.dig(:mn2pdf, :
|
969
|
-
.to eq(node[
|
969
|
+
expect(options.dig(:mn2pdf, :font_manifest))
|
970
|
+
.to eq(node[Asciidoctor::Standoc::Base::FONTS_MANIFEST])
|
970
971
|
end
|
971
972
|
|
972
973
|
private
|
@@ -353,10 +353,11 @@ RSpec.describe Asciidoctor::Standoc do
|
|
353
353
|
<title>Terms and definitions</title>
|
354
354
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
355
355
|
<term id='term-term1'>
|
356
|
-
<preferred>Term1</preferred>
|
356
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
357
357
|
<definition>
|
358
|
+
<verbal-definition>
|
358
359
|
<p id='_'>first definition</p>
|
359
|
-
<termsource status='identical'>
|
360
|
+
<termsource status='identical' type="authoritative">
|
360
361
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
361
362
|
<localityStack>
|
362
363
|
<locality type='section'>
|
@@ -365,10 +366,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
365
366
|
</localityStack>
|
366
367
|
</origin>
|
367
368
|
</termsource>
|
369
|
+
</verbal-definition>
|
368
370
|
</definition>
|
369
371
|
<definition>
|
372
|
+
<verbal-definition>
|
370
373
|
<p id='_'>second definition</p>
|
371
|
-
<termsource status='identical'>
|
374
|
+
<termsource status='identical' type="authoritative">
|
372
375
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
373
376
|
<localityStack>
|
374
377
|
<locality type='section'>
|
@@ -377,11 +380,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
377
380
|
</localityStack>
|
378
381
|
</origin>
|
379
382
|
</termsource>
|
383
|
+
</verbal-definition>
|
380
384
|
</definition>
|
381
385
|
<termnote id='_'>
|
382
386
|
<p id='_'>This is a note</p>
|
383
387
|
</termnote>
|
384
|
-
<termsource status='identical'>
|
388
|
+
<termsource status='identical' type="authoritative">
|
385
389
|
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
386
390
|
<localityStack>
|
387
391
|
<locality type='section'>
|
@@ -420,7 +424,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
420
424
|
<title>Terms and definitions</title>
|
421
425
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
422
426
|
<term id="term-term1">
|
423
|
-
<preferred>Term1</preferred>
|
427
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
424
428
|
<termnote id="_">
|
425
429
|
<p id="_">This is a note</p>
|
426
430
|
</termnote>
|
@@ -495,7 +499,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
495
499
|
<terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
|
496
500
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
497
501
|
<term id="term-term1">
|
498
|
-
<preferred>Term1</preferred>
|
502
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
499
503
|
</term>
|
500
504
|
<definitions id="_" obligation="normative" type="symbols">
|
501
505
|
<title>Symbols</title>
|
@@ -510,6 +514,59 @@ RSpec.describe Asciidoctor::Standoc do
|
|
510
514
|
.to be_equivalent_to xmlpp(output)
|
511
515
|
end
|
512
516
|
|
517
|
+
it "processes nested terms" do
|
518
|
+
input = <<~INPUT
|
519
|
+
#{ASCIIDOC_BLANK_HDR}
|
520
|
+
== Terms and Definitions
|
521
|
+
|
522
|
+
[.term]
|
523
|
+
=== Term1
|
524
|
+
|
525
|
+
definition
|
526
|
+
|
527
|
+
NOTE: Note 1
|
528
|
+
|
529
|
+
==== Term11
|
530
|
+
definition2
|
531
|
+
|
532
|
+
NOTE: Note 2
|
533
|
+
INPUT
|
534
|
+
output = <<~OUTPUT
|
535
|
+
#{BLANK_HDR}
|
536
|
+
<sections>
|
537
|
+
<clause id='_' obligation='normative'>
|
538
|
+
<title>Terms and definitions</title>
|
539
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
540
|
+
<terms id='_' obligation='normative'>
|
541
|
+
<title>Term1</title>
|
542
|
+
<p id='_'>definition</p>
|
543
|
+
<note id='_'>
|
544
|
+
<p id='_'>Note 1</p>
|
545
|
+
</note>
|
546
|
+
<term id='term-term11'>
|
547
|
+
<preferred>
|
548
|
+
<expression>
|
549
|
+
<name>Term11</name>
|
550
|
+
</expression>
|
551
|
+
</preferred>
|
552
|
+
<definition>
|
553
|
+
<verbal-definition>
|
554
|
+
<p id='_'>definition2</p>
|
555
|
+
</verbal-definition>
|
556
|
+
</definition>
|
557
|
+
<termnote id='_'>
|
558
|
+
<p id='_'>Note 2</p>
|
559
|
+
</termnote>
|
560
|
+
</term>
|
561
|
+
</terms>
|
562
|
+
</clause>
|
563
|
+
</sections>
|
564
|
+
</standard-document>
|
565
|
+
OUTPUT
|
566
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
567
|
+
.to be_equivalent_to xmlpp(output)
|
568
|
+
end
|
569
|
+
|
513
570
|
it "processes notes" do
|
514
571
|
input = <<~INPUT
|
515
572
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -653,7 +710,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
653
710
|
<title>Terms and definitions</title>
|
654
711
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
655
712
|
<term id="term-term1">
|
656
|
-
<preferred>Term1</preferred>
|
713
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
657
714
|
<termexample id="ABC" tag='X' multilingual-rendering='common'>
|
658
715
|
<p id="_">This is an example</p>
|
659
716
|
</termexample></term>
|
@@ -713,7 +770,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
713
770
|
<sections>
|
714
771
|
<terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
|
715
772
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p><term id="term-term1">
|
716
|
-
<preferred>Term1</preferred>
|
773
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
717
774
|
</term>
|
718
775
|
<definitions id="_" obligation="normative" type="symbols">
|
719
776
|
<title>Symbols</title>
|
@@ -1010,6 +1067,50 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1010
1067
|
INPUT
|
1011
1068
|
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1012
1069
|
.to include '<image src="data:image/png;base64'
|
1070
|
+
|
1071
|
+
input = <<~INPUT
|
1072
|
+
= Document title
|
1073
|
+
Author
|
1074
|
+
:docfile: test.adoc
|
1075
|
+
:nodoc:
|
1076
|
+
:novalid:
|
1077
|
+
:no-isobib:
|
1078
|
+
:data-uri-image: true
|
1079
|
+
|
1080
|
+
.Split-it-right sample divider
|
1081
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1082
|
+
INPUT
|
1083
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1084
|
+
.to include '<image src="data:image/png;base64'
|
1085
|
+
|
1086
|
+
input = <<~INPUT
|
1087
|
+
= Document title
|
1088
|
+
Author
|
1089
|
+
:docfile: test.adoc
|
1090
|
+
:nodoc:
|
1091
|
+
:novalid:
|
1092
|
+
:no-isobib:
|
1093
|
+
:data-uri-image: false
|
1094
|
+
|
1095
|
+
.Split-it-right sample divider
|
1096
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1097
|
+
INPUT
|
1098
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1099
|
+
.not_to include '<image src="data:image/png;base64'
|
1100
|
+
|
1101
|
+
input = <<~INPUT
|
1102
|
+
= Document title
|
1103
|
+
Author
|
1104
|
+
:docfile: test.adoc
|
1105
|
+
:nodoc:
|
1106
|
+
:novalid:
|
1107
|
+
:no-isobib:
|
1108
|
+
|
1109
|
+
.Split-it-right sample divider
|
1110
|
+
image::spec/examples/rice_images/rice_image1.png[]
|
1111
|
+
INPUT
|
1112
|
+
expect(strip_guid(Asciidoctor.convert(input, *OPTIONS)))
|
1113
|
+
.to include '<image src="data:image/png;base64'
|
1013
1114
|
end
|
1014
1115
|
|
1015
1116
|
it "accepts attributes on paragraphs" do
|
@@ -1124,6 +1225,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1124
1225
|
|
1125
1226
|
=== Term1
|
1126
1227
|
|
1228
|
+
Definition 0
|
1229
|
+
|
1127
1230
|
[.source]
|
1128
1231
|
<<ISO2191,section=1>>
|
1129
1232
|
|
@@ -1150,15 +1253,16 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1150
1253
|
<title>Terms and definitions</title><p id="_">For the purposes of this document,
|
1151
1254
|
the following terms and definitions apply.</p>
|
1152
1255
|
<term id="term-term1">
|
1153
|
-
<preferred>Term1</preferred>
|
1154
|
-
<
|
1256
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1257
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1258
|
+
<termsource status="identical" type="authoritative">
|
1155
1259
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1156
1260
|
<localityStack>
|
1157
1261
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
1158
1262
|
</localityStack>
|
1159
1263
|
</origin>
|
1160
1264
|
</termsource>
|
1161
|
-
<termsource status="identical">
|
1265
|
+
<termsource status="identical" type="authoritative">
|
1162
1266
|
<origin bibitemid="ISO2191" type="inline" citeas="" case='capital' droploc='true'>
|
1163
1267
|
<localityStack>
|
1164
1268
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -1167,21 +1271,23 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1167
1271
|
</termsource>
|
1168
1272
|
</term>
|
1169
1273
|
<term id='term-term2'>
|
1170
|
-
<preferred>Term2</preferred>
|
1274
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
1171
1275
|
<definition>
|
1276
|
+
<verbal-definition>
|
1172
1277
|
<p id='_'>Definition</p>
|
1278
|
+
</verbal-definition>
|
1173
1279
|
</definition>
|
1174
|
-
<termsource status='identical'>
|
1280
|
+
<termsource status='identical' type="authoritative">
|
1175
1281
|
<origin citeas=''>
|
1176
1282
|
<termref base='IEV' target='xyz'/>
|
1177
1283
|
</origin>
|
1178
1284
|
</termsource>
|
1179
|
-
<termsource status='identical'>
|
1285
|
+
<termsource status='identical' type="authoritative">
|
1180
1286
|
<origin citeas=''>
|
1181
1287
|
<termref base='IEV' target='xyz'/>
|
1182
1288
|
</origin>
|
1183
1289
|
</termsource>
|
1184
|
-
<termsource status='identical'>
|
1290
|
+
<termsource status='identical' type="authoritative">
|
1185
1291
|
<origin citeas=''>
|
1186
1292
|
<termref base='IEV' target='xyz'/>
|
1187
1293
|
</origin>
|
@@ -1202,6 +1308,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1202
1308
|
|
1203
1309
|
=== Term1
|
1204
1310
|
|
1311
|
+
Definition 0
|
1312
|
+
|
1205
1313
|
[.source]
|
1206
1314
|
<<ISO2191,section=1>>, with adjustments
|
1207
1315
|
|
@@ -1220,8 +1328,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1220
1328
|
<p id="_">For the purposes of this document,
|
1221
1329
|
the following terms and definitions apply.</p>
|
1222
1330
|
<term id="term-term1">
|
1223
|
-
<preferred>Term1</preferred>
|
1224
|
-
<
|
1331
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1332
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1333
|
+
<termsource status="modified" type="authoritative">
|
1225
1334
|
<origin bibitemid="ISO2191" type="inline" citeas="">
|
1226
1335
|
<localityStack>
|
1227
1336
|
<locality type="section"><referenceFrom>1</referenceFrom></locality>
|
@@ -1233,11 +1342,11 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1233
1342
|
</termsource>
|
1234
1343
|
</term>
|
1235
1344
|
<term id='term-term2'>
|
1236
|
-
<preferred>Term2</preferred>
|
1237
|
-
<definition>
|
1345
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
1346
|
+
<definition><verbal-definition>
|
1238
1347
|
<p id='_'>Definition</p>
|
1239
|
-
</definition>
|
1240
|
-
<termsource status='modified'>
|
1348
|
+
</verbal-definition></definition>
|
1349
|
+
<termsource status='modified' type="authoritative">
|
1241
1350
|
<origin citeas=''>
|
1242
1351
|
<termref base='IEV' target='xyz'/>
|
1243
1352
|
</origin>
|
@@ -1254,6 +1363,78 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1254
1363
|
.to be_equivalent_to xmlpp(output)
|
1255
1364
|
end
|
1256
1365
|
|
1366
|
+
|
1367
|
+
it "processes term source attributes" do
|
1368
|
+
input = <<~INPUT
|
1369
|
+
#{ASCIIDOC_BLANK_HDR}
|
1370
|
+
== Terms and Definitions
|
1371
|
+
|
1372
|
+
=== Term1
|
1373
|
+
|
1374
|
+
Definition 0
|
1375
|
+
|
1376
|
+
[.source,status=generalisation]
|
1377
|
+
<<ISO2191,section=1>>, with adjustments
|
1378
|
+
|
1379
|
+
=== Term2
|
1380
|
+
|
1381
|
+
Definition
|
1382
|
+
|
1383
|
+
[.source,type=lineage]
|
1384
|
+
{{<<IEV:xyz>>}}, with adjustments
|
1385
|
+
INPUT
|
1386
|
+
output = <<~OUTPUT
|
1387
|
+
#{BLANK_HDR}
|
1388
|
+
<sections>
|
1389
|
+
<terms id='_' obligation='normative'>
|
1390
|
+
<title>Terms and definitions</title>
|
1391
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1392
|
+
<term id='term-term1'>
|
1393
|
+
<preferred>
|
1394
|
+
<expression>
|
1395
|
+
<name>Term1</name>
|
1396
|
+
</expression>
|
1397
|
+
</preferred>
|
1398
|
+
<definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
|
1399
|
+
<termsource status='generalisation' type='authoritative'>
|
1400
|
+
<origin bibitemid='ISO2191' type='inline' citeas=''>
|
1401
|
+
<localityStack>
|
1402
|
+
<locality type='section'>
|
1403
|
+
<referenceFrom>1</referenceFrom>
|
1404
|
+
</locality>
|
1405
|
+
</localityStack>
|
1406
|
+
</origin>
|
1407
|
+
<modification>
|
1408
|
+
<p id='_'>with adjustments</p>
|
1409
|
+
</modification>
|
1410
|
+
</termsource>
|
1411
|
+
</term>
|
1412
|
+
<term id='term-term2'>
|
1413
|
+
<preferred>
|
1414
|
+
<expression>
|
1415
|
+
<name>Term2</name>
|
1416
|
+
</expression>
|
1417
|
+
</preferred>
|
1418
|
+
<definition><verbal-definition>
|
1419
|
+
<p id='_'>Definition</p>
|
1420
|
+
</verbal-definition></definition>
|
1421
|
+
<termsource status='modified' type='lineage'>
|
1422
|
+
<origin citeas=''>
|
1423
|
+
<termref base='IEV' target='xyz'/>
|
1424
|
+
</origin>
|
1425
|
+
<modification>
|
1426
|
+
<p id='_'>with adjustments</p>
|
1427
|
+
</modification>
|
1428
|
+
</termsource>
|
1429
|
+
</term>
|
1430
|
+
</terms>
|
1431
|
+
</sections>
|
1432
|
+
</standard-document>
|
1433
|
+
OUTPUT
|
1434
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1435
|
+
.to be_equivalent_to xmlpp(output)
|
1436
|
+
end
|
1437
|
+
|
1257
1438
|
it "processes recommendation" do
|
1258
1439
|
input = <<~"INPUT"
|
1259
1440
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -28,8 +28,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
28
28
|
</li>
|
29
29
|
</ul>
|
30
30
|
<term id="term-time">
|
31
|
-
<preferred>Time</preferred>
|
32
|
-
<definition><p id="_">This paragraph is extraneous</p></definition>
|
31
|
+
<preferred><expression><name>Time</name></expression></preferred>
|
32
|
+
<definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
|
33
33
|
</term></terms>
|
34
34
|
</sections>
|
35
35
|
</standard-document>
|
@@ -521,7 +521,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
521
521
|
</title>
|
522
522
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
523
523
|
<term id='term-term1'>
|
524
|
-
<preferred>Term1</preferred>
|
524
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
525
525
|
</term>
|
526
526
|
</terms>
|
527
527
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -796,7 +796,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
796
796
|
<title>Terms and definitions</title>
|
797
797
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
798
798
|
<term id='term-term1'>
|
799
|
-
<preferred>Term1</preferred>
|
799
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
800
800
|
</term>
|
801
801
|
</terms>
|
802
802
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1033,7 +1033,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1033
1033
|
s’appliquent.
|
1034
1034
|
</p>
|
1035
1035
|
<term id='term-term1'>
|
1036
|
-
<preferred>Term1</preferred>
|
1036
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1037
1037
|
</term>
|
1038
1038
|
</terms>
|
1039
1039
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1267,7 +1267,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1267
1267
|
<title>术语和定义</title>
|
1268
1268
|
<p id='_'>下列术语和定义适用于本文件。</p>
|
1269
1269
|
<term id='term-term1'>
|
1270
|
-
<preferred>Term1</preferred>
|
1270
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1271
1271
|
</term>
|
1272
1272
|
</terms>
|
1273
1273
|
<clause id='_' inline-header='false' obligation='normative'>
|
@@ -1501,7 +1501,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
1501
1501
|
<title>Terms and definitions</title>
|
1502
1502
|
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
1503
1503
|
<term id='term-term1'>
|
1504
|
-
<preferred>Term1</preferred>
|
1504
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
1505
1505
|
</term>
|
1506
1506
|
</terms>
|
1507
1507
|
<clause id='_' inline-header='false' obligation='normative'>
|