metanorma-iso 1.9.4 → 1.10.1
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/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/basicdoc.rng +32 -5
- data/lib/asciidoctor/iso/biblio.rng +2 -0
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +9 -1
- data/lib/asciidoctor/iso/isodoc.rng +430 -76
- data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
- data/lib/asciidoctor/iso/isostandard.rng +9 -23
- data/lib/asciidoctor/iso/reqt.rng +24 -3
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +1 -2
- data/lib/isodoc/iso/html/isodoc.scss +1 -1
- data/lib/isodoc/iso/html/wordstyle.css +16 -4
- data/lib/isodoc/iso/html/wordstyle.scss +16 -4
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +200 -20
- data/lib/isodoc/iso/iso.international-standard.xsl +200 -20
- data/lib/isodoc/iso/presentation_xml_convert.rb +9 -10
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -3
- data/spec/asciidoctor/base_spec.rb +685 -178
- data/spec/asciidoctor/blank_spec.rb +38 -0
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +34 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +87 -4
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +29 -15
- data/spec/isodoc/inline_spec.rb +56 -26
- data/spec/isodoc/section_spec.rb +1 -1
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +11 -11
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +4 -1
- data/spec/spec_helper.rb +14 -1
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +38 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24633dfc813afd54d496d125ac4cc7ffdb4e11b9a2958437033c0cfe57ea7873
|
4
|
+
data.tar.gz: b3995300f75025e162a31b28aa2aea9ebfdb3fd791928d622ee9fea264948a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d495eb4e4758f85053f888027b8776048ed4e1c2f1c0ee5f87a5dda4214fcfe85d2d490947633a8889cf9aa8db48dcd42eb319e1ae63abb5cf3901fec9cb789
|
7
|
+
data.tar.gz: c4472ab5da3868ccf1331e6ff1879218a5e5e515128f3733d1ef32dcc8b4fec5b5855d5712c03ac950c67b4a7e0ccdf452da1b4fba9c6f61907b9ed40b0867e3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: ubuntu
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
|
15
|
+
- name: Setup prerequisites
|
16
|
+
run: |
|
17
|
+
sudo apt-get update
|
18
|
+
sudo apt-get -y install xsltproc
|
19
|
+
|
20
|
+
- run: make xsd_doc
|
21
|
+
env:
|
22
|
+
GITHUB_USERNAME: ${{ github.actor }}
|
23
|
+
GITHUB_TOKEN: ${{ github.token }}
|
24
|
+
|
25
|
+
- uses: actions/upload-artifact@master
|
26
|
+
with:
|
27
|
+
name: xsd_doc
|
28
|
+
path: xsd_doc
|
29
|
+
|
30
|
+
deploy-gh-pages:
|
31
|
+
if: github.ref == 'refs/heads/main'
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
needs: build
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@master
|
36
|
+
|
37
|
+
- uses: actions/download-artifact@master
|
38
|
+
with:
|
39
|
+
name: xsd_doc-ubuntu
|
40
|
+
path: xsd_doc
|
41
|
+
|
data/Gemfile
CHANGED
@@ -4,11 +4,10 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
6
6
|
|
7
|
-
#gem "asciimath", git: "https://github.com/asciidoctor/asciimath"
|
7
|
+
# gem "asciimath", git: "https://github.com/asciidoctor/asciimath"
|
8
8
|
|
9
9
|
gemspec
|
10
10
|
|
11
|
-
if File.exist?
|
12
|
-
eval File.read(
|
11
|
+
if File.exist? "Gemfile.devel"
|
12
|
+
eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
|
13
13
|
end
|
14
|
-
|
data/Makefile
CHANGED
@@ -8,6 +8,15 @@ SHELL := /bin/bash
|
|
8
8
|
# Ensure the xml2rfc cache directory exists locally
|
9
9
|
IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc)
|
10
10
|
|
11
|
+
TRANG_RELEASE := https://github.com/relaxng/jing-trang/releases/download/V20181222/trang-20181222.zip
|
12
|
+
TOOLS_DIR := ${CURDIR}/tools
|
13
|
+
TRANG_JAR := $(TOOLS_DIR)/trang.jar
|
14
|
+
XSDVIPATH := $(TOOLS_DIR)/xsdvi.jar
|
15
|
+
XSLT_FILE := $(TOOLS_DIR)/xs3pxsl
|
16
|
+
XSLT_FILE_MERGE := $(TOOLS_DIR)/xsdmerge.xsl
|
17
|
+
RNG_FILE_SRC := lib/asciidoctor/iso/isostandard.rng
|
18
|
+
XSD_FILE_DEST := ${CURDIR}/xsd_doc/isostandard.xsd
|
19
|
+
|
11
20
|
all: $(TXT) $(HTML) $(XML) $(NITS)
|
12
21
|
|
13
22
|
clean:
|
@@ -37,3 +46,38 @@ clean:
|
|
37
46
|
open:
|
38
47
|
open *.txt
|
39
48
|
|
49
|
+
|
50
|
+
$(XSDVIPATH):
|
51
|
+
mkdir -p $(dir $@); \
|
52
|
+
curl -sSL https://sourceforge.net/projects/xsdvi/files/latest/download > $(dir $@)/xsdvi.zip; \
|
53
|
+
unzip -p $(dir $@)/xsdvi.zip dist/lib/xercesImpl.jar > $(dir $@)/xercesImpl.jar; \
|
54
|
+
curl -sSL https://github.com/metanorma/xsdvi/releases/download/v1.0/xsdvi-1.0.jar > $@
|
55
|
+
|
56
|
+
$(XSLT_FILE):
|
57
|
+
mkdir -p $(dir $@)
|
58
|
+
curl -sSL https://raw.githubusercontent.com/metanorma/xs3p/main/xsl/xs3p.xsl > $@
|
59
|
+
|
60
|
+
$(XSLT_FILE_MERGE):
|
61
|
+
mkdir -p $(dir $@)
|
62
|
+
curl -sSL https://raw.githubusercontent.com/metanorma/xs3p/main/xsl/xsdmerge.xsl > $@
|
63
|
+
|
64
|
+
$(TRANG_JAR):
|
65
|
+
mkdir -p $(dir $@); \
|
66
|
+
cd $(dir $@); \
|
67
|
+
curl -sSL $(TRANG_RELEASE) > trang.zip; \
|
68
|
+
unzip -p trang.zip trang-20181222/trang.jar > $@
|
69
|
+
|
70
|
+
|
71
|
+
$(XSD_FILE_DEST): $(TRANG_JAR)
|
72
|
+
mkdir -p $(dir $@); \
|
73
|
+
java -jar $< $(RNG_FILE_SRC) $@
|
74
|
+
|
75
|
+
xsd_doc: $(XSD_FILE_DEST) $(XSDVIPATH) $(XSLT_FILE) $(XSLT_FILE_MERGE)
|
76
|
+
mkdir -p $@/diagrams; \
|
77
|
+
cd $@; \
|
78
|
+
java -jar $(XSDVIPATH) $< -rootNodeName all -oneNodeOnly -outputPath diagrams; \
|
79
|
+
xsltproc --nonet --stringparam rootxsd iso-standard --output $@.tmp $(XSLT_FILE_MERGE) $<;\
|
80
|
+
xsltproc --nonet --param title "'Metanorma XML Schema Documentation, ISO Standard'" \
|
81
|
+
--output index.html $(XSLT_FILE) $@.tmp;\
|
82
|
+
rm $@.tmp
|
83
|
+
|
data/Rakefile
CHANGED
data/bin/rspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
3
|
<include href="biblio.rng">
|
4
4
|
<start>
|
5
5
|
<ref name="document"/>
|
@@ -19,6 +19,7 @@
|
|
19
19
|
</define>
|
20
20
|
<define name="bibdata">
|
21
21
|
<element name="bibdata">
|
22
|
+
<a:documentation>Document attributes</a:documentation>
|
22
23
|
<ref name="BibData"/>
|
23
24
|
</element>
|
24
25
|
</define>
|
@@ -104,10 +105,12 @@
|
|
104
105
|
</define>
|
105
106
|
<define name="paragraph">
|
106
107
|
<element name="p">
|
108
|
+
<a:documentation>Paragraph</a:documentation>
|
107
109
|
<ref name="ParagraphType"/>
|
108
110
|
</element>
|
109
111
|
</define>
|
110
112
|
<define name="Alignments">
|
113
|
+
<a:documentation>Text alignment</a:documentation>
|
111
114
|
<choice>
|
112
115
|
<value>left</value>
|
113
116
|
<value>right</value>
|
@@ -215,6 +218,7 @@
|
|
215
218
|
</define>
|
216
219
|
<define name="quote">
|
217
220
|
<element name="quote">
|
221
|
+
<a:documentation>Block quotes</a:documentation>
|
218
222
|
<attribute name="id">
|
219
223
|
<data type="ID"/>
|
220
224
|
</attribute>
|
@@ -249,6 +253,7 @@
|
|
249
253
|
</define>
|
250
254
|
<define name="sourcecode">
|
251
255
|
<element name="sourcecode">
|
256
|
+
<a:documentation>Source code, a pre-formatted source snippet to be rendered in monospace font, and with spaces preserved</a:documentation>
|
252
257
|
<attribute name="id">
|
253
258
|
<data type="ID"/>
|
254
259
|
</attribute>
|
@@ -624,6 +629,9 @@
|
|
624
629
|
<choice>
|
625
630
|
<ref name="PureTextElement"/>
|
626
631
|
<ref name="stem"/>
|
632
|
+
<ref name="eref"/>
|
633
|
+
<ref name="xref"/>
|
634
|
+
<ref name="hyperlink"/>
|
627
635
|
</choice>
|
628
636
|
</zeroOrMore>
|
629
637
|
</element>
|
@@ -634,6 +642,9 @@
|
|
634
642
|
<choice>
|
635
643
|
<ref name="PureTextElement"/>
|
636
644
|
<ref name="stem"/>
|
645
|
+
<ref name="eref"/>
|
646
|
+
<ref name="xref"/>
|
647
|
+
<ref name="hyperlink"/>
|
637
648
|
</choice>
|
638
649
|
</zeroOrMore>
|
639
650
|
</element>
|
@@ -641,7 +652,12 @@
|
|
641
652
|
<define name="tt">
|
642
653
|
<element name="tt">
|
643
654
|
<zeroOrMore>
|
644
|
-
<
|
655
|
+
<choice>
|
656
|
+
<ref name="PureTextElement"/>
|
657
|
+
<ref name="eref"/>
|
658
|
+
<ref name="xref"/>
|
659
|
+
<ref name="hyperlink"/>
|
660
|
+
</choice>
|
645
661
|
</zeroOrMore>
|
646
662
|
</element>
|
647
663
|
</define>
|
@@ -822,7 +838,9 @@
|
|
822
838
|
<attribute name="alt"/>
|
823
839
|
</optional>
|
824
840
|
<ref name="CitationType"/>
|
825
|
-
<
|
841
|
+
<oneOrMore>
|
842
|
+
<ref name="PureTextElement"/>
|
843
|
+
</oneOrMore>
|
826
844
|
</define>
|
827
845
|
<define name="hyperlink">
|
828
846
|
<element name="link">
|
@@ -835,7 +853,9 @@
|
|
835
853
|
<optional>
|
836
854
|
<attribute name="alt"/>
|
837
855
|
</optional>
|
838
|
-
<
|
856
|
+
<oneOrMore>
|
857
|
+
<ref name="PureTextElement"/>
|
858
|
+
</oneOrMore>
|
839
859
|
</element>
|
840
860
|
</define>
|
841
861
|
<define name="xref">
|
@@ -849,7 +869,9 @@
|
|
849
869
|
<optional>
|
850
870
|
<attribute name="alt"/>
|
851
871
|
</optional>
|
852
|
-
<
|
872
|
+
<oneOrMore>
|
873
|
+
<ref name="PureTextElement"/>
|
874
|
+
</oneOrMore>
|
853
875
|
</element>
|
854
876
|
</define>
|
855
877
|
<define name="fn">
|
@@ -1030,6 +1052,7 @@
|
|
1030
1052
|
</define>
|
1031
1053
|
<define name="ul">
|
1032
1054
|
<element name="ul">
|
1055
|
+
<a:documentation>Unordered list</a:documentation>
|
1033
1056
|
<attribute name="id">
|
1034
1057
|
<data type="ID"/>
|
1035
1058
|
</attribute>
|
@@ -1043,6 +1066,7 @@
|
|
1043
1066
|
</define>
|
1044
1067
|
<define name="li">
|
1045
1068
|
<element name="li">
|
1069
|
+
<a:documentation>List item</a:documentation>
|
1046
1070
|
<optional>
|
1047
1071
|
<attribute name="id">
|
1048
1072
|
<data type="ID"/>
|
@@ -1080,6 +1104,7 @@
|
|
1080
1104
|
</define>
|
1081
1105
|
<define name="dl">
|
1082
1106
|
<element name="dl">
|
1107
|
+
<a:documentation>Definition list</a:documentation>
|
1083
1108
|
<attribute name="id">
|
1084
1109
|
<data type="ID"/>
|
1085
1110
|
</attribute>
|
@@ -1094,6 +1119,7 @@
|
|
1094
1119
|
</define>
|
1095
1120
|
<define name="dt">
|
1096
1121
|
<element name="dt">
|
1122
|
+
<a:documentation>Definition term</a:documentation>
|
1097
1123
|
<zeroOrMore>
|
1098
1124
|
<ref name="TextElement"/>
|
1099
1125
|
</zeroOrMore>
|
@@ -1101,6 +1127,7 @@
|
|
1101
1127
|
</define>
|
1102
1128
|
<define name="dd">
|
1103
1129
|
<element name="dd">
|
1130
|
+
<a:documentation>Definition description</a:documentation>
|
1104
1131
|
<zeroOrMore>
|
1105
1132
|
<ref name="paragraph-with-footnote"/>
|
1106
1133
|
</zeroOrMore>
|
@@ -76,12 +76,14 @@
|
|
76
76
|
<define name="script">
|
77
77
|
<a:documentation>ISO-639</a:documentation>
|
78
78
|
<element name="script">
|
79
|
+
<a:documentation>ISO-639</a:documentation>
|
79
80
|
<text/>
|
80
81
|
</element>
|
81
82
|
</define>
|
82
83
|
<define name="edition">
|
83
84
|
<a:documentation>ISO-15924: Latn</a:documentation>
|
84
85
|
<element name="edition">
|
86
|
+
<a:documentation>ISO-15924: Latn</a:documentation>
|
85
87
|
<optional>
|
86
88
|
<attribute name="number"/>
|
87
89
|
</optional>
|
@@ -8,7 +8,7 @@ module Asciidoctor
|
|
8
8
|
module ISO
|
9
9
|
class Converter < Standoc::Converter
|
10
10
|
PRE_NORMREF_FOOTNOTES = "//preface//fn | "\
|
11
|
-
|
11
|
+
"//clause[@type = 'scope']//fn".freeze
|
12
12
|
|
13
13
|
NORMREF_FOOTNOTES =
|
14
14
|
"//references[@normative = 'true']//fn".freeze
|
@@ -41,7 +41,7 @@ module Asciidoctor
|
|
41
41
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']"\
|
42
42
|
"/organization").each do |x|
|
43
43
|
x1 = x.at("abbreviation")&.text || x.at("name")&.text
|
44
|
-
x1 == "ISO" and prefix.unshift("ISO") or prefix << x1
|
44
|
+
(x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
45
45
|
end
|
46
46
|
prefix
|
47
47
|
end
|
@@ -64,14 +64,15 @@ module Asciidoctor
|
|
64
64
|
super
|
65
65
|
end
|
66
66
|
|
67
|
-
TERM_CLAUSE =
|
67
|
+
TERM_CLAUSE =
|
68
|
+
"//sections//terms | "\
|
68
69
|
"//sections//clause[descendant::terms][not(descendant::definitions)]"
|
69
|
-
|
70
|
+
.freeze
|
70
71
|
|
71
72
|
PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
|
72
73
|
|
73
74
|
OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
|
74
|
-
|
75
|
+
"@type = 'ISBN'".freeze
|
75
76
|
|
76
77
|
def pub_class(bib)
|
77
78
|
return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
|
@@ -111,7 +112,7 @@ module Asciidoctor
|
|
111
112
|
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
|
112
113
|
"#{pubclass} :: #{type} :: "\
|
113
114
|
"#{num.nil? ? abbrid : sprintf('%09d', num.to_i)} :: "\
|
114
|
-
"#{partid} :: #{id&.text} :: #{title}"
|
115
|
+
"#{sprintf('%09d', partid.to_i)} :: #{id&.text} :: #{title}"
|
115
116
|
end
|
116
117
|
|
117
118
|
def sections_cleanup(xml)
|
@@ -116,7 +116,7 @@ module Asciidoctor
|
|
116
116
|
|
117
117
|
xml.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
|
118
118
|
t1 << Metanorma::Utils::asciidoc_sub(
|
119
|
-
node.attr("title-amendment-#{lang}")
|
119
|
+
node.attr("title-amendment-#{lang}"),
|
120
120
|
)
|
121
121
|
end
|
122
122
|
end
|
@@ -144,6 +144,14 @@ module Asciidoctor
|
|
144
144
|
title_amd(node, xml, lang, at) if @amd
|
145
145
|
end
|
146
146
|
end
|
147
|
+
|
148
|
+
def relaton_relations
|
149
|
+
super + %w(obsoletes)
|
150
|
+
end
|
151
|
+
|
152
|
+
def relaton_relation_descriptions
|
153
|
+
super.merge("amends" => "updates")
|
154
|
+
end
|
147
155
|
end
|
148
156
|
end
|
149
157
|
end
|