metanorma-iso 1.5.10 → 1.6.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/.github/workflows/rake.yml +66 -0
- data/README.adoc +5 -6
- data/lib/asciidoctor/iso/base.rb +5 -5
- data/lib/asciidoctor/iso/basicdoc.rng +50 -3
- data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
- data/lib/asciidoctor/iso/boilerplate.xml +1 -0
- data/lib/asciidoctor/iso/cleanup.rb +38 -6
- data/lib/asciidoctor/iso/front.rb +5 -0
- data/lib/asciidoctor/iso/isodoc.rng +36 -43
- data/lib/asciidoctor/iso/isostandard.rng +11 -0
- data/lib/asciidoctor/iso/validate.rb +1 -1
- data/lib/asciidoctor/iso/validate_section.rb +9 -0
- data/lib/isodoc/iso/base_convert.rb +2 -1
- data/lib/isodoc/iso/html/header.html +12 -24
- data/lib/isodoc/iso/html/htmlstyle.css +1 -1
- data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
- data/lib/isodoc/iso/html/isodoc.css +42 -42
- data/lib/isodoc/iso/html/isodoc.scss +42 -42
- data/lib/isodoc/iso/html/style-human.css +13 -9
- data/lib/isodoc/iso/html/style-human.scss +7 -7
- data/lib/isodoc/iso/html/style-iso.css +11 -7
- data/lib/isodoc/iso/html/style-iso.scss +5 -5
- data/lib/isodoc/iso/html/wordstyle.css +67 -67
- data/lib/isodoc/iso/html/wordstyle.scss +67 -67
- data/lib/isodoc/iso/html_convert.rb +4 -0
- data/lib/isodoc/iso/i18n-en.yaml +4 -0
- data/lib/isodoc/iso/i18n-fr.yaml +5 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
- data/lib/isodoc/iso/i18n.rb +10 -11
- data/lib/isodoc/iso/iso.amendment.xsl +391 -88
- data/lib/isodoc/iso/iso.international-standard.xsl +391 -88
- data/lib/isodoc/iso/metadata.rb +20 -19
- data/lib/isodoc/iso/word_convert.rb +4 -0
- data/lib/isodoc/iso/xref.rb +10 -0
- data/lib/metanorma/iso/processor.rb +11 -9
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +2 -2
- data/spec/asciidoctor-iso/base_spec.rb +26 -14
- data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
- data/spec/asciidoctor-iso/cleanup_spec.rb +11 -5
- data/spec/asciidoctor-iso/lists_spec.rb +6 -6
- data/spec/asciidoctor-iso/refs_spec.rb +174 -143
- data/spec/asciidoctor-iso/section_spec.rb +5 -0
- data/spec/asciidoctor-iso/validate_spec.rb +18 -1
- data/spec/isodoc/amd_spec.rb +187 -22
- data/spec/isodoc/blocks_spec.rb +1 -0
- data/spec/isodoc/i18n_spec.rb +9 -22
- data/spec/isodoc/inline_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +170 -3
- data/spec/isodoc/postproc_spec.rb +2 -5
- data/spec/isodoc/ref_spec.rb +4 -7
- data/spec/isodoc/section_spec.rb +20 -0
- data/spec/isodoc/xref_spec.rb +12 -0
- data/spec/spec_helper.rb +17 -1
- metadata +8 -12
- data/.github/workflows/macos.yml +0 -41
- data/.github/workflows/ubuntu.yml +0 -45
- data/.github/workflows/windows.yml +0 -43
- data/lib/asciidoctor/iso/macros.rb +0 -21
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
- data/spec/asciidoctor-iso/macros_spec.rb +0 -310
@@ -613,11 +613,8 @@ documentation.</p>
|
|
613
613
|
presxml = <<~OUTPUT
|
614
614
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
615
615
|
<bibdata type="standard">
|
616
|
-
<status><stage>30</stage></status>
|
616
|
+
<status><stage language="">30</stage></status>
|
617
617
|
</bibdata>
|
618
|
-
<local_bibdata type="standard">
|
619
|
-
<status><stage>30</stage></status>
|
620
|
-
</local_bibdata>
|
621
618
|
<boilerplate>
|
622
619
|
<copyright-statement>
|
623
620
|
<clause inline-header="true">
|
@@ -664,7 +661,7 @@ documentation.</p>
|
|
664
661
|
|
665
662
|
FileUtils.rm_f "test.doc"
|
666
663
|
FileUtils.rm_f "test.html"
|
667
|
-
expect((IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
664
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
|
668
665
|
IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", presxml, false)
|
669
666
|
word = File.read("test.html", encoding: "UTF-8")
|
670
667
|
expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -42,7 +42,7 @@ RSpec.describe IsoDoc do
|
|
42
42
|
<abbreviation>ISO</abbreviation>
|
43
43
|
</organization>
|
44
44
|
</contributor>
|
45
|
-
<note format="text/plain" reference="1" type="
|
45
|
+
<note format="text/plain" reference="1" type="Unpublished-Status">Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
46
46
|
<extent type="part">
|
47
47
|
<referenceFrom>all</referenceFrom>
|
48
48
|
</extent>
|
@@ -123,11 +123,8 @@ RSpec.describe IsoDoc do
|
|
123
123
|
presxml = <<~OUTPUT
|
124
124
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
125
125
|
<bibdata>
|
126
|
-
<language>en</language>
|
126
|
+
<language current="true">en</language>
|
127
127
|
</bibdata>
|
128
|
-
<local_bibdata>
|
129
|
-
<language>en</language>
|
130
|
-
</local_bibdata>
|
131
128
|
<preface>
|
132
129
|
<foreword>
|
133
130
|
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
@@ -178,7 +175,7 @@ RSpec.describe IsoDoc do
|
|
178
175
|
<abbreviation>ISO</abbreviation>
|
179
176
|
</organization>
|
180
177
|
</contributor>
|
181
|
-
<note format='text/plain' reference='1' type='
|
178
|
+
<note format='text/plain' reference='1' type='Unpublished-Status'>Under preparation. (Stage at the time of publication ISO/DIS 16634)</note>
|
182
179
|
<extent type='part'>
|
183
180
|
<referenceFrom>all</referenceFrom>
|
184
181
|
</extent>
|
@@ -342,7 +339,7 @@ html = <<~OUTPUT
|
|
342
339
|
</body>
|
343
340
|
</html>
|
344
341
|
OUTPUT
|
345
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
342
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
|
346
343
|
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
347
344
|
end
|
348
345
|
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -55,6 +55,9 @@ RSpec.describe IsoDoc do
|
|
55
55
|
</clause>
|
56
56
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
57
57
|
<title>An Appendix</title>
|
58
|
+
<clause id='Q2a' inline-header='false' obligation='normative'>
|
59
|
+
<title>Appendix subclause</title>
|
60
|
+
</clause>
|
58
61
|
</appendix>
|
59
62
|
<references id="Q3" normative="false"><title>Annex Bibliography</title></references>
|
60
63
|
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
@@ -140,6 +143,13 @@ RSpec.describe IsoDoc do
|
|
140
143
|
</clause>
|
141
144
|
<appendix id='Q2' inline-header='false' obligation='normative'>
|
142
145
|
<title depth='2'>Appendix 1<tab/>An Appendix</title>
|
146
|
+
<clause id='Q2a' inline-header='false' obligation='normative'>
|
147
|
+
<title depth='3'>
|
148
|
+
Appendix 1.1
|
149
|
+
<tab/>
|
150
|
+
Appendix subclause
|
151
|
+
</title>
|
152
|
+
</clause>
|
143
153
|
</appendix>
|
144
154
|
<references id='Q3' normative='false'>
|
145
155
|
<title depth='2'>A.2<tab/>Annex Bibliography</title>
|
@@ -222,6 +232,9 @@ RSpec.describe IsoDoc do
|
|
222
232
|
</div>
|
223
233
|
<div id="Q2">
|
224
234
|
<h2>Appendix 1  An Appendix</h2>
|
235
|
+
<div id='Q2a'>
|
236
|
+
<h3> Appendix 1.1   Appendix subclause </h3>
|
237
|
+
</div>
|
225
238
|
</div>
|
226
239
|
<div>
|
227
240
|
<h2 class="Section3">A.2  Annex Bibliography</h2>
|
@@ -318,6 +331,13 @@ OUTPUT
|
|
318
331
|
</div>
|
319
332
|
<div id="Q2">
|
320
333
|
<h2>Appendix 1<span style="mso-tab-count:1">  </span>An Appendix</h2>
|
334
|
+
<div id='Q2a'>
|
335
|
+
<h3>
|
336
|
+
Appendix 1.1
|
337
|
+
<span style='mso-tab-count:1'>  </span>
|
338
|
+
Appendix subclause
|
339
|
+
</h3>
|
340
|
+
</div>
|
321
341
|
</div>
|
322
342
|
<div>
|
323
343
|
<h2 class='Section3'>
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -936,6 +936,7 @@ RSpec.describe IsoDoc do
|
|
936
936
|
<xref target="Q"/>
|
937
937
|
<xref target="Q1"/>
|
938
938
|
<xref target="Q2"/>
|
939
|
+
<xref target="Q3"/>
|
939
940
|
<xref target="R"/>
|
940
941
|
</p>
|
941
942
|
</foreword>
|
@@ -985,6 +986,9 @@ RSpec.describe IsoDoc do
|
|
985
986
|
</clause>
|
986
987
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
987
988
|
<title>An Appendix</title>
|
989
|
+
<clause id='Q3' inline-header='false' obligation='normative'>
|
990
|
+
<title>Appendix subclause</title>
|
991
|
+
</clause>
|
988
992
|
</appendix>
|
989
993
|
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
990
994
|
<title>Normative References</title>
|
@@ -1019,6 +1023,7 @@ RSpec.describe IsoDoc do
|
|
1019
1023
|
<xref target='Q'>A.1</xref>
|
1020
1024
|
<xref target='Q1'>A.1.1</xref>
|
1021
1025
|
<xref target='Q2'>Annex A, Appendix 1</xref>
|
1026
|
+
<xref target='Q3'>Annex A, Appendix 1.1</xref>
|
1022
1027
|
<xref target='R'>Clause 2</xref>
|
1023
1028
|
</p>
|
1024
1029
|
</foreword>
|
@@ -1126,6 +1131,13 @@ RSpec.describe IsoDoc do
|
|
1126
1131
|
<tab/>
|
1127
1132
|
An Appendix
|
1128
1133
|
</title>
|
1134
|
+
<clause id='Q3' inline-header='false' obligation='normative'>
|
1135
|
+
<title depth='3'>
|
1136
|
+
Appendix 1.1
|
1137
|
+
<tab/>
|
1138
|
+
Appendix subclause
|
1139
|
+
</title>
|
1140
|
+
</clause>
|
1129
1141
|
</appendix>
|
1130
1142
|
</annex>
|
1131
1143
|
<bibliography>
|
data/spec/spec_helper.rb
CHANGED
@@ -118,8 +118,15 @@ BOILERPLATE =
|
|
118
118
|
gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
|
119
119
|
)
|
120
120
|
|
121
|
+
BOILERPLATE_FR =
|
122
|
+
HTMLEntities.new.decode(
|
123
|
+
File.read(File.join(File.dirname(__FILE__), "..", "lib", "asciidoctor", "iso", "boilerplate-fr.xml"), encoding: "utf-8").
|
124
|
+
gsub(/\{\{ agency \}\}/, "ISO").gsub(/\{\{ docyear \}\}/, Date.today.year.to_s).
|
125
|
+
gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "").
|
126
|
+
gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
|
127
|
+
)
|
121
128
|
|
122
|
-
|
129
|
+
BLANK_HDR1 = <<~"HDR"
|
123
130
|
<?xml version="1.0" encoding="UTF-8"?>
|
124
131
|
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
125
132
|
<bibdata type="standard">
|
@@ -162,9 +169,18 @@ BLANK_HDR = <<~"HDR"
|
|
162
169
|
<stagename>International standard</stagename>
|
163
170
|
</ext>
|
164
171
|
</bibdata>
|
172
|
+
HDR
|
173
|
+
|
174
|
+
BLANK_HDR = <<~"HDR"
|
175
|
+
#{BLANK_HDR1}
|
165
176
|
#{BOILERPLATE}
|
166
177
|
HDR
|
167
178
|
|
179
|
+
BLANK_HDR_FR = <<~"HDR"
|
180
|
+
#{BLANK_HDR1.sub(%r{<language>en</language>}, "<language>fr</language>")}
|
181
|
+
#{BOILERPLATE_FR}
|
182
|
+
HDR
|
183
|
+
|
168
184
|
TERM_BOILERPLATE = <<~END
|
169
185
|
<p id="_">For the purposes of this document,
|
170
186
|
the following terms and definitions apply.</p>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.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: 2020-
|
11
|
+
date: 2020-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-jing
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-standoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.7.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tokenizer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,9 +261,7 @@ extensions: []
|
|
261
261
|
extra_rdoc_files: []
|
262
262
|
files:
|
263
263
|
- ".gitattributes"
|
264
|
-
- ".github/workflows/
|
265
|
-
- ".github/workflows/ubuntu.yml"
|
266
|
-
- ".github/workflows/windows.yml"
|
264
|
+
- ".github/workflows/rake.yml"
|
267
265
|
- ".gitignore"
|
268
266
|
- ".hound.yml"
|
269
267
|
- ".oss-guides.rubocop.yml"
|
@@ -284,6 +282,7 @@ files:
|
|
284
282
|
- lib/asciidoctor/iso/base.rb
|
285
283
|
- lib/asciidoctor/iso/basicdoc.rng
|
286
284
|
- lib/asciidoctor/iso/biblio.rng
|
285
|
+
- lib/asciidoctor/iso/boilerplate-fr.xml
|
287
286
|
- lib/asciidoctor/iso/boilerplate.xml
|
288
287
|
- lib/asciidoctor/iso/cleanup.rb
|
289
288
|
- lib/asciidoctor/iso/converter.rb
|
@@ -293,10 +292,8 @@ files:
|
|
293
292
|
- lib/asciidoctor/iso/isostandard-amd.rng
|
294
293
|
- lib/asciidoctor/iso/isostandard.rnc
|
295
294
|
- lib/asciidoctor/iso/isostandard.rng
|
296
|
-
- lib/asciidoctor/iso/macros.rb
|
297
295
|
- lib/asciidoctor/iso/reqt.rng
|
298
296
|
- lib/asciidoctor/iso/section.rb
|
299
|
-
- lib/asciidoctor/iso/term_lookup_cleanup.rb
|
300
297
|
- lib/asciidoctor/iso/validate.rb
|
301
298
|
- lib/asciidoctor/iso/validate_requirements.rb
|
302
299
|
- lib/asciidoctor/iso/validate_section.rb
|
@@ -346,7 +343,6 @@ files:
|
|
346
343
|
- spec/asciidoctor-iso/cleanup_spec.rb
|
347
344
|
- spec/asciidoctor-iso/inline_spec.rb
|
348
345
|
- spec/asciidoctor-iso/lists_spec.rb
|
349
|
-
- spec/asciidoctor-iso/macros_spec.rb
|
350
346
|
- spec/asciidoctor-iso/refs_spec.rb
|
351
347
|
- spec/asciidoctor-iso/section_spec.rb
|
352
348
|
- spec/asciidoctor-iso/table_spec.rb
|
data/.github/workflows/macos.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: macos
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/ubuntu.yml
|
11
|
-
- .github/workflows/windows.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-macos:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
16
|
-
runs-on: macos-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Update gems
|
33
|
-
run: |
|
34
|
-
sudo gem install bundler --force
|
35
|
-
bundle install --jobs 4 --retry 3
|
36
|
-
- name: Install PlantUML
|
37
|
-
run: |
|
38
|
-
brew install plantuml
|
39
|
-
- name: Run specs
|
40
|
-
run: |
|
41
|
-
bundle exec rake
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: ubuntu
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/macos.yml
|
11
|
-
- .github/workflows/windows.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-linux:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
16
|
-
runs-on: ubuntu-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Update gems
|
33
|
-
run: |
|
34
|
-
gem install bundler
|
35
|
-
bundle install --jobs 4 --retry 3
|
36
|
-
- name: Install PlantUML
|
37
|
-
uses: nick-invision/retry@v1
|
38
|
-
with:
|
39
|
-
polling_interval_seconds: 5
|
40
|
-
timeout_minutes: 5
|
41
|
-
max_attempts: 3
|
42
|
-
command: sudo apt-get update -y && sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
43
|
-
- name: Run specs
|
44
|
-
run: |
|
45
|
-
bundle exec rake
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: windows
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/macos.yml
|
11
|
-
- .github/workflows/ubuntu.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-windows:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
16
|
-
runs-on: windows-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Update gems
|
33
|
-
shell: pwsh
|
34
|
-
run: |
|
35
|
-
gem install bundler
|
36
|
-
bundle config --local path vendor/bundle
|
37
|
-
bundle install --jobs 4 --retry 3
|
38
|
-
- name: Install PlantUML
|
39
|
-
run: |
|
40
|
-
cinst -y plantuml
|
41
|
-
- name: Run specs
|
42
|
-
run: |
|
43
|
-
bundle exec rake
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'asciidoctor/extensions'
|
4
|
-
|
5
|
-
module Asciidoctor
|
6
|
-
module Iso
|
7
|
-
# Macro to transform `term[X,Y]` into em, termxref xml
|
8
|
-
class TermRefInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
9
|
-
use_dsl
|
10
|
-
|
11
|
-
named :term
|
12
|
-
name_positional_attributes 'name', 'termxref'
|
13
|
-
using_format :short
|
14
|
-
|
15
|
-
def process(_parent, _target, attrs)
|
16
|
-
termref = attrs['termxref'] || attrs['name']
|
17
|
-
"<em>#{attrs['name']}</em> (<termxref>#{termref}</termxref>)"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true.
|
2
|
-
|
3
|
-
module Asciidoctor
|
4
|
-
module ISO
|
5
|
-
# Intelligent term lookup xml modifier
|
6
|
-
# Lookup all `term` and `calause` tags and replace `termxref` tags with
|
7
|
-
# `xref`:target tag
|
8
|
-
class TermLookupCleanup
|
9
|
-
AUTOMATIC_GENERATED_ID_REGEXP = /\A_/
|
10
|
-
EXISTING_TERM_REGEXP = /\Aterm-/
|
11
|
-
|
12
|
-
attr_reader :xmldoc, :termlookup, :log
|
13
|
-
|
14
|
-
def initialize(xmldoc, log)
|
15
|
-
@xmldoc = xmldoc
|
16
|
-
@log = log
|
17
|
-
@termlookup = {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def call
|
21
|
-
@termlookup = replace_automatic_generated_ids_terms
|
22
|
-
set_termxref_tags_target
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def set_termxref_tags_target
|
28
|
-
xmldoc.xpath('//termxref').each do |node|
|
29
|
-
target = normalize_ref_id(node.text)
|
30
|
-
if termlookup[target].nil?
|
31
|
-
remove_missing_ref(node, target)
|
32
|
-
next
|
33
|
-
end
|
34
|
-
modify_ref_node(node, target)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def remove_missing_ref(node, target)
|
39
|
-
log.add('AsciiDoc Input', node,
|
40
|
-
%(Error: Term reference in `term[#{target}]` missing: \
|
41
|
-
"#{target}" is not defined in document))
|
42
|
-
term_name_node = node.previous.previous
|
43
|
-
term_name_node.remove
|
44
|
-
term_name_node.name = "strong"
|
45
|
-
term_name_node.children.first.content =
|
46
|
-
%(term "#{term_name_node.text}" not resolved)
|
47
|
-
node.add_previous_sibling(term_name_node)
|
48
|
-
node.remove
|
49
|
-
end
|
50
|
-
|
51
|
-
def modify_ref_node(node, target)
|
52
|
-
node.name = 'xref'
|
53
|
-
node['target'] = termlookup[target]
|
54
|
-
node.children.remove
|
55
|
-
node.remove_attribute('defaultref')
|
56
|
-
end
|
57
|
-
|
58
|
-
def replace_automatic_generated_ids_terms
|
59
|
-
xmldoc.xpath('//term').each.with_object({}) do |term_node, res|
|
60
|
-
normalize_id_and_memorize(term_node, res, './preferred')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def normalize_id_and_memorize(term_node, res_table, text_selector)
|
65
|
-
term_text = normalize_ref_id(term_node.at(text_selector).text)
|
66
|
-
unless AUTOMATIC_GENERATED_ID_REGEXP.match(term_node['id']).nil?
|
67
|
-
term_node['id'] = unique_text_id(term_text)
|
68
|
-
end
|
69
|
-
res_table[term_text] = term_node['id']
|
70
|
-
end
|
71
|
-
|
72
|
-
def normalize_ref_id(text)
|
73
|
-
text.downcase.gsub(/[[:space:]]/, '-')
|
74
|
-
end
|
75
|
-
|
76
|
-
def unique_text_id(text)
|
77
|
-
return "term-#{text}" if xmldoc.at("//*[@id = 'term-#{text}']").nil?
|
78
|
-
(1..Float::INFINITY).lazy.each do |index|
|
79
|
-
if xmldoc.at("//*[@id = 'term-#{text}-#{index}']").nil?
|
80
|
-
break("term-#{text}-#{index}")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|