metanorma-standoc 1.3.28 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +8 -7
- data/.github/workflows/ubuntu.yml +14 -11
- data/.github/workflows/windows.yml +8 -8
- data/.gitignore +1 -0
- data/lib/asciidoctor/standoc/base.rb +29 -48
- data/lib/asciidoctor/standoc/biblio.rng +36 -6
- data/lib/asciidoctor/standoc/blocks.rb +32 -96
- data/lib/asciidoctor/standoc/blocks_notes.rb +89 -0
- data/lib/asciidoctor/standoc/cleanup.rb +12 -6
- data/lib/asciidoctor/standoc/cleanup_block.rb +5 -2
- data/lib/asciidoctor/standoc/cleanup_inline.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +47 -1
- data/lib/asciidoctor/standoc/cleanup_section.rb +8 -125
- data/lib/asciidoctor/standoc/cleanup_terms.rb +134 -0
- data/lib/asciidoctor/standoc/converter.rb +16 -0
- data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
- data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +102 -0
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +408 -0
- data/lib/asciidoctor/standoc/inline.rb +11 -6
- data/lib/asciidoctor/standoc/isodoc.rng +444 -1
- data/lib/asciidoctor/standoc/lists.rb +12 -12
- data/lib/asciidoctor/standoc/macros.rb +13 -8
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +44 -21
- data/lib/asciidoctor/standoc/ref.rb +78 -79
- data/lib/asciidoctor/standoc/ref_sect.rb +124 -0
- data/lib/asciidoctor/standoc/reqt.rb +11 -6
- data/lib/asciidoctor/standoc/reqt.rng +23 -0
- data/lib/asciidoctor/standoc/section.rb +2 -46
- data/lib/asciidoctor/standoc/table.rb +3 -2
- data/lib/asciidoctor/standoc/validate.rb +8 -2
- data/lib/asciidoctor/standoc/validate_section.rb +0 -2
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +30 -0
- data/lib/asciidoctor/standoc/views/datamodel/plantuml_representation.adoc.erb +20 -0
- data/lib/metanorma/standoc/processor.rb +5 -7
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/asciidoctor-standoc/blocks_spec.rb +68 -23
- data/spec/asciidoctor-standoc/cleanup_spec.rb +85 -5
- data/spec/asciidoctor-standoc/datamodel/attributes_table_preprocessor_spec.rb +111 -0
- data/spec/asciidoctor-standoc/datamodel/diagram_preprocessor_spec.rb +72 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +7 -3
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -4
- data/spec/asciidoctor-standoc/lists_spec.rb +7 -5
- data/spec/asciidoctor-standoc/macros_spec.rb +54 -2
- data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +2 -1
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +4 -2
- data/spec/asciidoctor-standoc/refs_spec.rb +283 -24
- data/spec/asciidoctor-standoc/table_spec.rb +3 -3
- data/spec/asciidoctor-standoc/validate_spec.rb +77 -7
- data/spec/assets/iso123.rxl +107 -0
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/examples/datamodel/address_class_profile.adoc +4 -0
- data/spec/examples/datamodel/address_component_profile.adoc +4 -0
- data/spec/examples/datamodel/blank_definition_profile.adoc +4 -0
- data/spec/examples/datamodel/common_models_diagram.adoc +4 -0
- data/spec/examples/datamodel/models/models/AddressClassProfile.yml +90 -0
- data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +63 -0
- data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +15 -0
- data/spec/examples/datamodel/models/models/AddressProfile.yml +36 -0
- data/spec/examples/datamodel/models/models/AttributeProfile.yml +32 -0
- data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +79 -0
- data/spec/examples/datamodel/models/models/Localization copy.yml +23 -0
- data/spec/examples/datamodel/models/models/Localization.yml +23 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +36 -0
- data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +15 -0
- data/spec/examples/datamodel/models/models/Signature.yml +20 -0
- data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +20 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +16 -0
- data/spec/examples/datamodel/models/models/TextDirectionCode.yml +16 -0
- data/spec/examples/datamodel/models/models/Validity.yml +14 -0
- data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +22 -0
- data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +2 -0
- data/spec/examples/datamodel/models/style.uml.inc +37 -0
- data/spec/examples/datamodel/models/views/CommonModels.yml +9 -0
- data/spec/examples/datamodel/models/views/TopDown.yml +62 -0
- data/spec/examples/datamodel/top_down_diagram.adoc +4 -0
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +149 -0
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +71 -0
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +51 -0
- data/spec/fixtures/macros_datamodel/common_models_diagram.xml +7 -0
- data/spec/fixtures/macros_datamodel/top_down_diagram.xml +7 -0
- data/spec/metanorma/processor_spec.rb +4 -4
- data/spec/spec_helper.rb +13 -2
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +85 -85
- data/spec/vcr_cassettes/isobib_get_123.yml +19 -198
- data/spec/vcr_cassettes/isobib_get_123_1.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +22 -22
- data/spec/vcr_cassettes/isobib_get_124.yml +21 -21
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +10 -10
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +47 -44
- metadata +53 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac225a257c1a5c42ce296ee87ef1d95e378111a82875211969771f7d1756bcf2
|
4
|
+
data.tar.gz: 30ff55c905559089be61b2752cb84c8274a121b4e5359a8cdf547528296a09be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e66997f17221a04e57e213a66e16ce0061060c5ffd0708bc9196b2b75ec8081673475890b8745086341196bb30a7832ca7f3c1d5615bd80063e31f6f9e243534
|
7
|
+
data.tar.gz: 1a1e23d189dbb0ef46552e5953cd8568c83b6380d239a68cfab95e8a1cb975583e7697bc6d11babb509ca5a21f9f3c7d4d06e225f8faef39f2c7f3d9d8087f9c
|
data/.github/workflows/macos.yml
CHANGED
@@ -6,25 +6,29 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/ubuntu.yml
|
11
|
+
- .github/workflows/windows.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-macos:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} macOS
|
13
16
|
runs-on: macos-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
21
29
|
uses: actions/setup-ruby@v1
|
22
30
|
with:
|
23
31
|
ruby-version: ${{ matrix.ruby }}
|
24
|
-
architecture: 'x64'
|
25
|
-
- uses: actions/setup-node@v1
|
26
|
-
with:
|
27
|
-
node-version: '10.x'
|
28
32
|
- name: Install LaTeXML
|
29
33
|
run: |
|
30
34
|
brew install libxml2 cpanminus
|
@@ -33,9 +37,6 @@ jobs:
|
|
33
37
|
- name: Install PlantUML
|
34
38
|
run: |
|
35
39
|
brew install plantuml
|
36
|
-
- name: Install puppeteer
|
37
|
-
run: |
|
38
|
-
npm -g i puppeteer
|
39
40
|
- name: Update gems
|
40
41
|
run: |
|
41
42
|
sudo gem install bundler --force
|
@@ -6,25 +6,29 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/windows.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-linux:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
13
16
|
runs-on: ubuntu-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
21
29
|
uses: actions/setup-ruby@v1
|
22
30
|
with:
|
23
31
|
ruby-version: ${{ matrix.ruby }}
|
24
|
-
architecture: 'x64'
|
25
|
-
- uses: actions/setup-node@v1
|
26
|
-
with:
|
27
|
-
node-version: '10.x'
|
28
32
|
- name: Update gems
|
29
33
|
run: |
|
30
34
|
gem install bundler
|
@@ -34,13 +38,12 @@ jobs:
|
|
34
38
|
sudo snap install latexml --edge
|
35
39
|
echo "::add-path::/snap/bin"
|
36
40
|
- name: Install PlantUML
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
sudo
|
43
|
-
npm install -g puppeteer@3.0.1
|
41
|
+
uses: nick-invision/retry@v1
|
42
|
+
with:
|
43
|
+
polling_interval_seconds: 5
|
44
|
+
timeout_minutes: 5
|
45
|
+
max_attempts: 3
|
46
|
+
command: sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
44
47
|
- name: Run specs
|
45
48
|
run: |
|
46
49
|
bundle exec rake
|
@@ -6,25 +6,29 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/ubuntu.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-windows:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} Windows
|
13
16
|
runs-on: windows-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Use Ruby
|
21
29
|
uses: actions/setup-ruby@v1
|
22
30
|
with:
|
23
31
|
ruby-version: ${{ matrix.ruby }}
|
24
|
-
architecture: 'x64'
|
25
|
-
- uses: actions/setup-node@v1
|
26
|
-
with:
|
27
|
-
node-version: '10.x'
|
28
32
|
- name: Install MN Windows dependencies
|
29
33
|
shell: pwsh
|
30
34
|
run: |
|
@@ -42,10 +46,6 @@ jobs:
|
|
42
46
|
refreshenv
|
43
47
|
set PATH=C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;%PATH%
|
44
48
|
where latexmlmath
|
45
|
-
- name: Install puppeteer
|
46
|
-
shell: pwsh
|
47
|
-
run: |
|
48
|
-
npm -g i puppeteer
|
49
49
|
- name: Run specs
|
50
50
|
shell: pwsh
|
51
51
|
run: |
|
data/.gitignore
CHANGED
@@ -14,20 +14,6 @@ module Asciidoctor
|
|
14
14
|
XML_ROOT_TAG = "standard-document".freeze
|
15
15
|
XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
|
16
16
|
|
17
|
-
Asciidoctor::Extensions.register do
|
18
|
-
preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
|
19
|
-
inline_macro Asciidoctor::Standoc::AltTermInlineMacro
|
20
|
-
inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
|
21
|
-
inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
|
22
|
-
inline_macro Asciidoctor::Standoc::InheritInlineMacro
|
23
|
-
inline_macro Asciidoctor::Standoc::HTML5RubyMacro
|
24
|
-
inline_macro Asciidoctor::Standoc::ConceptInlineMacro
|
25
|
-
block Asciidoctor::Standoc::ToDoAdmonitionBlock
|
26
|
-
treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
|
27
|
-
block Asciidoctor::Standoc::PlantUMLBlockMacro
|
28
|
-
block Asciidoctor::Standoc::PseudocodeBlockMacro
|
29
|
-
end
|
30
|
-
|
31
17
|
def xml_root_tag
|
32
18
|
self.class::XML_ROOT_TAG
|
33
19
|
end
|
@@ -96,6 +82,10 @@ module Asciidoctor
|
|
96
82
|
IsoDoc::WordConvert.new(doc_extract_attributes(node))
|
97
83
|
end
|
98
84
|
|
85
|
+
def presentation_xml_converter(node)
|
86
|
+
IsoDoc::PresentationXMLConvert.new(html_extract_attributes(node))
|
87
|
+
end
|
88
|
+
|
99
89
|
def init(node)
|
100
90
|
@fn_number ||= 0
|
101
91
|
@draft = false
|
@@ -111,6 +101,7 @@ module Asciidoctor
|
|
111
101
|
@filename = node.attr("docfile") ?
|
112
102
|
File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
|
113
103
|
@localdir = Utils::localdir(node)
|
104
|
+
@output_dir = outputdir node
|
114
105
|
@no_isobib_cache = node.attr("no-isobib-cache")
|
115
106
|
@no_isobib = node.attr("no-isobib")
|
116
107
|
@bibdb = nil
|
@@ -125,31 +116,6 @@ module Asciidoctor
|
|
125
116
|
i18n_init(lang, script)
|
126
117
|
end
|
127
118
|
|
128
|
-
def init_bib_caches(node)
|
129
|
-
return if @no_isobib
|
130
|
-
global = !@no_isobib_cache && !node.attr("local-cache-only")
|
131
|
-
local = node.attr("local-cache") || node.attr("local-cache-only")
|
132
|
-
local = nil if @no_isobib_cache
|
133
|
-
@bibdb = Relaton::DbCache.init_bib_caches(
|
134
|
-
local_cache: local,
|
135
|
-
flush_caches: node.attr("flush-caches"),
|
136
|
-
global_cache: global)
|
137
|
-
end
|
138
|
-
|
139
|
-
def init_iev_caches(node)
|
140
|
-
unless (@no_isobib_cache || @no_isobib)
|
141
|
-
node.attr("local-cache-only") or
|
142
|
-
@iev_globalname = global_ievcache_name
|
143
|
-
@iev_localname = local_ievcache_name(node.attr("local-cache") ||
|
144
|
-
node.attr("local-cache-only"))
|
145
|
-
if node.attr("flush-caches")
|
146
|
-
FileUtils.rm_f @iev_globalname unless @iev_globalname.nil?
|
147
|
-
FileUtils.rm_f @iev_localname unless @iev_localname.nil?
|
148
|
-
end
|
149
|
-
end
|
150
|
-
#@iev = Iev::Db.new(globalname, localname) unless @no_isobib
|
151
|
-
end
|
152
|
-
|
153
119
|
def default_fonts(node)
|
154
120
|
b = node.attr("body-font") ||
|
155
121
|
(node.attr("script") == "Hans" ? '"SimSun",serif' :
|
@@ -161,19 +127,26 @@ module Asciidoctor
|
|
161
127
|
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
162
128
|
end
|
163
129
|
|
130
|
+
def outputs(node, ret)
|
131
|
+
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
132
|
+
presentation_xml_converter(node).convert(@filename + ".xml")
|
133
|
+
html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
|
134
|
+
doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
|
135
|
+
end
|
136
|
+
|
164
137
|
def document(node)
|
165
138
|
init(node)
|
166
139
|
ret = makexml(node).to_xml(indent: 2)
|
167
|
-
unless node.attr("nodoc") || !node.attr("docfile")
|
168
|
-
|
169
|
-
html_converter(node).convert(@filename + ".xml")
|
170
|
-
doc_converter(node).convert(@filename + ".xml")
|
171
|
-
end
|
172
|
-
@log.write(@localdir + @filename + ".err") unless @novalid
|
173
|
-
@files_to_delete.each { |f| FileUtils.rm f }
|
140
|
+
outputs(node, ret) unless node.attr("nodoc") || !node.attr("docfile")
|
141
|
+
clean_exit
|
174
142
|
ret
|
175
143
|
end
|
176
144
|
|
145
|
+
def clean_exit
|
146
|
+
@log.write(@output_dir + @filename + ".err") unless @novalid
|
147
|
+
@files_to_delete.each { |f| FileUtils.rm f }
|
148
|
+
end
|
149
|
+
|
177
150
|
def makexml1(node)
|
178
151
|
result = ["<?xml version='1.0' encoding='UTF-8'?>",
|
179
152
|
"<#{xml_root_tag}>"]
|
@@ -211,7 +184,7 @@ module Asciidoctor
|
|
211
184
|
end
|
212
185
|
end
|
213
186
|
|
214
|
-
def
|
187
|
+
def term_source_attrs(seen_xref)
|
215
188
|
{ bibitemid: seen_xref.children[0]["target"],
|
216
189
|
format: seen_xref.children[0]["format"],
|
217
190
|
type: "inline" }
|
@@ -222,7 +195,7 @@ module Asciidoctor
|
|
222
195
|
xml_t.origin { |o| o << seen_xref.children[0].to_xml }
|
223
196
|
else
|
224
197
|
xml_t.origin seen_xref.children[0].content,
|
225
|
-
**attr_code(
|
198
|
+
**attr_code(term_source_attrs(seen_xref))
|
226
199
|
end
|
227
200
|
m[:text] && xml_t.modification do |mod|
|
228
201
|
mod.p { |p| p << m[:text].sub(/^\s+/, "") }
|
@@ -255,6 +228,14 @@ module Asciidoctor
|
|
255
228
|
end
|
256
229
|
end.join("\n")
|
257
230
|
end
|
231
|
+
|
232
|
+
private
|
233
|
+
|
234
|
+
def outputdir(node)
|
235
|
+
if node.attr("output_dir").nil_or_empty? then Utils::localdir(node)
|
236
|
+
else File.join(node.attr("output_dir"), "")
|
237
|
+
end
|
238
|
+
end
|
258
239
|
end
|
259
240
|
end
|
260
241
|
end
|
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
92
92
|
<optional>
|
93
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
94
|
<attribute name="language"/>
|
@@ -98,6 +98,16 @@
|
|
98
98
|
</optional>
|
99
99
|
<text/>
|
100
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
101
111
|
<!--
|
102
112
|
Unlike UML, change type to format: type is overloaded
|
103
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -121,7 +131,7 @@
|
|
121
131
|
</optional>
|
122
132
|
<ref name="LocalizedStringOrXsAny"/>
|
123
133
|
</define>
|
124
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
125
135
|
<optional>
|
126
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
127
137
|
<attribute name="language"/>
|
@@ -136,6 +146,16 @@
|
|
136
146
|
</choice>
|
137
147
|
</oneOrMore>
|
138
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
139
159
|
<define name="contributor">
|
140
160
|
<element name="contributor">
|
141
161
|
<zeroOrMore>
|
@@ -512,7 +532,7 @@
|
|
512
532
|
</define>
|
513
533
|
<define name="LocalityType">
|
514
534
|
<data type="string">
|
515
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|locality:[a-zA-Z0-9_]+</param>
|
535
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
516
536
|
</data>
|
517
537
|
</define>
|
518
538
|
<define name="referenceFrom">
|
@@ -641,9 +661,9 @@
|
|
641
661
|
<optional>
|
642
662
|
<ref name="status"/>
|
643
663
|
</optional>
|
644
|
-
<
|
664
|
+
<zeroOrMore>
|
645
665
|
<ref name="copyright"/>
|
646
|
-
</
|
666
|
+
</zeroOrMore>
|
647
667
|
<zeroOrMore>
|
648
668
|
<ref name="docrelation"/>
|
649
669
|
</zeroOrMore>
|
@@ -1001,7 +1021,17 @@
|
|
1001
1021
|
<optional>
|
1002
1022
|
<ref name="to"/>
|
1003
1023
|
</optional>
|
1004
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
1005
1035
|
</element>
|
1006
1036
|
</define>
|
1007
1037
|
<define name="from">
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "htmlentities"
|
2
2
|
require "uri"
|
3
|
+
require_relative "./blocks_notes"
|
3
4
|
|
4
5
|
module Asciidoctor
|
5
6
|
module Standoc
|
@@ -8,24 +9,27 @@ module Asciidoctor
|
|
8
9
|
{ id: Utils::anchor_or_uuid(node) }
|
9
10
|
end
|
10
11
|
|
11
|
-
def
|
12
|
+
def id_unnum_attrs(node)
|
12
13
|
attr_code( id: Utils::anchor_or_uuid(node),
|
13
14
|
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
15
|
+
number: node.attr("number"),
|
14
16
|
subsequence: node.attr("subsequence") )
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
18
|
-
attr_code(
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
def formula_attrs(node)
|
20
|
+
attr_code(id_unnum_attrs(node).merge(keep_attrs(node).merge(
|
21
|
+
inequality: node.option?("inequality") ? "true" : nil)))
|
22
|
+
end
|
23
|
+
|
24
|
+
def keep_attrs(node)
|
25
|
+
{ "keep-with-next": node.attr("keep-with-next"),
|
26
|
+
"keep-lines-together": node.attr("keep-lines-together") }
|
22
27
|
end
|
23
28
|
|
24
29
|
# We append each contained block to its parent
|
25
30
|
def open(node)
|
26
31
|
role = node.role || node.attr("style")
|
27
|
-
Utils::reqt_subpart(role) and
|
28
|
-
return requirement_subpart(node)
|
32
|
+
Utils::reqt_subpart(role) and return requirement_subpart(node)
|
29
33
|
result = []
|
30
34
|
node.blocks.each do |b|
|
31
35
|
result << send(b.context, b)
|
@@ -34,7 +38,7 @@ module Asciidoctor
|
|
34
38
|
end
|
35
39
|
|
36
40
|
def literal_attrs(node)
|
37
|
-
attr_code(id_attr(node))
|
41
|
+
attr_code(id_attr(node).merge(keep_attrs(node)))
|
38
42
|
end
|
39
43
|
|
40
44
|
def literal(node)
|
@@ -49,82 +53,11 @@ module Asciidoctor
|
|
49
53
|
|
50
54
|
# NOTE: html escaping is performed by Nokogiri
|
51
55
|
def stem(node)
|
52
|
-
stem_content = node.lines.join("\n")
|
53
|
-
noko do |xml|
|
54
|
-
xml.formula **formula_attr(node) do |s|
|
55
|
-
stem_parse(stem_content, s, node.style.to_sym)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def sidebar_attrs(node)
|
61
|
-
todo_attrs(node).merge(attr_code(
|
62
|
-
from: node.attr("from"),
|
63
|
-
to: node.attr("to") || node.attr("from") ))
|
64
|
-
end
|
65
|
-
|
66
|
-
def sidebar(node)
|
67
|
-
return unless draft?
|
68
|
-
noko do |xml|
|
69
|
-
xml.review **(sidebar_attrs(node)) do |r|
|
70
|
-
wrap_in_para(node, r)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def todo_attrs(node)
|
76
|
-
date = node.attr("date") || Date.today.iso8601.gsub(/\+.*$/, "")
|
77
|
-
date += "T00:00:00Z" unless /T/.match date
|
78
|
-
attr_code(
|
79
|
-
id: Utils::anchor_or_uuid(node),
|
80
|
-
reviewer: node.attr("reviewer") || node.attr("source") || "(Unknown)",
|
81
|
-
date: date )
|
82
|
-
end
|
83
|
-
|
84
|
-
def todo(node)
|
85
|
-
noko do |xml|
|
86
|
-
xml.review **(todo_attrs(node)) do |r|
|
87
|
-
wrap_in_para(node, r)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def termnote(n)
|
93
|
-
noko do |xml|
|
94
|
-
xml.termnote **id_attr(n) do |ex|
|
95
|
-
wrap_in_para(n, ex)
|
96
|
-
end
|
97
|
-
end.join("\n")
|
98
|
-
end
|
99
|
-
|
100
|
-
def note(n)
|
101
56
|
noko do |xml|
|
102
|
-
xml.
|
103
|
-
|
104
|
-
end
|
105
|
-
end.join("\n")
|
106
|
-
end
|
107
|
-
|
108
|
-
def admonition_attrs(node)
|
109
|
-
name = node.attr("name")
|
110
|
-
if type = node.attr("type")
|
111
|
-
["danger", "safety precautions"].each do |t|
|
112
|
-
name = t if type.casecmp(t).zero?
|
57
|
+
xml.formula **formula_attrs(node) do |s|
|
58
|
+
stem_parse(node.lines.join("\n"), s, node.style.to_sym)
|
113
59
|
end
|
114
60
|
end
|
115
|
-
attr_code(id: Utils::anchor_or_uuid(node), type: name)
|
116
|
-
end
|
117
|
-
|
118
|
-
def admonition(node)
|
119
|
-
return termnote(node) if in_terms?
|
120
|
-
return note(node) if node.attr("name") == "note"
|
121
|
-
return todo(node) if node.attr("name") == "todo"
|
122
|
-
noko do |xml|
|
123
|
-
xml.admonition **admonition_attrs(node) do |a|
|
124
|
-
node.title.nil? or a.name { |name| name << node.title }
|
125
|
-
wrap_in_para(node, a)
|
126
|
-
end
|
127
|
-
end.join("\n")
|
128
61
|
end
|
129
62
|
|
130
63
|
def term_example(node)
|
@@ -145,9 +78,10 @@ module Asciidoctor
|
|
145
78
|
end
|
146
79
|
|
147
80
|
def pseudocode_example(node)
|
81
|
+
# prevent A's and other subs inappropriate for pseudocode
|
82
|
+
node.blocks.each { |b| b.remove_sub(:replacements) }
|
148
83
|
noko do |xml|
|
149
|
-
xml.figure **
|
150
|
-
class: "pseudocode"} do |ex|
|
84
|
+
xml.figure **example_attrs(node).merge(class: "pseudocode") do |ex|
|
151
85
|
figure_title(node, ex)
|
152
86
|
wrap_in_para(node, ex)
|
153
87
|
end
|
@@ -155,7 +89,7 @@ module Asciidoctor
|
|
155
89
|
end
|
156
90
|
|
157
91
|
def example_attrs(node)
|
158
|
-
attr_code(
|
92
|
+
attr_code(id_unnum_attrs(node).merge(keep_attrs(node)))
|
159
93
|
end
|
160
94
|
|
161
95
|
def example_proper(node)
|
@@ -173,7 +107,7 @@ module Asciidoctor
|
|
173
107
|
end
|
174
108
|
|
175
109
|
def figure_attrs(node)
|
176
|
-
attr_code(
|
110
|
+
attr_code(id_unnum_attrs(node).merge(keep_attrs(node)))
|
177
111
|
end
|
178
112
|
|
179
113
|
def image(node)
|
@@ -186,8 +120,8 @@ module Asciidoctor
|
|
186
120
|
end
|
187
121
|
|
188
122
|
def para_attrs(node)
|
189
|
-
attr_code(align: node.attr("align"),
|
190
|
-
|
123
|
+
attr_code(keep_attrs(node).merge(align: node.attr("align"),
|
124
|
+
id: Utils::anchor_or_uuid(node)))
|
191
125
|
end
|
192
126
|
|
193
127
|
def paragraph(node)
|
@@ -200,7 +134,8 @@ module Asciidoctor
|
|
200
134
|
end
|
201
135
|
|
202
136
|
def quote_attrs(node)
|
203
|
-
attr_code(
|
137
|
+
attr_code(keep_attrs(node).merge(align: node.attr("align"),
|
138
|
+
id: Utils::anchor_or_uuid(node)))
|
204
139
|
end
|
205
140
|
|
206
141
|
def quote_attribution(node, out)
|
@@ -210,9 +145,8 @@ module Asciidoctor
|
|
210
145
|
s << m[:text]
|
211
146
|
end
|
212
147
|
end
|
213
|
-
|
148
|
+
node.attr("attribution") and
|
214
149
|
out.author { |a| a << node.attr("attribution") }
|
215
|
-
end
|
216
150
|
end
|
217
151
|
|
218
152
|
def quote(node)
|
@@ -225,10 +159,11 @@ module Asciidoctor
|
|
225
159
|
end
|
226
160
|
|
227
161
|
def listing_attrs(node)
|
228
|
-
attr_code(lang: node.attr("language"),
|
229
|
-
|
230
|
-
|
231
|
-
|
162
|
+
attr_code(keep_attrs(node).merge(lang: node.attr("language"),
|
163
|
+
id: Utils::anchor_or_uuid(node),
|
164
|
+
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
165
|
+
number: node.attr("number"),
|
166
|
+
filename: node.attr("filename")))
|
232
167
|
end
|
233
168
|
|
234
169
|
# NOTE: html escaping is performed by Nokogiri
|
@@ -245,7 +180,8 @@ module Asciidoctor
|
|
245
180
|
|
246
181
|
def pass(node)
|
247
182
|
noko do |xml|
|
248
|
-
xml.passthrough **attr_code(formats:
|
183
|
+
xml.passthrough **attr_code(formats:
|
184
|
+
node.attr("format") || "metanorma") do |p|
|
249
185
|
p << HTMLEntities.new.encode(node.content, :basic, :hexadecimal)
|
250
186
|
end
|
251
187
|
end
|