metanorma-standoc 1.0.14 → 1.1.0
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 +1 -1
- data/README.adoc +16 -1
- data/lib/asciidoctor/standoc/biblio.rng +21 -11
- data/lib/asciidoctor/standoc/blocks.rb +1 -1
- data/lib/asciidoctor/standoc/front.rb +44 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor-standoc/base_spec.rb +92 -0
- metadata +2 -3
- data/lib/hacks/sterile.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade6c1c0ec2ee0ab99b2442458300ff20d4ff4f54852d27555c12102325bde55
|
4
|
+
data.tar.gz: 8438c7af3cdb3950dfef74a6834a5110dd6fdb64b8919b491f1e0c3899ced318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4932ccc12e249099226f62fccfd08e116d362c1b0b045e758325db52fa0f2425ffa8b197d106cd4fcb4d7b28ba8a1fcacaacba5cc69be2391e74ced1b3ecac
|
7
|
+
data.tar.gz: 8eda800af76b44522d194711cc5272387b8e1c996713db8c54ff1a0dbbad86b229b9cd1feb3139c45cbbfec326d92503eb51fea857c007958588aaf36cc67e2c
|
data/Gemfile.lock
CHANGED
data/README.adoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Metanorma-standoc
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma-standoc.svg["Gem Version", link="https://rubygems.org/gems/metanorma-standoc"]
|
4
|
-
image:https://img.shields.io/travis/riboseinc/metanorma-standoc/master.svg["Build Status", link="https://travis-ci.
|
4
|
+
image:https://img.shields.io/travis/riboseinc/metanorma-standoc/master.svg["Build Status", link="https://travis-ci.com/riboseinc/metanorma-standoc"]
|
5
5
|
image:https://codeclimate.com/github/riboseinc/metanorma-standoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-standoc"]
|
6
6
|
|
7
7
|
WARNING: This gem is still under development.
|
@@ -586,6 +586,21 @@ the document was issued
|
|
586
586
|
|
587
587
|
`:technical-committee:`:: The name of the relevant technical committee
|
588
588
|
|
589
|
+
`:fullname{_i}:`:: The full name of a person who is a contributor to the document.
|
590
|
+
A second person is indicated by using a numeric suffix: `:fullname:`, `:fullname_2:`, `fullname_3:`, &c.
|
591
|
+
(This and the other personal name attributes are not displayed in all standards.)
|
592
|
+
|
593
|
+
`:surname{_i}:`:: The surname of a person who is a contributor to the document.
|
594
|
+
`:givenname{_i}:`:: The given name(s) of a person who is a contributor to the document.
|
595
|
+
`:initials{_i}:`:: The initials(s) of a person who is a contributor to the document.
|
596
|
+
`:role{_i}:`:: The role of a a person who is a contributor to the document. By default,
|
597
|
+
they are coded as an `editor`; they can also be represented as an `author`.
|
598
|
+
`:affiliation{_i}:`:: The organisational affiliation of a person who is a contributor to the document.
|
599
|
+
`:address{_i}:`:: The organisational address of a person who is a contributor to the document.
|
600
|
+
`:contributor-uri{_i}:`:: The URI of a person who is a contributor to the document.
|
601
|
+
`:email{_i}:`:: The email of a person who is a contributor to the document.
|
602
|
+
|
603
|
+
|
589
604
|
`:draft:`:: The document draft (used in addition to document stage, for multiple iterations: expected format _X.Y_)
|
590
605
|
|
591
606
|
`:issued-date:`::
|
@@ -286,18 +286,23 @@
|
|
286
286
|
</define>
|
287
287
|
<define name="address">
|
288
288
|
<element name="address">
|
289
|
-
<
|
289
|
+
<choice>
|
290
290
|
<!-- iso191606 TODO -->
|
291
|
-
<
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
291
|
+
<group>
|
292
|
+
<oneOrMore>
|
293
|
+
<ref name="street"/>
|
294
|
+
</oneOrMore>
|
295
|
+
<ref name="city"/>
|
296
|
+
<optional>
|
297
|
+
<ref name="state"/>
|
298
|
+
</optional>
|
299
|
+
<ref name="country"/>
|
300
|
+
<optional>
|
301
|
+
<ref name="postcode"/>
|
302
|
+
</optional>
|
303
|
+
</group>
|
304
|
+
<ref name="formattedAddress"/>
|
305
|
+
</choice>
|
301
306
|
</element>
|
302
307
|
</define>
|
303
308
|
<define name="street">
|
@@ -325,6 +330,11 @@
|
|
325
330
|
<text/>
|
326
331
|
</element>
|
327
332
|
</define>
|
333
|
+
<define name="formattedAddress">
|
334
|
+
<element name="formattedAddress">
|
335
|
+
<text/>
|
336
|
+
</element>
|
337
|
+
</define>
|
328
338
|
<define name="person-identifier">
|
329
339
|
<element name="identifier">
|
330
340
|
<attribute name="type">
|
@@ -127,7 +127,7 @@ module Asciidoctor
|
|
127
127
|
def datauri(uri)
|
128
128
|
types = MIME::Types.type_for(@localdir + uri)
|
129
129
|
type = types ? types.first.to_s : 'text/plain; charset="utf-8"'
|
130
|
-
bin = File.
|
130
|
+
bin = File.open(@localdir + uri, 'rb') {|io| io.read}
|
131
131
|
data = Base64.strict_encode64(bin)
|
132
132
|
"data:#{type};base64,#{data}"
|
133
133
|
end
|
@@ -44,13 +44,56 @@ module Asciidoctor
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def metadata_author(node, xml)
|
47
|
-
publishers = node.attr("publisher") ||
|
47
|
+
publishers = node.attr("publisher") || ""
|
48
48
|
publishers.split(/,[ ]?/).each do |p|
|
49
49
|
xml.contributor do |c|
|
50
50
|
c.role **{ type: "author" }
|
51
51
|
c.organization { |a| organization(a, p) }
|
52
52
|
end
|
53
53
|
end
|
54
|
+
personal_author(node, xml)
|
55
|
+
end
|
56
|
+
|
57
|
+
def personal_author(node, xml)
|
58
|
+
if node.attr("fullname") || node.attr("surname")
|
59
|
+
personal_author1(node, xml, "")
|
60
|
+
end
|
61
|
+
i = 2
|
62
|
+
while node.attr("fullname_#{i}") || node.attr("surname_#{i}")
|
63
|
+
personal_author1(node, xml, "_#{i}")
|
64
|
+
i += 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def personal_author1(node, xml, suffix)
|
69
|
+
xml.contributor do |c|
|
70
|
+
c.role **{ type: node.attr("role#{suffix}")&.downcase || "author" }
|
71
|
+
c.person do |p|
|
72
|
+
p.name do |n|
|
73
|
+
if node.attr("fullname#{suffix}")
|
74
|
+
n.completename node.attr("fullname#{suffix}")
|
75
|
+
else
|
76
|
+
n.forename node.attr("givenname#{suffix}")
|
77
|
+
n.initial node.attr("initials#{suffix}")
|
78
|
+
n.surname node.attr("surname#{suffix}")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
node.attr("affiliation#{suffix}") and p.affiliation do |a|
|
82
|
+
a.org do |o|
|
83
|
+
o.name node.attr("affiliation#{suffix}")
|
84
|
+
node.attr("address#{suffix}") and o.contact do |c|
|
85
|
+
c.address do |ad|
|
86
|
+
ad.formattedAddress node.attr("address#{suffix}")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
node.attr("email#{suffix}") and p.contact do |c|
|
92
|
+
c.email node.attr("email#{suffix}")
|
93
|
+
end
|
94
|
+
node.attr("contributor-uri#{suffix}") and p.uri node.attr("contributor-uri#{suffix}")
|
95
|
+
end
|
96
|
+
end
|
54
97
|
end
|
55
98
|
|
56
99
|
def metadata_publisher(node, xml)
|
@@ -82,6 +82,19 @@ RSpec.describe Asciidoctor::Standoc do
|
|
82
82
|
:language: en
|
83
83
|
:title: Main Title -- Title
|
84
84
|
:library-ics: 1,2,3
|
85
|
+
:fullname: Fred Flintstone
|
86
|
+
:role: author
|
87
|
+
:affiliation: Slate Rock and Gravel Company
|
88
|
+
:address: 6 Rubble Way, Bedrock
|
89
|
+
:contributor-uri: http://slate.example.com
|
90
|
+
:surname_2: Rubble
|
91
|
+
:givenname_2: Barney
|
92
|
+
:initials_2: B. X.
|
93
|
+
:role_2: editor
|
94
|
+
:affiliation_2: Rockhead and Quarry Cave Construction Company
|
95
|
+
:address_2: 6A Rubble Way, Bedrock
|
96
|
+
:email_2: barney@rockhead.example.com
|
97
|
+
:publisher: Hanna Barbera, Cartoon Network
|
85
98
|
INPUT
|
86
99
|
<?xml version="1.0" encoding="UTF-8"?>
|
87
100
|
<standard-document xmlns="http://riboseinc.com/isoxml">
|
@@ -130,11 +143,90 @@ RSpec.describe Asciidoctor::Standoc do
|
|
130
143
|
<revision-date>2000-01-01</revision-date>
|
131
144
|
<draft>3.4</draft>
|
132
145
|
</version>
|
146
|
+
<contributor>
|
147
|
+
<role type="author"/>
|
148
|
+
<organization>
|
149
|
+
<name>Hanna Barbera</name>
|
150
|
+
</organization>
|
151
|
+
</contributor>
|
152
|
+
<contributor>
|
153
|
+
<role type="author"/>
|
154
|
+
<organization>
|
155
|
+
<name>Cartoon Network</name>
|
156
|
+
</organization>
|
157
|
+
</contributor>
|
158
|
+
<contributor>
|
159
|
+
<role type="author"/>
|
160
|
+
<person>
|
161
|
+
<name>
|
162
|
+
<completename>Fred Flintstone</completename>
|
163
|
+
</name>
|
164
|
+
<affiliation>
|
165
|
+
<org>
|
166
|
+
<name>Slate Rock and Gravel Company</name>
|
167
|
+
<contact>
|
168
|
+
<address>
|
169
|
+
<formattedAddress>6 Rubble Way, Bedrock</formattedAddress>
|
170
|
+
</address>
|
171
|
+
</contact>
|
172
|
+
</org>
|
173
|
+
</affiliation>
|
174
|
+
<uri>http://slate.example.com</uri>
|
175
|
+
</person>
|
176
|
+
</contributor>
|
177
|
+
<contributor>
|
178
|
+
<role type="editor"/>
|
179
|
+
<person>
|
180
|
+
<name>
|
181
|
+
<forename>Barney</forename>
|
182
|
+
<initial>B. X.</initial>
|
183
|
+
<surname>Rubble</surname>
|
184
|
+
</name>
|
185
|
+
<affiliation>
|
186
|
+
<org>
|
187
|
+
<name>Rockhead and Quarry Cave Construction Company</name>
|
188
|
+
<contact>
|
189
|
+
<address>
|
190
|
+
<formattedAddress>6A Rubble Way, Bedrock</formattedAddress>
|
191
|
+
</address>
|
192
|
+
</contact>
|
193
|
+
</org>
|
194
|
+
</affiliation>
|
195
|
+
<contact>
|
196
|
+
<email>barney@rockhead.example.com</email>
|
197
|
+
</contact>
|
198
|
+
</person>
|
199
|
+
</contributor>
|
200
|
+
<contributor>
|
201
|
+
<role type="publisher"/>
|
202
|
+
<organization>
|
203
|
+
<name>Hanna Barbera</name>
|
204
|
+
</organization>
|
205
|
+
</contributor>
|
206
|
+
<contributor>
|
207
|
+
<role type="publisher"/>
|
208
|
+
<organization>
|
209
|
+
<name>Cartoon Network</name>
|
210
|
+
</organization>
|
211
|
+
</contributor>
|
133
212
|
<language>en</language>
|
134
213
|
<script>Latn</script>
|
135
214
|
<status format="plain">published</status>
|
136
215
|
<copyright>
|
137
216
|
<from>2001</from>
|
217
|
+
<owner>
|
218
|
+
<organization>
|
219
|
+
<name>Hanna Barbera</name>
|
220
|
+
</organization>
|
221
|
+
</owner>
|
222
|
+
</copyright>
|
223
|
+
<copyright>
|
224
|
+
<from>2001</from>
|
225
|
+
<owner>
|
226
|
+
<organization>
|
227
|
+
<name>Cartoon Network</name>
|
228
|
+
</organization>
|
229
|
+
</owner>
|
138
230
|
</copyright>
|
139
231
|
<editorialgroup>
|
140
232
|
<technical-committee number="1" type="A">TC</technical-committee>
|
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.0
|
4
|
+
version: 1.1.0
|
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-01-
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -339,7 +339,6 @@ files:
|
|
339
339
|
- lib/asciidoctor/standoc/utils.rb
|
340
340
|
- lib/asciidoctor/standoc/validate.rb
|
341
341
|
- lib/asciidoctor/standoc/validate_section.rb
|
342
|
-
- lib/hacks/sterile.rb
|
343
342
|
- lib/metanorma-standoc.rb
|
344
343
|
- lib/metanorma/standoc.rb
|
345
344
|
- lib/metanorma/standoc/processor.rb
|
data/lib/hacks/sterile.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Sterile
|
4
|
-
# @private
|
5
|
-
class Data
|
6
|
-
def self.smart_format_rules
|
7
|
-
[
|
8
|
-
["'tain't", "’tain’t"],
|
9
|
-
["'twere", "’twere"],
|
10
|
-
["'twas", "’twas"],
|
11
|
-
["'tis", "’tis"],
|
12
|
-
["'twill", "’twill"],
|
13
|
-
["'til", "’til"],
|
14
|
-
["'bout", "’bout"],
|
15
|
-
["'nuff", "’nuff"],
|
16
|
-
["'round", "’round"],
|
17
|
-
["'cause", "’cause"],
|
18
|
-
["'cos", "’cos"],
|
19
|
-
["i'm", "i’m"],
|
20
|
-
['--"', "—“"],
|
21
|
-
["--'", "—‘"],
|
22
|
-
["--", "—"],
|
23
|
-
["...", "…"],
|
24
|
-
["(tm)", "™"],
|
25
|
-
["(TM)", "™"],
|
26
|
-
["(c)", "©"],
|
27
|
-
["(r)", "®"],
|
28
|
-
["(R)", "®"],
|
29
|
-
[/\'(\d\d)(?!’|\')([\p{P}\p{Z}])/, "’\\1\\2"],
|
30
|
-
# [/<p>"/, "<p>\\1″"],
|
31
|
-
[/s\'([^a-zA-Z0-9])/, "s’\\1"],
|
32
|
-
[/"([:;])/, "”\\1"],
|
33
|
-
[/\'s$/, "’s"],
|
34
|
-
[/\'(\d\d(?:’|\')?s)/, "’\\1"],
|
35
|
-
[/(\s|\A|"|\(|\[)\'/, "\\1‘"],
|
36
|
-
# [/(\d+)"/, "\\1″"],
|
37
|
-
# [/(\d+)\'/, "\\1′"],
|
38
|
-
[/(\S)\'([^\'\s])/, "\\1’\\2"],
|
39
|
-
[/(\s|\A|\(|\[)"(?!\s)/, "\\1“\\2"],
|
40
|
-
[/"(\s|\S|\Z)/, "”\\1"],
|
41
|
-
[/\'([\s.]|\Z)/, "’\\1"],
|
42
|
-
[/(\d+)x(\d+)/, "\\1×\\2"],
|
43
|
-
[/([a-z])'(t|d|s|ll|re|ve)(\b)/i, "\\1’\\2\\3"],
|
44
|
-
]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class << self
|
49
|
-
private
|
50
|
-
def smart_format_rules
|
51
|
-
Data.smart_format_rules
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|