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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0b6bcda9ee8aa042d7647e9b8865c7bac5a07943541e6278ac311ae35b7ecdb
4
- data.tar.gz: 2c2916e7706336f89a13d65cd63022a0a2288a576957684856134f482ecfa7eb
3
+ metadata.gz: 37546876b8125697954fc7ff980c07cf756aae329566249a31c9ea51fa48ec6a
4
+ data.tar.gz: 5ce41dcc79d10901912a44bbaa7bdb0ed8da9cd1f1bf7a23d5e8d336fbe0f183
5
5
  SHA512:
6
- metadata.gz: 3905f473b483696859238779600e0074eb3fb668cef4898ce288d62be053339426afee23d8c6e32e36c8a706dbe0be0f60c5626181c45f78cea30b2baa9e7a23
7
- data.tar.gz: 21907c33e9ad329cf2852b10ccce61b9ca407c9fb0e01896a69c60d380d665df3366721cd155db14c48549b1b350c6f74922fe2213f5fdef6c21468a9ad2d586
6
+ metadata.gz: dadba1953785697e5f6f49ec05696b86c3ceeaca9c437dcd6804f8270d6ebc37cab2926ec9a961232ed727af30cca7691a1799c8c8389f4245611684b6fd5d41
7
+ data.tar.gz: 7b7bd5a5024cbd4b81a4dd52556bd50a0c4583394b97e3b01b159e98338a3c85748e9d238278b9b38a7501b2fff1a64fe7653ead1ff1755f86b11e3625d1b2b8
@@ -1,12 +1,11 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
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 !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
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 !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
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: Asciidoctor processor for 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://travis-ci.com/metanorma/metanorma-itu.svg["Build Status", link="https://travis-ci.com/metanorma/metanorma-itu"]
5
- image:https://ci.appveyor.com/api/projects/status/pl6lh4a9224ijbe1?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/metanorma/metanorma-itu"]
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 http://asciidoctor.org/[Asciidoctor] documents following
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 gem currently inherits from the https://github.com/metanorma/metanorma-standoc
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
- The preferred way to invoke this gem is via the `metanorma` script:
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
- [source,console]
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 avalable at the https://github.com/metanorma/mn-samples-itu[mn-samples-itu] repository.
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
- <define name="TitleType">
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").children.first
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 x.at("./*/annex[last()] | ./*/sections").next =
42
+ x.at("//bibliography") or
43
+ x.at("./*/annex[last()] | ./*/sections").next =
43
44
  "<bibliography><sentinel/></bibliography>"
44
- ins = x.at("//bibliography").children.first
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/terms")
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
@@ -101,9 +101,7 @@
101
101
  <ref name="structuredidentifier"/>
102
102
  </zeroOrMore>
103
103
  </define>
104
- <define name="TitleType">
105
- <text/>
106
- </define>
104
+ <!-- TitleType = text -->
107
105
  <define name="sections">
108
106
  <element name="sections">
109
107
  <oneOrMore>
@@ -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[:docidentifier] and p << "Recommendation #{id}"
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
- end
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:70pt;height:70pt;visibility:visible;mso-wrap-style:square'>
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;
@@ -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(:docidentifier, dn&.text)
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))
@@ -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(@type = 'DOI' or @type = 'ISSN' or "\
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 = 'DOI' or @type = "\
55
- "'metanorma' or @type = 'ISSN' or @type = 'ISBN')]"))
56
- id.empty? and id = b.xpath(ns("./docidentifier[not(@type = 'DOI' or "\
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
- r << render_identifiers(id)
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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "1.0.11"
3
+ VERSION = "1.0.12"
4
4
  end
5
5
  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.11
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-20 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities