metanorma-standoc 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -3
- data/lib/asciidoctor/standoc/front.rb +0 -12
- data/lib/asciidoctor/standoc/front_contributor.rb +28 -3
- data/lib/asciidoctor/standoc/section.rb +4 -2
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor-standoc/base_spec.rb +16 -3
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +2 -2
- data/spec/asciidoctor-standoc/validate_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b4ec9dd5050345506b6b416eaad6b57865cb3c0b9e57e00e3b52f625fe87a48
|
4
|
+
data.tar.gz: 4e53f6a44684a9694104f74c7560040893a47c70c5c8292810e9349a32c1e151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d437d0619e0da4931009f2f92db0778bdd0eccb9bd15f81a7e38edc66a89474cecaa4099bd55bf8178a13a9551d533378068730231e2ed13d2ead794da7cb3a
|
7
|
+
data.tar.gz: c5a606e3c94a341a6ce19bf5e77df8bf49eeae5d68cf6143d7050190a29f7213a34d74ab7743b87f54d7766fd17606cfb05f05b51a63f7a85ae113b9a23e98fd
|
@@ -43,7 +43,7 @@ jobs:
|
|
43
43
|
polling_interval_seconds: 5
|
44
44
|
timeout_minutes: 5
|
45
45
|
max_attempts: 3
|
46
|
-
command: sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
46
|
+
command: sudo apt-get update -y && sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
47
47
|
- name: Run specs
|
48
48
|
run: |
|
49
49
|
bundle exec rake
|
@@ -133,14 +133,16 @@ module Asciidoctor
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def validate_ref_dl(bib, c)
|
136
|
-
|
136
|
+
id = bib["id"]
|
137
|
+
id ||= c["id"] unless /^_/.match(c["id"]) # do not accept implicit id
|
138
|
+
unless id
|
137
139
|
@log.add("Anchors", c, "The following reference is missing "\
|
138
140
|
"an anchor:\n" + c.to_xml)
|
139
141
|
return
|
140
142
|
end
|
141
|
-
bib["title"] or @log.add("Bibliography", c, "Reference #{
|
143
|
+
bib["title"] or @log.add("Bibliography", c, "Reference #{id} "\
|
142
144
|
"is missing a title")
|
143
|
-
bib["docid"] or @log.add("Bibliography", c, "Reference #{
|
145
|
+
bib["docid"] or @log.add("Bibliography", c, "Reference #{id} "\
|
144
146
|
"is missing a document identifier (docid)")
|
145
147
|
end
|
146
148
|
|
@@ -25,18 +25,6 @@ module Asciidoctor
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def metadata_copyright(node, xml)
|
29
|
-
publishers = node.attr("publisher") || " "
|
30
|
-
publishers.split(/,[ ]?/).each do |p|
|
31
|
-
xml.copyright do |c|
|
32
|
-
c.from (node.attr("copyright-year") || Date.today.year)
|
33
|
-
p.match(/[A-Za-z]/).nil? or c.owner do |owner|
|
34
|
-
owner.organization { |o| organization(o, p) }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
28
|
def metadata_status(node, xml)
|
41
29
|
xml.status do |s|
|
42
30
|
s.stage ( node.attr("status") || node.attr("docstage") || "published" )
|
@@ -3,6 +3,7 @@ require "nokogiri"
|
|
3
3
|
require "htmlentities"
|
4
4
|
require "pathname"
|
5
5
|
require "open-uri"
|
6
|
+
require "csv"
|
6
7
|
|
7
8
|
module Asciidoctor
|
8
9
|
module Standoc
|
@@ -24,8 +25,15 @@ module Asciidoctor
|
|
24
25
|
org.name orgname
|
25
26
|
end
|
26
27
|
|
28
|
+
# , " => ," : CSV definition does not deal with space followed by quote
|
29
|
+
# at start of field
|
30
|
+
def csv_split(s, delim = ",")
|
31
|
+
CSV.parse_line(s&.gsub(/, "(?!")/, ',"'), liberal_parsing: true,
|
32
|
+
col_sep: delim)&.map { |x| x.strip }
|
33
|
+
end
|
34
|
+
|
27
35
|
def metadata_author(node, xml)
|
28
|
-
(node.attr("publisher") || "")
|
36
|
+
csv_split(node.attr("publisher") || default_publisher || "")&.each do |p|
|
29
37
|
xml.contributor do |c|
|
30
38
|
c.role **{ type: "author" }
|
31
39
|
c.organization { |a| organization(a, p) }
|
@@ -85,15 +93,32 @@ module Asciidoctor
|
|
85
93
|
end
|
86
94
|
end
|
87
95
|
|
96
|
+
def default_publisher
|
97
|
+
nil
|
98
|
+
end
|
99
|
+
|
88
100
|
def metadata_publisher(node, xml)
|
89
|
-
publishers = node.attr("publisher") || return
|
90
|
-
publishers
|
101
|
+
publishers = node.attr("publisher") || default_publisher || return
|
102
|
+
csv_split(publishers)&.each do |p|
|
91
103
|
xml.contributor do |c|
|
92
104
|
c.role **{ type: "publisher" }
|
93
105
|
c.organization { |a| organization(a, p) }
|
94
106
|
end
|
95
107
|
end
|
96
108
|
end
|
109
|
+
|
110
|
+
def metadata_copyright(node, xml)
|
111
|
+
publishers = node.attr("copyright-holder") || node.attr("publisher") ||
|
112
|
+
default_publisher || "-"
|
113
|
+
csv_split(publishers)&.each do |p|
|
114
|
+
xml.copyright do |c|
|
115
|
+
c.from (node.attr("copyright-year") || Date.today.year)
|
116
|
+
p.match(/[A-Za-z]/).nil? or c.owner do |owner|
|
117
|
+
owner.organization { |o| organization(o, p) }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
97
122
|
end
|
98
123
|
end
|
99
124
|
end
|
@@ -150,9 +150,10 @@ module Asciidoctor
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def nonterm_symbols_parse(attrs, xml, node)
|
153
|
+
defs = @definitions
|
153
154
|
@definitions = false
|
154
155
|
clause_parse(attrs, xml, node)
|
155
|
-
@definitions =
|
156
|
+
@definitions = defs
|
156
157
|
end
|
157
158
|
|
158
159
|
def symbols_attrs(node, a)
|
@@ -179,9 +180,10 @@ module Asciidoctor
|
|
179
180
|
end
|
180
181
|
|
181
182
|
def nonterm_term_def_subclause_parse(attrs, xml, node)
|
183
|
+
defs = @term_def
|
182
184
|
@term_def = false
|
183
185
|
clause_parse(attrs, xml, node)
|
184
|
-
@term_def =
|
186
|
+
@term_def = defs
|
185
187
|
end
|
186
188
|
|
187
189
|
# subclause contains subclauses
|
@@ -102,7 +102,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
102
102
|
:email_2: barney@rockhead.example.com
|
103
103
|
:phone_2: 789
|
104
104
|
:fax_2: 012
|
105
|
-
:publisher: Hanna Barbera, Cartoon Network
|
105
|
+
:publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc."
|
106
|
+
:copyright-holder: "Ribose, Inc.", Hanna Barbera
|
106
107
|
:part-of: ABC
|
107
108
|
:translated-from: DEF,GHI;JKL MNO,PQR
|
108
109
|
:keywords: a, b, c
|
@@ -155,6 +156,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
155
156
|
<date type="Jack">
|
156
157
|
<on>1010-01-01</on>
|
157
158
|
</date>
|
159
|
+
<contributor>
|
160
|
+
<role type="author"/>
|
161
|
+
<organization>
|
162
|
+
<name>Ribose, Inc.</name>
|
163
|
+
</organization>
|
164
|
+
</contributor>
|
158
165
|
<contributor>
|
159
166
|
<role type="author"/>
|
160
167
|
<organization>
|
@@ -221,6 +228,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
221
228
|
<name>Cartoon Network</name>
|
222
229
|
</organization>
|
223
230
|
</contributor>
|
231
|
+
<contributor>
|
232
|
+
<role type="publisher"/>
|
233
|
+
<organization>
|
234
|
+
<name>Ribose, Inc.</name>
|
235
|
+
</organization>
|
236
|
+
</contributor>
|
224
237
|
<edition>2</edition>
|
225
238
|
<version>
|
226
239
|
<revision-date>2000-01-01</revision-date>
|
@@ -237,7 +250,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
237
250
|
<from>2001</from>
|
238
251
|
<owner>
|
239
252
|
<organization>
|
240
|
-
<name>
|
253
|
+
<name>Ribose, Inc.</name>
|
241
254
|
</organization>
|
242
255
|
</owner>
|
243
256
|
</copyright>
|
@@ -245,7 +258,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
245
258
|
<from>2001</from>
|
246
259
|
<owner>
|
247
260
|
<organization>
|
248
|
-
<name>
|
261
|
+
<name>Hanna Barbera</name>
|
249
262
|
</organization>
|
250
263
|
</owner>
|
251
264
|
</copyright>
|
@@ -77,7 +77,7 @@ it "processes complex dl reference" do
|
|
77
77
|
[bibliography]
|
78
78
|
== Normative References
|
79
79
|
|
80
|
-
[[
|
80
|
+
[[ISOTC211]]
|
81
81
|
[%bibitem]
|
82
82
|
=== {blank}
|
83
83
|
fetched:: 2019-06-30
|
@@ -446,7 +446,7 @@ OUTPUT
|
|
446
446
|
[bibliography]
|
447
447
|
== Normative References
|
448
448
|
|
449
|
-
[[
|
449
|
+
[[ISOTC211]]
|
450
450
|
[%bibitem]
|
451
451
|
=== {blank}
|
452
452
|
fetched:: 2019-06-30
|
@@ -64,7 +64,25 @@ RSpec.describe Asciidoctor::Standoc do
|
|
64
64
|
INPUT
|
65
65
|
errf = File.read("test.err")
|
66
66
|
expect(errf).to include "The following reference is missing an anchor"
|
67
|
+
Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
|
68
|
+
#{VALIDATING_BLANK_HDR}
|
69
|
+
|
70
|
+
[bibliography]
|
71
|
+
== Normative References
|
72
|
+
|
73
|
+
[[x]]
|
74
|
+
[%bibitem]
|
75
|
+
=== Standard
|
76
|
+
type:: standard
|
77
|
+
contributor::
|
78
|
+
role::: publisher
|
79
|
+
organization:::
|
80
|
+
name:::: ISO
|
81
|
+
INPUT
|
82
|
+
errf = File.read("test.err")
|
83
|
+
expect(errf).not_to include "The following reference is missing an anchor"
|
67
84
|
end
|
85
|
+
|
68
86
|
it "warns about malformed LaTeX" do
|
69
87
|
FileUtils.rm_f "test.err"
|
70
88
|
Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
|
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|