asciidoctor-iso 0.9.7 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 225229b725b0ffc73cc5acc93152e63dc14393642e70760091d26f018a7ca329
4
- data.tar.gz: 8268c280a53388ca060ddc42756bd0ca548a90caceb5c75ea9d376a52ead3516
3
+ metadata.gz: 1cb66e36c45b81ea74df0f2f99014369c36ee1910425fbfe258034da6498b6de
4
+ data.tar.gz: 5967537b4c5ecf61bc2cdf3a6ce85219df2f92b03caa447b6c0594b07300fc82
5
5
  SHA512:
6
- metadata.gz: 2c3b97e89a0663e6df5127339c71f3cd437bf6ddc0eeb19a38679474d59bc7072fe5de846493d99c2e02807e12d39734c3e4b08a97a8fde29215537d887701be
7
- data.tar.gz: eddf671a4b9e67b78ca10a7cd708e089455512bd7f4427c4452903aee178bf601ff80a815393d28e3a45360021d9cfa9d6a2bd57b9420ee1fbc1a119ba670e70
6
+ metadata.gz: 26da20f2117a447051df311f61145aa0f5841d78adad3ebfcef08b3c97208c353e19add9151f5eda043d27621822b4b09440bfe51aca92dad754452e7ad8ad2e
7
+ data.tar.gz: 2cd75fbdd50c9858a0b1ed81d4f1a77e59cbdac4eccb315be14b06ff50a4a621d5f3bf7363c4940cfe9fcd9e1dfda224f4349e35202b1d82c1bdd7a66f5695aa
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
- source "https://rubygems.org"
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
2
3
 
3
- gem "relaton", github: "riboseinc/relaton"
4
+ source "https://rubygems.org"
4
5
 
5
6
  # Specify your gem's dependencies in gemspec
6
7
  gemspec
@@ -452,6 +452,69 @@ from the image.
452
452
  image::logo.jpg
453
453
  --
454
454
 
455
+ === Sections embedded more than 5 levels
456
+
457
+ Asciidoctor permits only 5 levels of section embedding (not counting the document title).
458
+ Standards do contain more levels of embedding; ISO/IEC DIR 2 only considers it a problem
459
+ if there are more than 7 levels of embedding. To realise higher levels of embedding,
460
+ prefix a 5-level section title with the attribute `level=`:
461
+
462
+ [source,asciidoctor]
463
+ --
464
+ ====== Clause 5
465
+
466
+ [level=6]
467
+ ===== Clause 6
468
+
469
+ [level=7]
470
+ ====== Clause 7A
471
+
472
+ [level=7]
473
+ ====== Clause 7B
474
+
475
+ [level=6]
476
+ ====== Clause 6B
477
+
478
+ ====== Clause 5B
479
+ --
480
+
481
+ This generates the following ISO XML:
482
+
483
+ [source,xml]
484
+ --
485
+ <clause id="_" inline-header="false" obligation="normative">
486
+ <title>
487
+ Clause 5
488
+ </title>
489
+ <clause id="_" inline-header="false" obligation="normative">
490
+ <title>
491
+ Clause 6
492
+ </title>
493
+ <clause id="_" inline-header="false" obligation="normative">
494
+ <title>
495
+ Clause 7A
496
+ </title>
497
+ </clause>
498
+ <clause id="_" inline-header="false" obligation="normative">
499
+ <title>
500
+ Clause 7B
501
+ </title>
502
+ </clause>
503
+ </clause>
504
+ <clause id="_" inline-header="false" obligation="normative">
505
+ <title>
506
+ Clause 6B
507
+ </title>
508
+ </clause>
509
+ </clause>
510
+ <clause id="_" inline-header="false" obligation="normative">
511
+ <title>
512
+ Clause 5B
513
+ </title>
514
+ </clause>
515
+ --
516
+
517
+
455
518
  === Features not visible in HTML preview
456
519
 
457
520
  The gem uses built-in Asciidoc formatting as much as possible, so that users
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "ruby-jing"
32
32
  spec.add_dependency "isodoc", ">= 0.8"
33
33
  spec.add_dependency "iev", "~> 0.1.0"
34
- spec.add_dependency "relaton", "~> 0.1.1"
34
+ spec.add_dependency "relaton", "~> 0.1.3"
35
35
 
36
36
  spec.add_development_dependency "bundler", "~> 1.15"
37
37
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -104,7 +104,7 @@ module Asciidoctor
104
104
  init(node)
105
105
  ret = makexml(node).to_xml(indent: 2)
106
106
  unless node.attr("nodoc") || !node.attr("docfile")
107
- File.open(@filename + ".xml", "w") { |f| f.write(ret) }
107
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
108
108
  html_converter_alt(node).convert(@filename + ".xml")
109
109
  system "mv #{@filename}.html #{@filename}_alt.html"
110
110
  html_converter(node).convert(@filename + ".xml")
@@ -123,17 +123,43 @@ module Asciidoctor
123
123
  def make_bibliography(x, s)
124
124
  if x.at("//sections/references")
125
125
  biblio = s.add_next_sibling("<bibliography/>").first
126
- x.xpath("//sections/references").each { |r| biblio.add_child r.remove }
126
+ x.xpath("//sections/references").each do |r|
127
+ biblio.add_child r.remove
128
+ end
127
129
  end
128
130
  end
129
131
 
130
- def sections_cleanup(x)
132
+ def sections_order_cleanup(x)
131
133
  s = x.at("//sections")
132
134
  make_preface(x, s)
133
135
  make_bibliography(x, s)
134
136
  x.xpath("//sections/annex").reverse_each { |r| s.next = r.remove }
135
137
  end
136
138
 
139
+ def maxlevel(x)
140
+ max = 5
141
+ x.xpath("//clause[@level]").each do |c|
142
+ max = c["level"].to_i if max < c["level"].to_i
143
+ end
144
+ max
145
+ end
146
+
147
+ def sections_level_cleanup(x)
148
+ m = maxlevel(x)
149
+ return if m < 6
150
+ m.downto(6).each do |l|
151
+ x.xpath("//clause[@level = '#{l}']").each do |c|
152
+ c.delete("level")
153
+ c.previous_element << c.remove
154
+ end
155
+ end
156
+ end
157
+
158
+ def sections_cleanup(x)
159
+ sections_order_cleanup(x)
160
+ sections_level_cleanup(x)
161
+ end
162
+
137
163
  def obligations_cleanup(x)
138
164
  obligations_cleanup_info(x)
139
165
  obligations_cleanup_norm(x)
@@ -88,12 +88,7 @@ module Asciidoctor
88
88
  nil # Render reference without an Internet connection.
89
89
  end
90
90
 
91
- # TODO: alternative where only title is available
92
- def refitem(xml, item, node)
93
- unless m = NON_ISO_REF.match(item)
94
- Utils::warning(node, "no anchor on reference", item)
95
- return
96
- end
91
+ def refitem_render(xml, m)
97
92
  xml.bibitem **attr_code(id: m[:anchor]) do |t|
98
93
  t.formattedref **{ format: "application/x-isodoc+xml" } do |i|
99
94
  i << ref_normalise_no_format(m[:text])
@@ -102,6 +97,20 @@ module Asciidoctor
102
97
  end
103
98
  end
104
99
 
100
+ # TODO: alternative where only title is available
101
+ def refitem(xml, item, node)
102
+ unless m = NON_ISO_REF.match(item)
103
+ Utils::warning(node, "no anchor on reference", item)
104
+ return
105
+ end
106
+ unless m[:code] && /^\d+$/.match?(m[:code])
107
+ ref = fetch_ref xml, m[:code],
108
+ m.named_captures.has_key?("year") ? m[:year] : nil, {}
109
+ return use_my_anchor(ref, m[:anchor]) if ref
110
+ end
111
+ refitem_render(xml, m)
112
+ end
113
+
105
114
  def ref_normalise(ref)
106
115
  ref.
107
116
  # gsub(/&#8201;&#8212;&#8201;/, " -- ").
@@ -130,7 +139,7 @@ module Asciidoctor
130
139
  (?<text>.*)$}xm
131
140
 
132
141
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
133
- \[(?<code>[^\]]+)\]</ref>,?\s
142
+ \[(?<code>[^\]]+?)([:-](?<year>(19|20)[0-9][0-9]))?\]</ref>,?\s
134
143
  (?<text>.*)$}xm
135
144
 
136
145
  # @param item [String]
@@ -165,8 +174,8 @@ module Asciidoctor
165
174
  end
166
175
 
167
176
  def bibliocache_name(global)
168
- global ? "#{Dir.home}/.relaton-bib.json" :
169
- "#{@filename}.relaton.json"
177
+ global ? "#{Dir.home}/.relaton-bib.pstore" :
178
+ "#{@filename}.relaton.pstore"
170
179
  end
171
180
  end
172
181
  end
@@ -74,13 +74,11 @@ module Asciidoctor
74
74
  end
75
75
  end
76
76
 
77
- # Not testing max depth of sections: Asciidoctor already limits
78
- # it to 5 levels of nesting
79
77
  def clause_parse(attrs, xml, node)
80
78
  attrs["inline-header".to_sym] = node.option? "inline-header"
79
+ attrs[:level] = node.attr("level")
81
80
  set_obligation(attrs, node)
82
- sect = node.level == 1 ? "clause" : "clause"
83
- xml.send sect, **attr_code(attrs) do |xml_section|
81
+ xml.send "clause", **attr_code(attrs) do |xml_section|
84
82
  xml_section.title { |n| n << node.title } unless node.title.nil?
85
83
  xml_section << node.content
86
84
  end
@@ -194,7 +194,7 @@ module Asciidoctor
194
194
  end
195
195
 
196
196
  def schema_validate(doc, filename)
197
- File.open(".tmp.xml", "w") { |f| f.write(doc.to_xml) }
197
+ File.open(".tmp.xml", "w:UTF-8") { |f| f.write(doc.to_xml) }
198
198
  begin
199
199
  errors = Jing.new(filename).validate(".tmp.xml")
200
200
  rescue Jing::Error => e
@@ -9,6 +9,7 @@ module Asciidoctor
9
9
  symbols_validate(doc.root)
10
10
  sections_sequence_validate(doc.root)
11
11
  section_style(doc.root)
12
+ subclause_validate(doc.root)
12
13
  sourcecode_style(doc.root)
13
14
  asset_style(doc.root)
14
15
  end
@@ -196,6 +197,12 @@ module Asciidoctor
196
197
  asset_title_style(root)
197
198
  norm_bibitem_style(root)
198
199
  end
200
+
201
+ def subclause_validate(root)
202
+ root.xpath("//clause/clause/clause/clause/clause/clause/clause/clause").each do |c|
203
+ style_warning(c, "Exceeds the maximum clause depth of 7", nil)
204
+ end
205
+ end
199
206
  end
200
207
  end
201
208
  end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module ISO
3
- VERSION = "0.9.7".freeze
3
+ VERSION = "0.9.9".freeze
4
4
  end
5
5
  end
@@ -699,4 +699,67 @@ r = 1 %</stem>
699
699
  </iso-standard>
700
700
  OUTPUT
701
701
  end
702
+
703
+ it "extends clause levels past 5" do
704
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
705
+ #{ASCIIDOC_BLANK_HDR}
706
+
707
+ == Clause1
708
+
709
+ === Clause2
710
+
711
+ ==== Clause3
712
+
713
+ ===== Clause4
714
+
715
+ ====== Clause 5
716
+
717
+ [level=6]
718
+ ====== Clause 6
719
+
720
+ [level=7]
721
+ ====== Clause 7A
722
+
723
+ [level=7]
724
+ ====== Clause 7B
725
+
726
+ [level=6]
727
+ ====== Clause 6B
728
+
729
+ ====== Clause 5B
730
+
731
+ INPUT
732
+ #{BLANK_HDR}
733
+ <sections>
734
+ <clause id="_" inline-header="false" obligation="normative">
735
+ <title>Clause1</title>
736
+ <clause id="_" inline-header="false" obligation="normative">
737
+ <title>Clause2</title>
738
+ <clause id="_" inline-header="false" obligation="normative">
739
+ <title>Clause3</title>
740
+ <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
741
+ <title>Clause 5</title>
742
+ <clause id="_" inline-header="false" obligation="normative">
743
+ <title>Clause 6</title>
744
+ <clause id="_" inline-header="false" obligation="normative">
745
+ <title>Clause 7A</title>
746
+ </clause><clause id="_" inline-header="false" obligation="normative">
747
+ <title>Clause 7B</title>
748
+ </clause></clause><clause id="_" inline-header="false" obligation="normative">
749
+ <title>Clause 6B</title>
750
+ </clause></clause>
751
+
752
+
753
+
754
+
755
+ <clause id="_" inline-header="false" obligation="normative">
756
+ <title>Clause 5B</title>
757
+ </clause></clause>
758
+ </clause>
759
+ </clause>
760
+ </clause>
761
+ </sections>
762
+ </iso-standard>
763
+ OUTPUT
764
+ end
702
765
  end
@@ -44,8 +44,8 @@ EOS
44
44
  EOS
45
45
 
46
46
  it "does not activate biblio caches if isobib disabled" do
47
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
48
- system "rm -f test.relaton.json"
47
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
48
+ system "rm -f test.relaton.pstore"
49
49
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
50
50
  #{ASCIIDOC_BLANK_HDR}
51
51
  [bibliography]
@@ -53,16 +53,16 @@ EOS
53
53
 
54
54
  * [[[iso123,ISO 123:2001]]] _Standard_
55
55
  INPUT
56
- expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be false
57
- expect(File.exist?("test.relaton.json")).to be false
56
+ expect(File.exist?("#{Dir.home}/.relaton-bib.pstore")).to be false
57
+ expect(File.exist?("test.relaton.pstore")).to be false
58
58
 
59
- system "rm ~/.relaton-bib.json"
60
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
59
+ system "rm ~/.relaton-bib.pstore"
60
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
61
61
  end
62
62
 
63
63
  it "does not activate biblio caches if isobib caching disabled" do
64
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
65
- system "rm -f test.relaton.json"
64
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
65
+ system "rm -f test.relaton.pstore"
66
66
  mock_isobib_get_123
67
67
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
68
68
  #{ISOBIB_BLANK_HDR}
@@ -71,17 +71,17 @@ EOS
71
71
 
72
72
  * [[[iso123,ISO 123:2001]]] _Standard_
73
73
  INPUT
74
- expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be false
75
- expect(File.exist?("test.relaton.json")).to be false
74
+ expect(File.exist?("#{Dir.home}/.relaton-bib.pstore")).to be false
75
+ expect(File.exist?("test.relaton.pstore")).to be false
76
76
 
77
- system "rm ~/.relaton-bib.json"
78
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
77
+ system "rm ~/.relaton-bib.pstore"
78
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
79
79
  end
80
80
 
81
81
  it "flushes biblio caches" do
82
- system "cp ~/.relaton-bib.json ~/.relaton-bib.json1"
82
+ system "cp ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
83
83
 
84
- File.open("#{Dir.home}/.relaton-bib.json", "w") do |f|
84
+ File.open("#{Dir.home}/.relaton-bib.pstore", "w") do |f|
85
85
  f.write "XXX"
86
86
  end
87
87
 
@@ -93,21 +93,21 @@ EOS
93
93
 
94
94
  * [[[iso123,ISO 123:2001]]] _Standard_
95
95
  INPUT
96
- expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
96
+ expect(File.exist?("#{Dir.home}/.relaton-bib.pstore")).to be true
97
97
 
98
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
98
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
99
99
  entry = db.load_entry("ISO 123:2001")
100
100
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
101
101
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_DATED)
102
102
 
103
- system "rm ~/.relaton-bib.json"
104
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
103
+ system "rm ~/.relaton-bib.pstore"
104
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
105
105
  end
106
106
 
107
107
 
108
108
  it "activates global cache" do
109
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
110
- system "rm -f test.relaton.json"
109
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
110
+ system "rm -f test.relaton.pstore"
111
111
  mock_isobib_get_123
112
112
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
113
113
  #{CACHED_ISOBIB_BLANK_HDR}
@@ -116,20 +116,20 @@ EOS
116
116
 
117
117
  * [[[iso123,ISO 123:2001]]] _Standard_
118
118
  INPUT
119
- expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
120
- expect(File.exist?("test.relaton.json")).to be false
119
+ expect(File.exist?("#{Dir.home}/.relaton-bib.pstore")).to be true
120
+ expect(File.exist?("test.relaton.pstore")).to be false
121
121
 
122
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
122
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
123
123
  entry = db.load_entry("ISO 123:2001")
124
124
  expect(entry).to_not be nil
125
125
 
126
- system "rm ~/.relaton-bib.json"
127
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
126
+ system "rm ~/.relaton-bib.pstore"
127
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
128
128
  end
129
129
 
130
130
  it "activates local cache" do
131
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
132
- system "rm -f test.relaton.json"
131
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
132
+ system "rm -f test.relaton.pstore"
133
133
  mock_isobib_get_123
134
134
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
135
135
  #{LOCAL_CACHED_ISOBIB_BLANK_HDR}
@@ -138,25 +138,25 @@ EOS
138
138
 
139
139
  * [[[iso123,ISO 123:2001]]] _Standard_
140
140
  INPUT
141
- expect(File.exist?("#{Dir.home}/.relaton-bib.json")).to be true
142
- expect(File.exist?("test.relaton.json")).to be true
141
+ expect(File.exist?("#{Dir.home}/.relaton-bib.pstore")).to be true
142
+ expect(File.exist?("test.relaton.pstore")).to be true
143
143
 
144
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
144
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
145
145
  entry = db.load_entry("ISO 123:2001")
146
146
  expect(entry).to_not be nil
147
147
 
148
- db = Relaton::Db.new "test.relaton.json", nil
148
+ db = Relaton::Db.new "test.relaton.pstore", nil
149
149
  entry = db.load_entry("ISO 123:2001")
150
150
  expect(entry).to_not be nil
151
151
 
152
- system "rm ~/.relaton-bib.json"
153
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
152
+ system "rm ~/.relaton-bib.pstore"
153
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
154
154
  end
155
155
 
156
156
 
157
157
  it "fetches uncached references" do
158
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
159
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
158
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
159
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
160
160
  db.save_entry("ISO 123:2001",
161
161
  {
162
162
  "fetched" => Date.today.to_s,
@@ -182,17 +182,17 @@ EOS
182
182
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
183
183
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_124_DATED)
184
184
 
185
- system "rm ~/.relaton-bib.json"
186
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
185
+ system "rm ~/.relaton-bib.pstore"
186
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
187
187
  end
188
188
 
189
189
  it "expires stale undated references" do
190
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
190
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
191
191
 
192
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
192
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
193
193
  db.save_entry("ISO 123",
194
194
  {
195
- "fetched" => (Date.today - 90).to_s,
195
+ "fetched" => (Date.today - 90),
196
196
  "bib" => IsoBibItem.from_xml(ISO_123_SHORT)
197
197
  }
198
198
  )
@@ -211,17 +211,17 @@ EOS
211
211
  expect(entry["fetched"].to_s).to eq(Date.today.to_s)
212
212
  expect(entry["bib"].to_xml).to be_equivalent_to(ISOBIB_123_UNDATED)
213
213
 
214
- system "rm ~/.relaton-bib.json"
215
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
214
+ system "rm ~/.relaton-bib.pstore"
215
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
216
216
  end
217
217
 
218
218
  it "does not expire stale dated references" do
219
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
219
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
220
220
 
221
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
221
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
222
222
  db.save_entry("ISO 123:2001",
223
223
  {
224
- "fetched" => (Date.today - 90).to_s,
224
+ "fetched" => (Date.today - 90),
225
225
  "bib" => IsoBibItem.from_xml(ISO_123_SHORT)
226
226
  }
227
227
  )
@@ -238,32 +238,32 @@ EOS
238
238
  expect(entry["fetched"].to_s).to eq((Date.today - 90).to_s)
239
239
  expect(entry["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
240
240
 
241
- system "rm ~/.relaton-bib.json"
242
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
241
+ system "rm ~/.relaton-bib.pstore"
242
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
243
243
  end
244
244
 
245
245
  it "prioritises local over global cache values" do
246
- system "mv ~/.relaton-bib.json ~/.relaton-bib.json1"
247
- system "rm test.relaton.json"
246
+ system "mv ~/.relaton-bib.pstore ~/.relaton-bib.pstore1"
247
+ system "rm test.relaton.pstore"
248
248
 
249
- db = Relaton::Db.new "#{Dir.home}/.relaton-bib.json", nil
249
+ db = Relaton::Db.new "#{Dir.home}/.relaton-bib.pstore", nil
250
250
  db.save_entry("ISO 123:2001",
251
251
  {
252
- "fetched" => Date.today.to_s,
252
+ "fetched" => Date.today,
253
253
  "bib" => IsoBibItem.from_xml(ISO_123_SHORT)
254
254
  }
255
255
  )
256
256
  db.save_entry("ISO 124",
257
257
  {
258
- "fetched" => Date.today.to_s,
258
+ "fetched" => Date.today,
259
259
  "bib" => IsoBibItem.from_xml(ISO_124_SHORT)
260
260
  }
261
261
  )
262
262
 
263
- localdb = Relaton::Db.new "test.relaton.json", nil
263
+ localdb = Relaton::Db.new "test.relaton.pstore", nil
264
264
  localdb.save_entry("ISO 124",
265
265
  {
266
- "fetched" => Date.today.to_s,
266
+ "fetched" => Date.today,
267
267
  "bib" => IsoBibItem.from_xml(ISO_124_SHORT_ALT)
268
268
  }
269
269
  )
@@ -297,8 +297,8 @@ EOS
297
297
  expect(localdb.load_entry("ISO 123:2001")["bib"].to_xml).to be_equivalent_to(ISO_123_SHORT)
298
298
  expect(localdb.load_entry("ISO 124")["bib"].to_xml).to be_equivalent_to(ISO_124_SHORT_ALT)
299
299
 
300
- system "rm ~/.relaton-bib.json"
301
- system "mv ~/.relaton-bib.json1 ~/.relaton-bib.json"
300
+ system "rm ~/.relaton-bib.pstore"
301
+ system "mv ~/.relaton-bib.pstore1 ~/.relaton-bib.pstore"
302
302
  end
303
303
 
304
304
  private
@@ -345,6 +345,34 @@ RSpec.describe Asciidoctor::ISO do
345
345
  OUTPUT
346
346
  end
347
347
 
348
+ it "processes RFC reference in Normative References" do
349
+ mock_rfcbib_get_rfc8341
350
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
351
+ #{ISOBIB_BLANK_HDR}
352
+ [bibliography]
353
+ == Normative References
354
+
355
+ * [[[iso123,IETF RFC 8341]]] _Standard_
356
+ INPUT
357
+ #{BLANK_HDR}
358
+ <sections>
359
+
360
+ </sections><bibliography><references id="_" obligation="informative">
361
+ <title>Normative References</title>
362
+ <bibitem type="" id="iso123">
363
+ <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
364
+ <docidentifier>8341</docidentifier>
365
+ <date type="published">
366
+ <on>2018</on>
367
+ </date>
368
+ <status>published</status>
369
+ </bibitem>
370
+ </references>
371
+ </bibliography>
372
+ </iso-standard>
373
+ OUTPUT
374
+ end
375
+
348
376
  it "processes non-ISO reference in Normative References" do
349
377
  expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
350
378
  #{ASCIIDOC_BLANK_HDR}
@@ -597,4 +625,19 @@ OUTPUT
597
625
  end
598
626
  end
599
627
 
628
+ def mock_rfcbib_get_rfc8341
629
+ expect(RfcBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
630
+ IsoBibItem.from_xml(<<~"OUTPUT")
631
+ <bibitem id="RFC8341">
632
+ <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
633
+ <docidentifier>8341</docidentifier>
634
+ <date type="published">
635
+ <on>2018</on>
636
+ </date>
637
+ <status>published</status>
638
+ </bibitem>
639
+ OUTPUT
640
+ end
641
+ end
642
+
600
643
  end
@@ -828,4 +828,62 @@ RSpec.describe "No warning if French term matches IEV" do
828
828
  INPUT
829
829
  end
830
830
 
831
+ RSpec.describe "Warn if more than 7 levels of subclause" do
832
+ specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{exceeds the maximum clause depth of 7}).to_stderr }
833
+ = Document title
834
+ Author
835
+ :docfile: test.adoc
836
+ :nodoc:
837
+ :no-isobib:
838
+ :language: fr
839
+
840
+ == Clause
841
+
842
+ === Clause
843
+
844
+ ==== Clause
845
+
846
+ ===== Clause
847
+
848
+ ====== Clause
849
+
850
+ [level=6]
851
+ ====== Clause
852
+
853
+ [level=7]
854
+ ====== Clause
855
+
856
+ [level=8]
857
+ ====== Clause
858
+
859
+ INPUT
860
+ end
861
+
862
+ RSpec.describe "Do not warn if not more than 7 levels of subclause" do
863
+ specify { expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.not_to output(%r{exceeds the maximum clause depth of 7}).to_stderr }
864
+ = Document title
865
+ Author
866
+ :docfile: test.adoc
867
+ :nodoc:
868
+ :no-isobib:
869
+ :language: fr
870
+
871
+ == Clause
872
+
873
+ === Clause
874
+
875
+ ==== Clause
876
+
877
+ ===== Clause
878
+
879
+ ====== Clause
880
+
881
+ [level=6]
882
+ ====== Clause
883
+
884
+ [level=7]
885
+ ====== Clause
886
+
887
+ INPUT
888
+ end
831
889
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-18 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.1
75
+ version: 0.1.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.1.1
82
+ version: 0.1.3
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -268,7 +268,6 @@ files:
268
268
  - ".travis.yml"
269
269
  - CODE_OF_CONDUCT.md
270
270
  - Gemfile
271
- - Gemfile.lock
272
271
  - LICENSE
273
272
  - Makefile
274
273
  - README.adoc
@@ -1,190 +0,0 @@
1
- GIT
2
- remote: git://github.com/riboseinc/relaton.git
3
- revision: 3daaf6fa4cd85eb4e1ea8141e520b4350a944975
4
- specs:
5
- relaton (0.1.0)
6
- algoliasearch
7
- gbbib (~> 0.1.0)
8
- iev (~> 0.1.0)
9
- isobib (~> 0.2.0)
10
- rfcbib (~> 0.1.0)
11
-
12
- PATH
13
- remote: .
14
- specs:
15
- asciidoctor-iso (0.9.6)
16
- asciidoctor (~> 1.5.7)
17
- iev (~> 0.1.0)
18
- isodoc (>= 0.8)
19
- relaton (~> 0.1.0)
20
- ruby-jing
21
-
22
- GEM
23
- remote: https://rubygems.org/
24
- specs:
25
- algoliasearch (1.23.2)
26
- httpclient (~> 2.8, >= 2.8.3)
27
- json (>= 1.5.1)
28
- asciidoctor (1.5.7.1)
29
- asciimath (1.0.4)
30
- ast (2.4.0)
31
- byebug (9.1.0)
32
- cnccs (0.1.1)
33
- coderay (1.1.2)
34
- diff-lcs (1.3)
35
- docile (1.3.1)
36
- equivalent-xml (0.6.0)
37
- nokogiri (>= 1.4.3)
38
- ffi (1.9.25)
39
- formatador (0.2.5)
40
- gbbib (0.1.4)
41
- cnccs
42
- iso-bib-item
43
- guard (2.14.2)
44
- formatador (>= 0.2.4)
45
- listen (>= 2.7, < 4.0)
46
- lumberjack (>= 1.0.12, < 2.0)
47
- nenv (~> 0.1)
48
- notiffany (~> 0.0)
49
- pry (>= 0.9.12)
50
- shellany (~> 0.0)
51
- thor (>= 0.18.1)
52
- guard-compat (1.2.1)
53
- guard-rspec (4.7.3)
54
- guard (~> 2.1)
55
- guard-compat (~> 1.1)
56
- rspec (>= 2.99.0, < 4.0)
57
- html2doc (0.8.2)
58
- asciimath
59
- htmlentities (~> 4.3.4)
60
- image_size
61
- mime-types
62
- nokogiri
63
- ruby-xslt
64
- thread_safe
65
- uuidtools
66
- htmlentities (4.3.4)
67
- httpclient (2.8.3)
68
- iev (0.1.0)
69
- nokogiri
70
- image_size (2.0.0)
71
- iso-bib-item (0.2.0)
72
- isoics (~> 0.1.6)
73
- nokogiri (~> 1.8.4)
74
- ruby_deep_clone (~> 0.8.0)
75
- isobib (0.2.0)
76
- algoliasearch
77
- iso-bib-item (~> 0.2.0)
78
- isodoc (0.8.4)
79
- asciimath
80
- html2doc (~> 0.8.1)
81
- htmlentities (~> 4.3.4)
82
- liquid
83
- nokogiri
84
- roman-numerals
85
- ruby-xslt
86
- sass
87
- thread_safe
88
- uuidtools
89
- isoics (0.1.6)
90
- jaro_winkler (1.5.1)
91
- json (2.1.0)
92
- liquid (4.0.0)
93
- listen (3.1.5)
94
- rb-fsevent (~> 0.9, >= 0.9.4)
95
- rb-inotify (~> 0.9, >= 0.9.7)
96
- ruby_dep (~> 1.2)
97
- lumberjack (1.0.13)
98
- metanorma (0.2.6)
99
- method_source (0.9.0)
100
- mime-types (3.1)
101
- mime-types-data (~> 3.2015)
102
- mime-types-data (3.2016.0521)
103
- mini_portile2 (2.3.0)
104
- nenv (0.3.0)
105
- nokogiri (1.8.4)
106
- mini_portile2 (~> 2.3.0)
107
- notiffany (0.1.1)
108
- nenv (~> 0.1)
109
- shellany (~> 0.0)
110
- optout (0.0.2)
111
- parallel (1.12.1)
112
- parser (2.5.1.2)
113
- ast (~> 2.4.0)
114
- powerpack (0.1.2)
115
- pry (0.11.3)
116
- coderay (~> 1.1.0)
117
- method_source (~> 0.9.0)
118
- rainbow (3.0.0)
119
- rake (12.3.1)
120
- rb-fsevent (0.10.3)
121
- rb-inotify (0.9.10)
122
- ffi (>= 0.5.0, < 2)
123
- rfcbib (0.1.1)
124
- iso-bib-item (~> 0.2.0)
125
- roman-numerals (0.3.0)
126
- rspec (3.7.0)
127
- rspec-core (~> 3.7.0)
128
- rspec-expectations (~> 3.7.0)
129
- rspec-mocks (~> 3.7.0)
130
- rspec-core (3.7.1)
131
- rspec-support (~> 3.7.0)
132
- rspec-expectations (3.7.0)
133
- diff-lcs (>= 1.2.0, < 2.0)
134
- rspec-support (~> 3.7.0)
135
- rspec-mocks (3.7.0)
136
- diff-lcs (>= 1.2.0, < 2.0)
137
- rspec-support (~> 3.7.0)
138
- rspec-support (3.7.1)
139
- rubocop (0.58.1)
140
- jaro_winkler (~> 1.5.1)
141
- parallel (~> 1.10)
142
- parser (>= 2.5, != 2.5.1.1)
143
- powerpack (~> 0.1)
144
- rainbow (>= 2.2.2, < 4.0)
145
- ruby-progressbar (~> 1.7)
146
- unicode-display_width (~> 1.0, >= 1.0.1)
147
- ruby-jing (0.0.1)
148
- optout (>= 0.0.2)
149
- ruby-progressbar (1.9.0)
150
- ruby-xslt (0.9.10)
151
- ruby_deep_clone (0.8.0)
152
- ruby_dep (1.5.0)
153
- sass (3.5.6)
154
- sass-listen (~> 4.0.0)
155
- sass-listen (4.0.0)
156
- rb-fsevent (~> 0.9, >= 0.9.4)
157
- rb-inotify (~> 0.9, >= 0.9.7)
158
- shellany (0.0.1)
159
- simplecov (0.16.1)
160
- docile (~> 1.1)
161
- json (>= 1.8, < 3)
162
- simplecov-html (~> 0.10.0)
163
- simplecov-html (0.10.2)
164
- thor (0.20.0)
165
- thread_safe (0.3.6)
166
- timecop (0.9.1)
167
- unicode-display_width (1.4.0)
168
- uuidtools (2.1.5)
169
-
170
- PLATFORMS
171
- ruby
172
-
173
- DEPENDENCIES
174
- asciidoctor-iso!
175
- bundler (~> 1.15)
176
- byebug (~> 9.1)
177
- equivalent-xml (~> 0.6)
178
- guard (~> 2.14)
179
- guard-rspec (~> 4.7)
180
- isobib (~> 0.2.0)
181
- metanorma (~> 0.2.6)
182
- rake (~> 12.0)
183
- relaton!
184
- rspec (~> 3.6)
185
- rubocop (~> 0.50)
186
- simplecov (~> 0.15)
187
- timecop (~> 0.9)
188
-
189
- BUNDLED WITH
190
- 1.16.2