metanorma-itu 1.0.11 → 1.0.12
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 +2 -3
- data/.github/workflows/ubuntu.yml +15 -4
- data/.github/workflows/windows.yml +3 -4
- data/README.adoc +9 -49
- data/lib/asciidoctor/itu/biblio.rng +2 -12
- data/lib/asciidoctor/itu/cleanup.rb +10 -7
- data/lib/asciidoctor/itu/converter.rb +1 -1
- data/lib/asciidoctor/itu/isodoc.rng +1 -3
- data/lib/isodoc/itu/base_convert.rb +2 -2
- data/lib/isodoc/itu/html/word_itu_titlepage.html +1 -1
- data/lib/isodoc/itu/metadata.rb +3 -25
- data/lib/isodoc/itu/ref.rb +14 -10
- data/lib/metanorma/itu/version.rb +1 -1
- 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: 37546876b8125697954fc7ff980c07cf756aae329566249a31c9ea51fa48ec6a
|
4
|
+
data.tar.gz: 5ce41dcc79d10901912a44bbaa7bdb0ed8da9cd1f1bf7a23d5e8d336fbe0f183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dadba1953785697e5f6f49ec05696b86c3ceeaca9c437dcd6804f8270d6ebc37cab2926ec9a961232ed727af30cca7691a1799c8c8389f4245611684b6fd5d41
|
7
|
+
data.tar.gz: 7b7bd5a5024cbd4b81a4dd52556bd50a0c4583394b97e3b01b159e98338a3c85748e9d238278b9b38a7501b2fff1a64fe7653ead1ff1755f86b11e3625d1b2b8
|
data/.github/workflows/macos.yml
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: macos
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
test-macos:
|
@@ -1,12 +1,11 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: ubuntu
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
test-linux:
|
@@ -25,7 +24,7 @@ jobs:
|
|
25
24
|
architecture: 'x64'
|
26
25
|
- name: Update gems
|
27
26
|
run: |
|
28
|
-
gem install bundler
|
27
|
+
gem install bundler
|
29
28
|
bundle install --jobs 4 --retry 3
|
30
29
|
- name: Use Node
|
31
30
|
uses: actions/setup-node@v1
|
@@ -37,3 +36,15 @@ jobs:
|
|
37
36
|
- name: Run specs
|
38
37
|
run: |
|
39
38
|
bundle exec rake
|
39
|
+
- name: Trigger dependent repositories
|
40
|
+
if: github.ref == 'refs/heads/master'
|
41
|
+
env:
|
42
|
+
GH_USERNAME: ${{ secrets.PAT_USERNAME }}
|
43
|
+
GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
|
44
|
+
run: |
|
45
|
+
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
46
|
+
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
47
|
+
for repo in $DEPENDENT_REPOS
|
48
|
+
do
|
49
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
|
50
|
+
done
|
@@ -1,12 +1,11 @@
|
|
1
|
-
# Auto-generated
|
2
|
-
#
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
3
|
name: windows
|
4
4
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
test-windows:
|
@@ -26,7 +25,7 @@ jobs:
|
|
26
25
|
- name: Update gems
|
27
26
|
shell: pwsh
|
28
27
|
run: |
|
29
|
-
gem install bundler
|
28
|
+
gem install bundler
|
30
29
|
bundle config --local path vendor/bundle
|
31
30
|
bundle update
|
32
31
|
bundle install --jobs 4 --retry 3
|
data/README.adoc
CHANGED
@@ -1,64 +1,24 @@
|
|
1
|
-
= metanorma-itu:
|
1
|
+
= metanorma-itu: Metanorma for ITU
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma-itu.svg["Gem Version", link="https://rubygems.org/gems/metanorma-itu"]
|
4
|
-
image:https://
|
5
|
-
image:https://
|
4
|
+
image:https://github.com/metanorma/metanorma-itu/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=macos"]
|
5
|
+
image:https://github.com/metanorma/metanorma-itu/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=ubuntu"]
|
6
|
+
image:https://github.com/metanorma/metanorma-itu/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-itu/actions?workflow=windows"]
|
6
7
|
image:https://codeclimate.com/github/metanorma/metanorma-itu/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-itu"]
|
7
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-itu.svg["Pull Requests", link="https://github.com/metanorma/metanorma-itu/pulls"]
|
8
9
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-itu/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-itu/releases"]
|
9
10
|
|
10
11
|
== Functionality
|
11
12
|
|
12
|
-
This gem processes
|
13
|
-
a template for generating ITU documents.
|
13
|
+
This gem processes Metanorma input for generating ITU (ITU-T, ITU-D) documents.
|
14
14
|
|
15
|
-
The
|
16
|
-
gem, and aligns closely to it. Refer to the ISO gem documentation
|
17
|
-
for guidance, including https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring
|
18
|
-
|
19
|
-
The following outputs are generated.
|
20
|
-
|
21
|
-
* an XML representation of the document, intended as a document model for ITU documents.
|
22
|
-
* The XML representation is processed in turn to generate the following outputs
|
23
|
-
as end deliverable ITU documents.
|
24
|
-
** HTML
|
25
|
-
** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
|
26
|
-
The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
|
27
|
-
which is syntactically stricter than the common MathJax processor;
|
28
|
-
if you do not get expected results, try bracketing terms your in AsciiMathML
|
29
|
-
expressions.
|
15
|
+
The implementation inherits from https://github.com/metanorma/metanorma-standoc.
|
30
16
|
|
31
17
|
== Usage
|
32
18
|
|
33
|
-
|
34
|
-
|
35
|
-
[source,console]
|
36
|
-
----
|
37
|
-
$ metanorma --type itu a.adoc # output HTML
|
38
|
-
$ metanorma --type itu --extensions html a.adoc # output just HTML
|
39
|
-
$ metanorma --type itu --extensions xml a.adoc # output RSD XML
|
40
|
-
----
|
41
|
-
|
42
|
-
The gem translates the document into Metanorma XML format, and then
|
43
|
-
validates its output against the Metanorma XML document model; errors are
|
44
|
-
reported to console against the XML, and are intended for users to
|
45
|
-
check that they have provided all necessary components of the
|
46
|
-
document.
|
47
|
-
|
48
|
-
The gem then converts the XML into HTML.
|
49
|
-
|
50
|
-
=== Installation
|
51
|
-
|
52
|
-
If you are using a Mac, the https://github.com/metanorma/metanorma-macos-setup
|
53
|
-
repository has instructions on setting up your machine to run Metanorma
|
54
|
-
scripts such as this one. You need only run the following in a Terminal console:
|
19
|
+
== Usage and installation
|
55
20
|
|
56
|
-
|
57
|
-
----
|
58
|
-
$ bash <(curl -s https://raw.githubusercontent.com/metanorma/metanorma-macos-setup/master/metanorma-setup)
|
59
|
-
$ gem install metanorma-acme
|
60
|
-
$ gem install metanorma-cli
|
61
|
-
----
|
21
|
+
See https://www.metanorma.com.
|
62
22
|
|
63
23
|
== Documentation
|
64
24
|
|
@@ -66,6 +26,6 @@ See https://www.metanorma.com/author/itu/[Write ITU-T documents with Metanorma].
|
|
66
26
|
|
67
27
|
== Examples
|
68
28
|
|
69
|
-
* Example documents are
|
29
|
+
* Example documents are available at the https://github.com/metanorma/mn-samples-itu[mn-samples-itu] repository.
|
70
30
|
* Document templates are available at the https://github.com/metanorma/mn-templates-itu[mn-templates-itu] repository.
|
71
31
|
|
@@ -703,21 +703,11 @@
|
|
703
703
|
</define>
|
704
704
|
<define name="TypedTitleString">
|
705
705
|
<optional>
|
706
|
-
<attribute name="type"
|
707
|
-
<ref name="TitleType"/>
|
708
|
-
</attribute>
|
706
|
+
<attribute name="type"/>
|
709
707
|
</optional>
|
710
708
|
<ref name="FormattedString"/>
|
711
709
|
</define>
|
712
|
-
|
713
|
-
<choice>
|
714
|
-
<value>alternative</value>
|
715
|
-
<value>original</value>
|
716
|
-
<value>unofficial</value>
|
717
|
-
<value>subtitle</value>
|
718
|
-
<value>main</value>
|
719
|
-
</choice>
|
720
|
-
</define>
|
710
|
+
<!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
|
721
711
|
<define name="TypedUri">
|
722
712
|
<optional>
|
723
713
|
<attribute name="type"/>
|
@@ -30,7 +30,7 @@ module Asciidoctor
|
|
30
30
|
x.at("./*/preface | ./*/boilerplate | ./*/bibdata").next =
|
31
31
|
"<sections><sentinel/></sections>"
|
32
32
|
x.at("./*/sections/*") or x.at("./*/sections") << "<sentinel/>"
|
33
|
-
ins = x.at("//sections").
|
33
|
+
ins = x.at("//sections").elements.first
|
34
34
|
unless x.at("//sections/clause/title[text() = 'Scope']")
|
35
35
|
ins.previous = "<clause><title>Scope</title><p>"\
|
36
36
|
"#{@labels['clause_empty']}</p></clause>"
|
@@ -39,9 +39,10 @@ module Asciidoctor
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def insert_norm_ref(x)
|
42
|
-
x.at("//bibliography") or
|
42
|
+
x.at("//bibliography") or
|
43
|
+
x.at("./*/annex[last()] | ./*/sections").next =
|
43
44
|
"<bibliography><sentinel/></bibliography>"
|
44
|
-
ins = x.at("//bibliography").
|
45
|
+
ins = x.at("//bibliography").elements.first
|
45
46
|
unless x.at("//bibliography/references/title[text() = 'References']")
|
46
47
|
ins.previous = "<references><title>References</title><p>"\
|
47
48
|
"#{@labels['clause_empty']}</p></references>"
|
@@ -50,15 +51,16 @@ module Asciidoctor
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def insert_terms(x)
|
53
|
-
ins = x.at("//sections/clause/title[text() = 'Scope']")
|
54
|
-
unless x.at("//sections
|
54
|
+
ins = x.at("//sections/clause/title[text() = 'Scope']/..")
|
55
|
+
unless x.at("//sections//terms")
|
55
56
|
ins.next = "<terms><title>Definitions</title><p>"\
|
56
57
|
"#{@labels['clause_empty']}</p></terms>"
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
61
|
def insert_symbols(x)
|
61
|
-
ins = x.at("//terms")
|
62
|
+
ins = x.at("//sections/terms") ||
|
63
|
+
x.at("//sections/clause[descendant::terms]")
|
62
64
|
unless x.at("//sections//definitions")
|
63
65
|
ins.next = "<definitions><title>Definitions</title><p>"\
|
64
66
|
"#{@labels['clause_empty']}</p></definitions>"
|
@@ -66,7 +68,8 @@ module Asciidoctor
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def insert_conventions(x)
|
69
|
-
ins = x.at("//sections//definitions")
|
71
|
+
ins = x.at("//sections//definitions") ||
|
72
|
+
x.at("//sections/clause[descendant::definitions]")
|
70
73
|
unless x.at("//sections/clause/title[text() = 'Conventions']")
|
71
74
|
ins.next = "<clause><title>Conventions</title><p>"\
|
72
75
|
"#{@labels['clause_empty']}</p></clause>"
|
@@ -65,7 +65,7 @@ module Asciidoctor
|
|
65
65
|
word_converter(node).convert filename unless node.attr("nodoc")
|
66
66
|
pdf_converter(node).convert filename unless node.attr("nodoc")
|
67
67
|
end
|
68
|
-
@log.write(@filename + ".err") unless @novalid
|
68
|
+
@log.write(@localdir + @filename + ".err") unless @novalid
|
69
69
|
@files_to_delete.each { |f| FileUtils.rm f }
|
70
70
|
ret
|
71
71
|
end
|
@@ -139,7 +139,7 @@ module IsoDoc
|
|
139
139
|
|
140
140
|
def middle_title(out)
|
141
141
|
out.p(**{ class: "zzSTDTitle1" }) do |p|
|
142
|
-
id = @meta.get[:
|
142
|
+
id = @meta.get[:docnumber] and p << "Recommendation #{id}"
|
143
143
|
end
|
144
144
|
out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
|
145
145
|
end
|
@@ -186,7 +186,7 @@ module IsoDoc
|
|
186
186
|
|
187
187
|
def table_footnote_reference_format(a)
|
188
188
|
a.content = a.content + ")"
|
189
|
-
|
189
|
+
end
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
@@ -267,7 +267,7 @@ _Hlk526346232'><span lang="EN-US" style='font-size:9.0pt;mso-bidi-font-size:10.0
|
|
267
267
|
font-family:"Arial",sans-serif;mso-bidi-font-family:"Times New Roman";
|
268
268
|
mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-no-proof:yes'><v:shape
|
269
269
|
id="Picture_x0020_1" o:spid="_x0000_i1033" type="#_x0000_t75" alt="logo_E"
|
270
|
-
style='width:
|
270
|
+
style='width:68pt;height:75pt;visibility:visible;mso-wrap-style:square'>
|
271
271
|
<v:imagedata src="{{ logo_word }}" o:title="logo_E"/>
|
272
272
|
</v:shape></span></span><span style='mso-bookmark:_Hlk526346232'><span
|
273
273
|
lang="EN-US" style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
|
data/lib/isodoc/itu/metadata.rb
CHANGED
@@ -8,11 +8,9 @@ module IsoDoc
|
|
8
8
|
super
|
9
9
|
here = File.dirname(__FILE__)
|
10
10
|
set(:logo_html,
|
11
|
-
#File.expand_path(File.join(here, "html", "Logo_ITU.jpg")))
|
12
11
|
File.expand_path(File.join(here, "html", "International_Telecommunication_Union_Logo.svg")))
|
13
12
|
set(:logo_comb,
|
14
13
|
File.expand_path(File.join(here, "html", "itu-document-comb.png")))
|
15
|
-
#set(:logo_word, File.expand_path(File.join(here, "html", "logo.png")))
|
16
14
|
set(:logo_word, File.expand_path(File.join(here, "html", "International_Telecommunication_Union_Logo.svg")))
|
17
15
|
end
|
18
16
|
|
@@ -40,11 +38,12 @@ module IsoDoc
|
|
40
38
|
set(:bureau, bureau.text) if bureau
|
41
39
|
tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
|
42
40
|
set(:tc, tc.text) if tc
|
41
|
+
super
|
43
42
|
end
|
44
43
|
|
45
44
|
def docid(isoxml, _out)
|
46
|
-
dn = isoxml.at(ns("//bibdata/docidentifier"))
|
47
|
-
set(:
|
45
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ITU']"))
|
46
|
+
set(:docnumber, dn&.text)
|
48
47
|
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
|
49
48
|
oblig = isoxml&.at(ns("//annex/@obligation"))&.text
|
50
49
|
lbl = oblig == "informative" ? @labels["appendix"] : @labels["annex"]
|
@@ -55,27 +54,6 @@ module IsoDoc
|
|
55
54
|
%w(in-force-prepublished draft).include? status.downcase
|
56
55
|
end
|
57
56
|
|
58
|
-
def version(isoxml, _out)
|
59
|
-
super
|
60
|
-
revdate = get[:revdate]
|
61
|
-
set(:revdate_monthyear, monthyr(revdate))
|
62
|
-
end
|
63
|
-
|
64
|
-
MONTHS = {
|
65
|
-
"01": "January",
|
66
|
-
"02": "February",
|
67
|
-
"03": "March",
|
68
|
-
"04": "April",
|
69
|
-
"05": "May",
|
70
|
-
"06": "June",
|
71
|
-
"07": "July",
|
72
|
-
"08": "August",
|
73
|
-
"09": "September",
|
74
|
-
"10": "October",
|
75
|
-
"11": "November",
|
76
|
-
"12": "December",
|
77
|
-
}.freeze
|
78
|
-
|
79
57
|
def bibdate(isoxml, _out)
|
80
58
|
pubdate = isoxml.xpath(ns("//bibdata/date[@type = 'published']"))
|
81
59
|
pubdate and set(:pubdate_monthyear, monthyr(pubdate.text))
|
data/lib/isodoc/itu/ref.rb
CHANGED
@@ -38,11 +38,13 @@ module IsoDoc
|
|
38
38
|
s.gsub(/ |\_|\-/, " ").split(/ /).map(&:capitalize).join(" ")
|
39
39
|
end
|
40
40
|
|
41
|
+
IGNORE_IDS =
|
42
|
+
"@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor'".freeze
|
43
|
+
|
41
44
|
def bibitem_ref_code(b)
|
42
45
|
id = b.at(ns("./docidentifier[@type = 'metanorma']"))
|
43
46
|
id ||= b.at(ns("./docidentifier[@type = 'ITU']"))
|
44
|
-
id ||= b.at(ns("./docidentifier[not(
|
45
|
-
"@type = 'ISBN')]"))
|
47
|
+
id ||= b.at(ns("./docidentifier[not(#{IGNORE_IDS})]"))
|
46
48
|
id ||= b.at(ns("./docidentifier"))
|
47
49
|
return id if id
|
48
50
|
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
@@ -51,12 +53,9 @@ module IsoDoc
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def multi_bibitem_ref_code(b)
|
54
|
-
id = b.xpath(ns("./docidentifier[not(@type = '
|
55
|
-
|
56
|
-
id.empty?
|
57
|
-
"@type = 'ISSN' or @type = 'ISBN')]"))
|
58
|
-
id.empty? and id = b.xpath(ns("./docidentifier"))
|
59
|
-
return ["(NO ID)"] if id.empty?
|
56
|
+
id = b.xpath(ns("./docidentifier[not(@type = 'metanorma' or #{IGNORE_IDS})]"))
|
57
|
+
id.empty? and id = b.xpath(ns("./docidentifier[not(@type = 'metanorma')]"))
|
58
|
+
return [] if id.empty?
|
60
59
|
id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
|
61
60
|
end
|
62
61
|
|
@@ -79,10 +78,11 @@ module IsoDoc
|
|
79
78
|
|
80
79
|
def reference_format_start(b, r)
|
81
80
|
id = multi_bibitem_ref_code(b)
|
82
|
-
|
81
|
+
id1 = render_identifiers(id)
|
82
|
+
r << id1
|
83
83
|
date = b.at(ns("./date[@type = 'published']")) and
|
84
84
|
r << " (#{date.text.sub(/-.*$/, '')})"
|
85
|
-
r << ", "
|
85
|
+
r << ", " if (date || !id1.empty?)
|
86
86
|
end
|
87
87
|
|
88
88
|
def reference_format_title(b, r)
|
@@ -96,6 +96,10 @@ module IsoDoc
|
|
96
96
|
/\.$/.match(title&.text) or r << "."
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
def format_ref(ref, prefix, isopub, date, allparts)
|
101
|
+
docid_prefix(prefix, ref).sub(/^\[/, "").sub(/\]$/, "")
|
102
|
+
end
|
99
103
|
end
|
100
104
|
end
|
101
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-itu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|