metanorma-standoc 1.2.1 → 1.2.2
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 +4 -4
- data/Gemfile.lock +12 -17
- data/lib/asciidoctor/standoc/cleanup_ref.rb +37 -40
- data/lib/asciidoctor/standoc/macros.rb +20 -7
- data/lib/asciidoctor/standoc/ref.rb +7 -2
- data/lib/asciidoctor/standoc/utils.rb +2 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +0 -1
- data/spec/asciidoctor-standoc/macros_spec.rb +34 -3
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +359 -11
- data/spec/asciidoctor-standoc/refs_spec.rb +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f0296f73b69a974d8471004f27194fd72f0005a4b9b76ea99c5fc0ad8828734
|
|
4
|
+
data.tar.gz: dfdba4afa101c91c4d83697876770fd2ea26da7a197702a1a3087157e257bf66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5891c907305ea29a718370385a72ae3cc8156f42562fabda70dce276d740cf20160da3d84dda0be783315b5b287bab3732bb03fb33dfdfe59587f03100347d27
|
|
7
|
+
data.tar.gz: 11a9e73079c234d6db80af6d500ce24e8847b4c5fc40cf2e4aadd08ee520462248ccd1e1ff5c77e4dd84fb241ada3821cecc70f4d610179655d55bc49e041caf
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
metanorma-standoc (1.2.
|
|
4
|
+
metanorma-standoc (1.2.2)
|
|
5
5
|
asciidoctor (~> 1.5.7)
|
|
6
6
|
concurrent-ruby
|
|
7
7
|
html2doc (~> 0.8.11)
|
|
8
8
|
iev (~> 0.2.1)
|
|
9
9
|
isodoc (~> 0.10.0)
|
|
10
10
|
relaton (~> 0.4.0)
|
|
11
|
-
relaton-cli (~> 0.2.0)
|
|
12
11
|
ruby-jing
|
|
13
12
|
sterile (~> 1.0.14)
|
|
14
13
|
unicode2latex (~> 0.0.1)
|
|
@@ -64,8 +63,8 @@ GEM
|
|
|
64
63
|
httpclient (2.8.3)
|
|
65
64
|
iev (0.2.2)
|
|
66
65
|
nokogiri
|
|
67
|
-
image_size (2.0.
|
|
68
|
-
isodoc (0.10.
|
|
66
|
+
image_size (2.0.2)
|
|
67
|
+
isodoc (0.10.2)
|
|
69
68
|
asciimath
|
|
70
69
|
html2doc (~> 0.8.11)
|
|
71
70
|
htmlentities (~> 4.3.4)
|
|
@@ -85,7 +84,7 @@ GEM
|
|
|
85
84
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
86
85
|
ruby_dep (~> 1.2)
|
|
87
86
|
lumberjack (1.0.13)
|
|
88
|
-
metanorma (0.3.
|
|
87
|
+
metanorma (0.3.14)
|
|
89
88
|
asciidoctor
|
|
90
89
|
htmlentities
|
|
91
90
|
method_source (0.9.2)
|
|
@@ -107,13 +106,13 @@ GEM
|
|
|
107
106
|
pry (0.12.2)
|
|
108
107
|
coderay (~> 1.1.0)
|
|
109
108
|
method_source (~> 0.9.0)
|
|
110
|
-
public_suffix (3.1.
|
|
109
|
+
public_suffix (3.1.1)
|
|
111
110
|
rainbow (3.0.0)
|
|
112
111
|
rake (12.3.2)
|
|
113
112
|
rb-fsevent (0.10.3)
|
|
114
113
|
rb-inotify (0.10.0)
|
|
115
114
|
ffi (~> 1.0)
|
|
116
|
-
relaton (0.4.
|
|
115
|
+
relaton (0.4.3)
|
|
117
116
|
algoliasearch
|
|
118
117
|
relaton-gb (~> 0.5.0)
|
|
119
118
|
relaton-iec (~> 0.3.0)
|
|
@@ -122,13 +121,9 @@ GEM
|
|
|
122
121
|
relaton-iso-bib (~> 0.2.0)
|
|
123
122
|
relaton-itu (~> 0.2.0)
|
|
124
123
|
relaton-nist (~> 0.2.0)
|
|
125
|
-
relaton-bib (0.2.
|
|
124
|
+
relaton-bib (0.2.4)
|
|
126
125
|
addressable
|
|
127
126
|
nokogiri (~> 1.8.4)
|
|
128
|
-
relaton-cli (0.2.1)
|
|
129
|
-
liquid
|
|
130
|
-
relaton (~> 0.4)
|
|
131
|
-
thor
|
|
132
127
|
relaton-gb (0.5.1)
|
|
133
128
|
cnccs (~> 0.1.1)
|
|
134
129
|
gb-agencies (~> 0.0.1)
|
|
@@ -136,9 +131,9 @@ GEM
|
|
|
136
131
|
relaton-iec (0.3.1)
|
|
137
132
|
addressable
|
|
138
133
|
relaton-iso-bib (~> 0.2.0)
|
|
139
|
-
relaton-ietf (0.5.
|
|
134
|
+
relaton-ietf (0.5.4)
|
|
140
135
|
relaton-iso-bib (~> 0.2.0)
|
|
141
|
-
relaton-iso (0.5.
|
|
136
|
+
relaton-iso (0.5.3)
|
|
142
137
|
algoliasearch
|
|
143
138
|
relaton-iec (~> 0.3.0)
|
|
144
139
|
relaton-iso-bib (~> 0.2.0)
|
|
@@ -147,7 +142,7 @@ GEM
|
|
|
147
142
|
nokogiri (~> 1.8.4)
|
|
148
143
|
relaton-bib (~> 0.2.0)
|
|
149
144
|
ruby_deep_clone (~> 0.8.0)
|
|
150
|
-
relaton-itu (0.2.
|
|
145
|
+
relaton-itu (0.2.2)
|
|
151
146
|
relaton-iso-bib (~> 0.2.0)
|
|
152
147
|
relaton-nist (0.2.2)
|
|
153
148
|
relaton-bib (~> 0.2.0)
|
|
@@ -157,7 +152,7 @@ GEM
|
|
|
157
152
|
rspec-core (~> 3.8.0)
|
|
158
153
|
rspec-expectations (~> 3.8.0)
|
|
159
154
|
rspec-mocks (~> 3.8.0)
|
|
160
|
-
rspec-core (3.8.
|
|
155
|
+
rspec-core (3.8.2)
|
|
161
156
|
rspec-support (~> 3.8.0)
|
|
162
157
|
rspec-expectations (3.8.4)
|
|
163
158
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
@@ -184,7 +179,7 @@ GEM
|
|
|
184
179
|
ffi (~> 1.9)
|
|
185
180
|
rake
|
|
186
181
|
shellany (0.0.1)
|
|
187
|
-
simplecov (0.
|
|
182
|
+
simplecov (0.17.0)
|
|
188
183
|
docile (~> 1.1)
|
|
189
184
|
json (>= 1.8, < 3)
|
|
190
185
|
simplecov-html (~> 0.10.0)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "set"
|
|
2
|
-
require "
|
|
2
|
+
require "relaton_bib"
|
|
3
3
|
|
|
4
4
|
module Asciidoctor
|
|
5
5
|
module Standoc
|
|
@@ -164,39 +164,11 @@ module Asciidoctor
|
|
|
164
164
|
def ref_dl_cleanup(xmldoc)
|
|
165
165
|
xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
|
|
166
166
|
bib = dl_bib_extract(c) or next
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
b << %Q[<title format="text/plain">#{bib['title']}</title>]
|
|
171
|
-
#b << extract_from_p("docidentifier", bib, "docidentifier")
|
|
172
|
-
|
|
173
|
-
b << %Q[<docidentifier>#{bib['docidentifier']}</docidentifier>]
|
|
174
|
-
|
|
175
|
-
Array(bib["publisher"]).each do |name|
|
|
176
|
-
b << %Q[<contributor><role type="publisher"/><organization>
|
|
177
|
-
<name>#{name}</name>
|
|
178
|
-
</organization></contributor>]
|
|
179
|
-
#{extract_from_p("publisher", bib, "name")}
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
Array(bib["author"]).each do |name|
|
|
183
|
-
b << %Q[<contributor><role type="author"/><person>
|
|
184
|
-
<name><completename>#{name}</completename></name>
|
|
185
|
-
</person></contributor>]
|
|
186
|
-
end
|
|
187
|
-
c.replace(b)
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def ref_dl_cleanup(xmldoc)
|
|
192
|
-
xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
|
|
193
|
-
bib = dl_bib_extract(c) or next
|
|
194
|
-
bibitemxml = Relaton::Bibdata.new(bib).to_xml or next
|
|
195
|
-
# TODO move this into relaton-cli
|
|
167
|
+
#bibitemxml = Relaton::Bibdata.new(bib).to_xml or next
|
|
168
|
+
bibitemxml = RelatonBib::BibliographicItem.new(
|
|
169
|
+
RelatonBib::hash_to_bib(bib)).to_xml or next
|
|
196
170
|
bibitem = Nokogiri::XML(bibitemxml)
|
|
197
|
-
bibitem
|
|
198
|
-
bibitem.root["id"] = bib["ref"]&.strip
|
|
199
|
-
bibitem.root["type"] = bib["doctype"]&.strip
|
|
171
|
+
bibitem["id"] = c["id"] if c["id"]
|
|
200
172
|
c.replace(bibitem.root)
|
|
201
173
|
end
|
|
202
174
|
end
|
|
@@ -207,18 +179,29 @@ module Asciidoctor
|
|
|
207
179
|
end
|
|
208
180
|
|
|
209
181
|
# if the content is a single paragraph, replace it with its children
|
|
182
|
+
# single links replaced with uri
|
|
210
183
|
def p_unwrap(p)
|
|
211
184
|
elems = p.elements
|
|
212
185
|
if elems.size == 1 && elems[0].name == "p"
|
|
213
|
-
elems[0].children.to_xml
|
|
186
|
+
link_unwrap(elems[0]).children.to_xml.strip
|
|
214
187
|
else
|
|
215
|
-
p.to_xml
|
|
188
|
+
p.to_xml.strip
|
|
216
189
|
end
|
|
217
190
|
end
|
|
218
191
|
|
|
192
|
+
def link_unwrap(p)
|
|
193
|
+
elems = p.elements
|
|
194
|
+
if elems.size == 1 && elems[0].name == "link"
|
|
195
|
+
p.at("./link").replace(elems[0]["target"].strip)
|
|
196
|
+
end
|
|
197
|
+
p
|
|
198
|
+
end
|
|
199
|
+
|
|
219
200
|
def dd_bib_extract(dtd)
|
|
201
|
+
return nil if dtd.children.empty?
|
|
202
|
+
dtd.at("./dl") and return dl_bib_extract(dtd)
|
|
220
203
|
elems = dtd.remove.elements
|
|
221
|
-
return p_unwrap(dtd) unless elems.size == 1 && elems[0].name
|
|
204
|
+
return p_unwrap(dtd) unless elems.size == 1 && %w(ol ul).include?(elems[0].name)
|
|
222
205
|
ret = []
|
|
223
206
|
elems[0].xpath("./li").each do |li|
|
|
224
207
|
ret << p_unwrap(li)
|
|
@@ -226,16 +209,30 @@ module Asciidoctor
|
|
|
226
209
|
ret
|
|
227
210
|
end
|
|
228
211
|
|
|
212
|
+
def add_to_hash(bib, key, val)
|
|
213
|
+
bib[key] = bib[key].is_a?(Array) ? (bib[key] << val) :
|
|
214
|
+
bib[key].nil? ? val : [bib[key], val]
|
|
215
|
+
end
|
|
216
|
+
|
|
229
217
|
# definition list, with at most one level of unordered lists
|
|
230
|
-
def dl_bib_extract(c)
|
|
218
|
+
def dl_bib_extract(c, nested = false)
|
|
231
219
|
dl = c.at("./dl") or return
|
|
232
220
|
bib = {}
|
|
233
221
|
key = ""
|
|
234
222
|
dl.xpath("./dt | ./dd").each do |dtd|
|
|
235
|
-
key = dtd.text
|
|
236
|
-
|
|
223
|
+
dtd.name == "dt" and key = dtd.text.sub(/:+$/, "") or
|
|
224
|
+
add_to_hash(bib, key, dd_bib_extract(dtd))
|
|
225
|
+
end
|
|
226
|
+
c.xpath("./clause").each do |c1|
|
|
227
|
+
key = c1&.at("./title")&.text&.downcase&.strip
|
|
228
|
+
next unless %w(contributors relations series).include? key
|
|
229
|
+
add_to_hash(bib, key, dl_bib_extract(c1, true))
|
|
230
|
+
end
|
|
231
|
+
if !nested and c.at("./title")
|
|
232
|
+
title = c.at("./title").remove.children.to_xml
|
|
233
|
+
bib["titles"] = bib["titles"] ? Array(bib["titles"]) : []
|
|
234
|
+
bib["titles"] << title if !title.empty?
|
|
237
235
|
end
|
|
238
|
-
bib["title"] = c.at("./title").remove.children
|
|
239
236
|
bib
|
|
240
237
|
end
|
|
241
238
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "asciidoctor/extensions"
|
|
2
2
|
require "fileutils"
|
|
3
|
+
require "uuidtools"
|
|
3
4
|
|
|
4
5
|
module Asciidoctor
|
|
5
6
|
module Standoc
|
|
@@ -81,17 +82,29 @@ module Asciidoctor
|
|
|
81
82
|
nil
|
|
82
83
|
end
|
|
83
84
|
|
|
85
|
+
# if no :imagesdir: leave image file in plantuml
|
|
84
86
|
def self.generate_file parent, reader
|
|
85
87
|
localdir = Utils::localdir(parent.document)
|
|
88
|
+
fn = save_plantuml parent, reader, localdir
|
|
89
|
+
system "plantuml #{localdir}plantuml/#{fn}.pml"
|
|
90
|
+
outfile = parent.image_uri("#{fn}.png")
|
|
91
|
+
if outfile == "#{fn}.png"
|
|
92
|
+
"plantuml/#{fn}.png"
|
|
93
|
+
else
|
|
94
|
+
FileUtils.mv "#{localdir}plantuml/#{fn}.png", "#{localdir}#{outfile}"
|
|
95
|
+
"#{fn}.png"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.save_plantuml parent, reader, localdir
|
|
86
100
|
src = reader.source
|
|
87
|
-
|
|
101
|
+
reader.lines.first.sub(/\s+$/, "").match /^@startuml($| )/ or
|
|
88
102
|
src = "@startuml\n#{src}\n@enduml\n"
|
|
89
|
-
/^@startuml (?<
|
|
90
|
-
|
|
103
|
+
/^@startuml (?<fn>[^\n]+)\n/ =~ src
|
|
104
|
+
fn ||= UUIDTools::UUID.random_create
|
|
91
105
|
FileUtils.mkdir_p "#{localdir}/plantuml"
|
|
92
|
-
File.open("#{localdir}plantuml/#{
|
|
93
|
-
|
|
94
|
-
filename
|
|
106
|
+
File.open("#{localdir}plantuml/#{fn}.pml", "w") { |f| f.write src }
|
|
107
|
+
fn
|
|
95
108
|
end
|
|
96
109
|
|
|
97
110
|
def self.generate_attrs attrs
|
|
@@ -113,7 +126,7 @@ module Asciidoctor
|
|
|
113
126
|
if PlantUMLBlockMacroBackend.plantuml_installed?
|
|
114
127
|
filename = PlantUMLBlockMacroBackend.generate_file parent, reader
|
|
115
128
|
through_attrs = PlantUMLBlockMacroBackend.generate_attrs attrs
|
|
116
|
-
through_attrs["target"] =
|
|
129
|
+
through_attrs["target"] = filename
|
|
117
130
|
create_image_block parent, through_attrs
|
|
118
131
|
else
|
|
119
132
|
warn "PlantUML not installed"
|
|
@@ -94,7 +94,8 @@ module Asciidoctor
|
|
|
94
94
|
docid(t, id_and_year(m[:code], m[:year]) + " (all parts)")
|
|
95
95
|
conditional_date(t, m, noyr)
|
|
96
96
|
iso_publisher(t, m[:code])
|
|
97
|
-
|
|
97
|
+
m.names.include?("fn") && m[:fn] and
|
|
98
|
+
t.note(**plaintxt) { |p| p << "ISO DATE: #{m[:fn]}" }
|
|
98
99
|
#t.allparts "true"
|
|
99
100
|
t.extent **{ type: 'part' } do |e|
|
|
100
101
|
e.referenceFrom "all"
|
|
@@ -109,7 +110,11 @@ module Asciidoctor
|
|
|
109
110
|
xml.parent.add_child(Utils::smart_render_xml(hit))
|
|
110
111
|
xml
|
|
111
112
|
rescue Algolia::AlgoliaProtocolError
|
|
112
|
-
|
|
113
|
+
warn "Could not retrieve #{code}: no access to online site"
|
|
114
|
+
nil
|
|
115
|
+
rescue RelatonBib::RequestError
|
|
116
|
+
warn "Could not retrieve #{code}: no access to online site"
|
|
117
|
+
nil
|
|
113
118
|
end
|
|
114
119
|
|
|
115
120
|
def refitem_render(xml, m)
|
|
@@ -18,8 +18,8 @@ module Asciidoctor
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def localdir(node)
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
docfile = node.attr("docfile")
|
|
22
|
+
docfile.nil? ? './' : Pathname.new(docfile).parent.to_s + '/'
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def current_location(n)
|
data/metanorma-standoc.gemspec
CHANGED
|
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.add_dependency "concurrent-ruby"
|
|
36
36
|
spec.add_dependency "html2doc", "~> 0.8.11"
|
|
37
37
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
|
38
|
-
spec.add_dependency "relaton-cli", "~> 0.2.0"
|
|
39
38
|
|
|
40
39
|
spec.add_development_dependency "bundler", "~> 2.0.1"
|
|
41
40
|
spec.add_development_dependency "byebug"
|
|
@@ -46,7 +46,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
it "processes the PlantUML macro" do
|
|
49
|
-
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
49
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/[^.]{36}\.}, "plantuml/_.")).to be_equivalent_to <<~"OUTPUT"
|
|
50
50
|
#{ASCIIDOC_BLANK_HDR}
|
|
51
51
|
|
|
52
52
|
[plantuml]
|
|
@@ -82,10 +82,10 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
82
82
|
INPUT
|
|
83
83
|
#{BLANK_HDR}
|
|
84
84
|
<sections><figure id="_">
|
|
85
|
-
<image src="plantuml/
|
|
85
|
+
<image src="plantuml/_.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
|
86
86
|
</figure>
|
|
87
87
|
<figure id="_">
|
|
88
|
-
<image src="plantuml/
|
|
88
|
+
<image src="plantuml/_.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
|
89
89
|
</figure>
|
|
90
90
|
<figure id="_">
|
|
91
91
|
<image src="plantuml/filename.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
|
@@ -96,6 +96,37 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
96
96
|
OUTPUT
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
it "processes the PlantUML macro with imagesdir" do
|
|
100
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{spec/assets/[^.]+\.}, "spec/assets/_.")).to be_equivalent_to <<~"OUTPUT"
|
|
101
|
+
= Document title
|
|
102
|
+
Author
|
|
103
|
+
:docfile: test.adoc
|
|
104
|
+
:nodoc:
|
|
105
|
+
:novalid:
|
|
106
|
+
:no-isobib:
|
|
107
|
+
:imagesdir: spec/assets
|
|
108
|
+
|
|
109
|
+
[plantuml]
|
|
110
|
+
....
|
|
111
|
+
@startuml
|
|
112
|
+
Alice -> Bob: Authentication Request
|
|
113
|
+
Bob --> Alice: Authentication Response
|
|
114
|
+
|
|
115
|
+
Alice -> Bob: Another authentication Request
|
|
116
|
+
Alice <-- Bob: another authentication Response
|
|
117
|
+
@enduml
|
|
118
|
+
....
|
|
119
|
+
INPUT
|
|
120
|
+
#{BLANK_HDR}
|
|
121
|
+
<sections>
|
|
122
|
+
<figure id="_">
|
|
123
|
+
<image src="spec/assets/_.png" id="_" imagetype="PNG" height="auto" width="auto"/>
|
|
124
|
+
</figure>
|
|
125
|
+
</sections>
|
|
126
|
+
</standard-document>
|
|
127
|
+
OUTPUT
|
|
128
|
+
end
|
|
129
|
+
|
|
99
130
|
it "processes the PlantUML macro with PlantUML disabled" do
|
|
100
131
|
mock_plantuml_disabled
|
|
101
132
|
expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr
|
|
@@ -10,14 +10,30 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
10
10
|
|
|
11
11
|
[%bibitem]
|
|
12
12
|
=== Standard
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
id:: iso123
|
|
14
|
+
docid::
|
|
15
|
+
type::: ISO
|
|
16
|
+
id::: ISO 123
|
|
17
|
+
type:: standard
|
|
18
|
+
contributors::
|
|
19
|
+
roles::: publisher
|
|
20
|
+
organization:::
|
|
21
|
+
name:::: ISO
|
|
22
|
+
contributors::
|
|
23
|
+
roles::: author
|
|
24
|
+
person:::
|
|
25
|
+
name::::
|
|
26
|
+
+
|
|
27
|
+
--
|
|
28
|
+
completename::
|
|
29
|
+
language::: en
|
|
30
|
+
content::: Fred
|
|
31
|
+
--
|
|
32
|
+
contributors::
|
|
33
|
+
roles::: author
|
|
34
|
+
person:::
|
|
35
|
+
name::::
|
|
36
|
+
completename::::: Jack
|
|
21
37
|
|
|
22
38
|
INPUT
|
|
23
39
|
#{BLANK_HDR}
|
|
@@ -26,8 +42,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
26
42
|
<title>Normative References</title>
|
|
27
43
|
<bibitem id="iso123" type="standard">
|
|
28
44
|
<fetched>#{Date.today}</fetched>
|
|
29
|
-
<title>Standard</title>
|
|
30
|
-
<docidentifier>ISO 123</docidentifier>
|
|
45
|
+
<title type="main" format="text/plain" language="en" script="Latn">Standard</title>
|
|
46
|
+
<docidentifier type="ISO">ISO 123</docidentifier>
|
|
31
47
|
<contributor>
|
|
32
48
|
<role type="publisher"/>
|
|
33
49
|
<organization>
|
|
@@ -37,7 +53,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
37
53
|
<contributor>
|
|
38
54
|
<role type="author"/>
|
|
39
55
|
<person>
|
|
40
|
-
<name><completename>Fred</completename></name>
|
|
56
|
+
<name><completename language="en">Fred</completename></name>
|
|
41
57
|
</person>
|
|
42
58
|
</contributor>
|
|
43
59
|
<contributor>
|
|
@@ -53,4 +69,336 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
53
69
|
OUTPUT
|
|
54
70
|
end
|
|
55
71
|
|
|
72
|
+
it "processes complex dl reference" do
|
|
73
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
|
74
|
+
#{ASCIIDOC_BLANK_HDR}
|
|
75
|
+
[bibliography]
|
|
76
|
+
== Normative References
|
|
77
|
+
|
|
78
|
+
[[ISO/TC211]]
|
|
79
|
+
[%bibitem]
|
|
80
|
+
=== {blank}
|
|
81
|
+
fetched:: 2019-06-30
|
|
82
|
+
titles::
|
|
83
|
+
type::: main
|
|
84
|
+
content::: Geographic information
|
|
85
|
+
titles::
|
|
86
|
+
type::: subtitle
|
|
87
|
+
content::: Geographic information subtitle
|
|
88
|
+
language::: en
|
|
89
|
+
script::: Latn
|
|
90
|
+
format::: text/plain
|
|
91
|
+
type:: standard
|
|
92
|
+
docid::
|
|
93
|
+
type::: ISO
|
|
94
|
+
id::: TC211
|
|
95
|
+
docnumber:: 211
|
|
96
|
+
edition:: 1
|
|
97
|
+
language::
|
|
98
|
+
. en
|
|
99
|
+
. fr
|
|
100
|
+
script:: Latn
|
|
101
|
+
version::
|
|
102
|
+
revision_date::: 2019-04-01
|
|
103
|
+
draft::: draft
|
|
104
|
+
biblionote::
|
|
105
|
+
type::: bibnote
|
|
106
|
+
content:::
|
|
107
|
+
+
|
|
108
|
+
--
|
|
109
|
+
Mark set a major league
|
|
110
|
+
home run record in 1998.
|
|
111
|
+
--
|
|
112
|
+
docstatus::
|
|
113
|
+
stage::: stage
|
|
114
|
+
substage::: substage
|
|
115
|
+
iteration::: iteration
|
|
116
|
+
dates::
|
|
117
|
+
type::: issued
|
|
118
|
+
value::: 2014
|
|
119
|
+
dates::
|
|
120
|
+
type::: published
|
|
121
|
+
from::: 2014-04
|
|
122
|
+
to::: 2014-05
|
|
123
|
+
dates::
|
|
124
|
+
type::: accessed
|
|
125
|
+
value::: 2015-05-20
|
|
126
|
+
abstract::
|
|
127
|
+
content:::
|
|
128
|
+
+
|
|
129
|
+
--
|
|
130
|
+
ISO 19115-1:2014 defines the schema required for ...
|
|
131
|
+
--
|
|
132
|
+
abstract::
|
|
133
|
+
content::: L'ISO 19115-1:2014 définit le schéma requis pour ...
|
|
134
|
+
language::: fr
|
|
135
|
+
script::: Latn
|
|
136
|
+
format::: text/plain
|
|
137
|
+
copyright::
|
|
138
|
+
owner:::
|
|
139
|
+
name:::: International Organization for Standardization
|
|
140
|
+
abbreviation:::: ISO
|
|
141
|
+
url:::: www.iso.org
|
|
142
|
+
from::: 2014
|
|
143
|
+
to::: 2020
|
|
144
|
+
link::
|
|
145
|
+
type::: src
|
|
146
|
+
content::: https://www.iso.org/standard/53798.html
|
|
147
|
+
link::
|
|
148
|
+
type::: obp
|
|
149
|
+
content::: https://www.iso.org/obp/ui/#!iso:std:53798:en
|
|
150
|
+
link::
|
|
151
|
+
type::: rss
|
|
152
|
+
content::: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss
|
|
153
|
+
medium::
|
|
154
|
+
form::: medium form
|
|
155
|
+
size::: medium size
|
|
156
|
+
scale::: medium scale
|
|
157
|
+
place:: bib place
|
|
158
|
+
extent::
|
|
159
|
+
type::: section
|
|
160
|
+
reference_from::: 7
|
|
161
|
+
accesslocation::
|
|
162
|
+
. accesslocation1
|
|
163
|
+
. accesslocation2
|
|
164
|
+
classification::
|
|
165
|
+
type::: type
|
|
166
|
+
value::: value
|
|
167
|
+
validity::
|
|
168
|
+
begins::: 2010-10-10 12:21
|
|
169
|
+
ends::: 2011-02-03 18:30
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
==== Contributor
|
|
173
|
+
organization::
|
|
174
|
+
name::: International Organization for Standardization
|
|
175
|
+
url::: www.iso.org
|
|
176
|
+
abbreviation::: ISO
|
|
177
|
+
subdivision::: division
|
|
178
|
+
role::
|
|
179
|
+
* publisher
|
|
180
|
+
*
|
|
181
|
+
** Publisher role
|
|
182
|
+
|
|
183
|
+
==== Contributor
|
|
184
|
+
person::
|
|
185
|
+
name:::
|
|
186
|
+
completename::::
|
|
187
|
+
content::::: A. Bierman
|
|
188
|
+
language::::: en
|
|
189
|
+
affiliation:::
|
|
190
|
+
organization::::
|
|
191
|
+
name::::: IETF
|
|
192
|
+
abbreviation::::: IETF
|
|
193
|
+
identifiers:::::
|
|
194
|
+
+
|
|
195
|
+
---
|
|
196
|
+
type:: uri
|
|
197
|
+
id:: www.ietf.org
|
|
198
|
+
---
|
|
199
|
+
description:::: Affiliation description
|
|
200
|
+
contacts:::
|
|
201
|
+
street::::
|
|
202
|
+
* 8 Street St
|
|
203
|
+
city:::: City
|
|
204
|
+
postcode:::: 123456
|
|
205
|
+
country:::: Country
|
|
206
|
+
state:::: State
|
|
207
|
+
contacts:::
|
|
208
|
+
type:::: phone
|
|
209
|
+
value:::: 223322
|
|
210
|
+
role:: author
|
|
211
|
+
|
|
212
|
+
==== Contributors
|
|
213
|
+
organization::
|
|
214
|
+
name::: IETF
|
|
215
|
+
abbreviation::: IETF
|
|
216
|
+
identifiers:::
|
|
217
|
+
type:::: uri
|
|
218
|
+
id:::: www.ietf.org
|
|
219
|
+
role:: publisher
|
|
220
|
+
|
|
221
|
+
==== Contributors
|
|
222
|
+
person::
|
|
223
|
+
name:::
|
|
224
|
+
language:::: en
|
|
225
|
+
initials:::: A.
|
|
226
|
+
surname:::: Bierman
|
|
227
|
+
affiliation:::
|
|
228
|
+
+
|
|
229
|
+
--
|
|
230
|
+
organization::
|
|
231
|
+
name::: IETF
|
|
232
|
+
abbreviation::: IETF
|
|
233
|
+
description::
|
|
234
|
+
content::: Affiliation description
|
|
235
|
+
language::: en
|
|
236
|
+
script::: Latn
|
|
237
|
+
--
|
|
238
|
+
identifiers:::
|
|
239
|
+
type:::: uri
|
|
240
|
+
id:::: www.person.com
|
|
241
|
+
roles:: author
|
|
242
|
+
|
|
243
|
+
==== Relations
|
|
244
|
+
type:: updates
|
|
245
|
+
bibitem::
|
|
246
|
+
formattedref::: ISO 19115:2003
|
|
247
|
+
bib_locality:::
|
|
248
|
+
type:::: page
|
|
249
|
+
reference_from:::: 7
|
|
250
|
+
reference_to:::: 10
|
|
251
|
+
|
|
252
|
+
==== Relations
|
|
253
|
+
type:: updates
|
|
254
|
+
bibitem::
|
|
255
|
+
type::: standard
|
|
256
|
+
formattedref::: ISO 19115:2003/Cor 1:2006
|
|
257
|
+
|
|
258
|
+
==== Series
|
|
259
|
+
type:: main
|
|
260
|
+
title::
|
|
261
|
+
type::: original
|
|
262
|
+
content::: ISO/IEC FDIS 10118-3
|
|
263
|
+
language::: en
|
|
264
|
+
script::: Latn
|
|
265
|
+
format::: text/plain
|
|
266
|
+
place:: Serie's place
|
|
267
|
+
organization:: Serie's organization
|
|
268
|
+
abbreviation::
|
|
269
|
+
content::: ABVR
|
|
270
|
+
language::: en
|
|
271
|
+
script::: Latn
|
|
272
|
+
from:: 2009-02-01
|
|
273
|
+
to:: 2010-12-20
|
|
274
|
+
number:: serie1234
|
|
275
|
+
partnumber:: part5678
|
|
276
|
+
|
|
277
|
+
==== Series
|
|
278
|
+
type:: alt
|
|
279
|
+
formattedref::
|
|
280
|
+
content::: serieref
|
|
281
|
+
language::: en
|
|
282
|
+
script::: Latn
|
|
283
|
+
|
|
284
|
+
INPUT
|
|
285
|
+
#{BLANK_HDR}
|
|
286
|
+
<sections>
|
|
287
|
+
</sections><bibliography><references id="_" obligation="informative">
|
|
288
|
+
<title>Normative References</title>
|
|
289
|
+
<bibitem id="TC211" type="standard">
|
|
290
|
+
<fetched>2019-06-30</fetched>
|
|
291
|
+
<title type="main" format="text/plain">Geographic information</title>
|
|
292
|
+
<title type="subtitle" format="text/plain" language="en" script="Latn">Geographic information subtitle</title>
|
|
293
|
+
<uri type="src">https://www.iso.org/standard/53798.html</uri>
|
|
294
|
+
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
|
|
295
|
+
<uri type="rss">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
|
|
296
|
+
<docidentifier type="ISO">TC211</docidentifier>
|
|
297
|
+
<docnumber>211</docnumber>
|
|
298
|
+
<date type="issued">
|
|
299
|
+
<on>2014</on>
|
|
300
|
+
</date>
|
|
301
|
+
<date type="published">
|
|
302
|
+
<from>2014</from>
|
|
303
|
+
<to>2014</to>
|
|
304
|
+
</date>
|
|
305
|
+
<date type="accessed">
|
|
306
|
+
<on>2015</on>
|
|
307
|
+
</date>
|
|
308
|
+
<contributor>
|
|
309
|
+
<organization>
|
|
310
|
+
<name>IETF</name>
|
|
311
|
+
<abbreviation>IETF</abbreviation>
|
|
312
|
+
<identifier type="uri">www.ietf.org</identifier>
|
|
313
|
+
</organization>
|
|
314
|
+
</contributor>
|
|
315
|
+
<contributor>
|
|
316
|
+
<role type="author"/>
|
|
317
|
+
<person>
|
|
318
|
+
<name>
|
|
319
|
+
<initial language="en">A.</initial>
|
|
320
|
+
<surname language="en">Bierman</surname>
|
|
321
|
+
</name>
|
|
322
|
+
<affiliation>
|
|
323
|
+
<description language="en" script="en">Affiliation description</description>
|
|
324
|
+
<organization>
|
|
325
|
+
<name>IETF</name>
|
|
326
|
+
<abbreviation>IETF</abbreviation>
|
|
327
|
+
</organization>
|
|
328
|
+
</affiliation>
|
|
329
|
+
<identifier type="uri">www.person.com</identifier>
|
|
330
|
+
</person>
|
|
331
|
+
</contributor>
|
|
332
|
+
<edition>1</edition>
|
|
333
|
+
<version>
|
|
334
|
+
<revision-date>2019-04-01</revision-date>
|
|
335
|
+
<draft>draft</draft>
|
|
336
|
+
</version>
|
|
337
|
+
<note type="bibnote">Mark set a major league
|
|
338
|
+
home run record in 1998.</note>
|
|
339
|
+
<language>en</language>
|
|
340
|
+
<language>fr</language>
|
|
341
|
+
<script>Latn</script>
|
|
342
|
+
<abstract format="text/plain">ISO 19115-1:2014 defines the schema required for …</abstract>
|
|
343
|
+
<abstract format="text/plain" language="fr" script="Latn">L’ISO 19115-1:2014 définit le schéma requis pour …</abstract>
|
|
344
|
+
<status>
|
|
345
|
+
<stage>stage</stage>
|
|
346
|
+
<substage>substage</substage>
|
|
347
|
+
<iteration>iteration</iteration>
|
|
348
|
+
</status>
|
|
349
|
+
<copyright>
|
|
350
|
+
<from>2014</from>
|
|
351
|
+
<to>2020</to>
|
|
352
|
+
<owner>
|
|
353
|
+
<organization>
|
|
354
|
+
<name>International Organization for Standardization</name>
|
|
355
|
+
<abbreviation>ISO</abbreviation>
|
|
356
|
+
<uri>www.iso.org</uri>
|
|
357
|
+
</organization>
|
|
358
|
+
</owner>
|
|
359
|
+
</copyright>
|
|
360
|
+
<relation type="updates">
|
|
361
|
+
<bibitem>
|
|
362
|
+
<formattedref format="text/plain">ISO 19115:2003</formattedref>
|
|
363
|
+
</bibitem>
|
|
364
|
+
</relation>
|
|
365
|
+
<relation type="updates">
|
|
366
|
+
<bibitem type="standard">
|
|
367
|
+
<formattedref format="text/plain">ISO 19115:2003/Cor 1:2006</formattedref>
|
|
368
|
+
</bibitem>
|
|
369
|
+
</relation>
|
|
370
|
+
<series type="main">
|
|
371
|
+
<title type="original" format="text/plain" language="en" script="Latn">ISO/IEC FDIS 10118-3</title>
|
|
372
|
+
<place>Serie’s place</place>
|
|
373
|
+
<organization>Serie’s organization</organization>
|
|
374
|
+
<abbreviation language="en" script="Latn">ABVR</abbreviation>
|
|
375
|
+
<from>2009-02-01</from>
|
|
376
|
+
<to>2010-12-20</to>
|
|
377
|
+
<number>serie1234</number>
|
|
378
|
+
<partnumber>part5678</partnumber>
|
|
379
|
+
</series>
|
|
380
|
+
<series type="alt">
|
|
381
|
+
<formattedref format="text/plain" language="en" script="Latn">serieref</formattedref>
|
|
382
|
+
</series>
|
|
383
|
+
<medium>
|
|
384
|
+
<form>medium form</form>
|
|
385
|
+
<size>medium size</size>
|
|
386
|
+
<scale>medium scale</scale>
|
|
387
|
+
</medium>
|
|
388
|
+
<place>bib place</place>
|
|
389
|
+
<locality type="section">
|
|
390
|
+
<referenceFrom>7</referenceFrom>
|
|
391
|
+
</locality>
|
|
392
|
+
<accesslocation>accesslocation1</accesslocation>
|
|
393
|
+
<accesslocation>accesslocation2</accesslocation>
|
|
394
|
+
<classification type="type">value</classification>
|
|
395
|
+
<validity>
|
|
396
|
+
<validityBegins>2010-10-10 12:21</validityBegins>
|
|
397
|
+
<validityEnds>2011-02-03 18:30</validityEnds>
|
|
398
|
+
</validity>
|
|
399
|
+
</bibitem></references></bibliography>
|
|
400
|
+
</standard-document>
|
|
401
|
+
OUTPUT
|
|
402
|
+
end
|
|
403
|
+
|
|
56
404
|
end
|
|
@@ -422,7 +422,6 @@ RSpec.describe Asciidoctor::Standoc do
|
|
|
422
422
|
<title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
|
|
423
423
|
<uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
|
|
424
424
|
<docidentifier type="IETF">RFC 8341</docidentifier>
|
|
425
|
-
<docidentifier type="DOI">10.17487/RFC8341</docidentifier>
|
|
426
425
|
<date type="published">
|
|
427
426
|
<on>2018-03</on>
|
|
428
427
|
</date>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-standoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -136,20 +136,6 @@ dependencies:
|
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: 0.0.1
|
|
139
|
-
- !ruby/object:Gem::Dependency
|
|
140
|
-
name: relaton-cli
|
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
|
142
|
-
requirements:
|
|
143
|
-
- - "~>"
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: 0.2.0
|
|
146
|
-
type: :runtime
|
|
147
|
-
prerelease: false
|
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
-
requirements:
|
|
150
|
-
- - "~>"
|
|
151
|
-
- !ruby/object:Gem::Version
|
|
152
|
-
version: 0.2.0
|
|
153
139
|
- !ruby/object:Gem::Dependency
|
|
154
140
|
name: bundler
|
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|