metanorma-ietf 2.1.0 → 2.2.1

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: 47adf288717bcbd4914d1a3d43fb8eeea4d18fbb6f9675846c9ec37a9664f142
4
- data.tar.gz: f0486d16c7a457465cce21790e3c76cb3422b0508d5ae57a150e15bf4e1059a7
3
+ metadata.gz: '08a3fef1af7e02a0c603e1304ccd50b2122efb82fb744f2f31e651fe90c13622'
4
+ data.tar.gz: 18eaa00b783bfb0308a5fc088ad78562b4ed6f21a950b0494603dc5d47c0933a
5
5
  SHA512:
6
- metadata.gz: e22190786fb20f67dd85cc5e0bd3e831e32b5ee54c0de91d08780106a624e902c11108672469afdcf80451489fddc11472f0ee73910592c947550b3f243b4c0b
7
- data.tar.gz: 85c7688efec6428a459a6d6f7d182c092ad68a5ed6a6e971e379fab3d6c6c46f5e77e083aa11be20d7570691505d3b61da50e217c93643451d215387e747d486
6
+ metadata.gz: 4dff850b703e42b2f6ee3fe5a7408a6b8fc33eb05bd6987b48761ee5def3d62ba3acebc0332768de34b5b84201e4003adaddf4cfe70dde1b6c7aadda2eb21fb7
7
+ data.tar.gz: 6ab998721ba99fb4a82589c9cd3aa25e090b86535e6b8ecb953a6679b70910cf4165e5bf15787154fffb52090ccb2299476e913f35df444d0d8e5c160361dffc
@@ -36,7 +36,6 @@ jobs:
36
36
  uses: actions/setup-ruby@v1
37
37
  with:
38
38
  ruby-version: ${{ matrix.ruby }}
39
- architecture: 'x64'
40
39
  - name: Update gems
41
40
  run: |
42
41
  sudo gem install bundler --force
@@ -35,7 +35,6 @@ jobs:
35
35
  uses: actions/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
- architecture: 'x64'
39
38
  - name: Update gems
40
39
  run: |
41
40
  gem install bundler
@@ -36,7 +36,6 @@ jobs:
36
36
  uses: actions/setup-ruby@v1
37
37
  with:
38
38
  ruby-version: ${{ matrix.ruby }}
39
- architecture: 'x64'
40
39
  - name: Update gems
41
40
  shell: pwsh
42
41
  run: |
@@ -11,7 +11,7 @@ module Asciidoctor
11
11
 
12
12
  def metadata_publisher(node, xml)
13
13
  publishers = node.attr("publisher") || "IETF"
14
- publishers.split(/,[ ]?/).each do |p|
14
+ csv_split(publishers)&.each do |p|
15
15
  xml.contributor do |c|
16
16
  c.role **{ type: "publisher" }
17
17
  c.organization { |a| organization(a, p) }
@@ -20,8 +20,8 @@ module Asciidoctor
20
20
  end
21
21
 
22
22
  def metadata_copyright(node, xml)
23
- publishers = node.attr("publisher") || "IETF"
24
- publishers.split(/,[ ]?/).each do |p|
23
+ publishers = node.attr("copyright-holder") || node.attr("publisher") || "IETF"
24
+ csv_split(publishers)&.each do |p|
25
25
  xml.copyright do |c|
26
26
  c.from (node.attr("copyright-year") || Date.today.year)
27
27
  c.owner do |owner|
@@ -922,6 +922,9 @@
922
922
  <optional>
923
923
  <attribute name="script"/>
924
924
  </optional>
925
+ <optional>
926
+ <attribute name="type"/>
927
+ </optional>
925
928
  <optional>
926
929
  <attribute name="obligation">
927
930
  <choice>
@@ -961,9 +964,6 @@
961
964
  </define>
962
965
  <define name="content-subsection">
963
966
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
967
  <ref name="Content-Section"/>
968
968
  </element>
969
969
  </define>
@@ -992,6 +992,9 @@
992
992
  </choice>
993
993
  </attribute>
994
994
  </optional>
995
+ <optional>
996
+ <attribute name="type"/>
997
+ </optional>
995
998
  <optional>
996
999
  <ref name="section-title"/>
997
1000
  </optional>
@@ -1011,9 +1014,6 @@
1011
1014
  </define>
1012
1015
  <define name="clause">
1013
1016
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1017
  <ref name="Clause-Section"/>
1018
1018
  </element>
1019
1019
  </define>
@@ -1042,6 +1042,9 @@
1042
1042
  </choice>
1043
1043
  </attribute>
1044
1044
  </optional>
1045
+ <optional>
1046
+ <attribute name="type"/>
1047
+ </optional>
1045
1048
  <optional>
1046
1049
  <ref name="section-title"/>
1047
1050
  </optional>
@@ -1180,6 +1183,9 @@
1180
1183
  <optional>
1181
1184
  <attribute name="script"/>
1182
1185
  </optional>
1186
+ <optional>
1187
+ <attribute name="type"/>
1188
+ </optional>
1183
1189
  <optional>
1184
1190
  <attribute name="obligation">
1185
1191
  <choice>
@@ -72,7 +72,9 @@ module IsoDoc::Ietf
72
72
  end
73
73
 
74
74
  def note_label(node)
75
- l10n("#{super}: ")
75
+ n = @xrefs.get[node["id"]]
76
+ return l10n("#{@i18n.note}: ") if n.nil? || n[:label].nil? || n[:label].empty?
77
+ l10n("#{@i18n.note} #{n[:label]}: ")
76
78
  end
77
79
 
78
80
  def note_parse(node, out)
@@ -96,8 +98,8 @@ module IsoDoc::Ietf
96
98
  def example_label(node, div, name)
97
99
  n = @xrefs.get[node["id"]]
98
100
  div.t **attr_code(anchor: node["id"], keepWithNext: "true") do |p|
99
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
100
- l10n("#{@example_lbl} #{n[:label]}")
101
+ lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @i18n.example :
102
+ l10n("#{@i18n.example} #{n[:label]}")
101
103
  p << lbl
102
104
  name and !lbl.nil? and p << ": "
103
105
  name and name.children.each { |n| parse(n, p) }
@@ -137,7 +139,7 @@ module IsoDoc::Ietf
137
139
 
138
140
  def formula_where(dl, out)
139
141
  return unless dl
140
- out.t { |p| p << @where_lbl }
142
+ out.t { |p| p << @i18n.where }
141
143
  parse(dl, out)
142
144
  end
143
145
 
@@ -157,7 +157,8 @@ module IsoDoc::Ietf
157
157
  s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n").
158
158
  gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
159
159
  sourcecode_remove_markup(s)
160
- s.children = "<![CDATA[#{s.children.to_xml.sub(/\A\n+/, "")}]]>"
160
+ text = HTMLEntities.new.decode(s.children.to_xml.sub(/\A\n+/, ""))
161
+ s.children = "<![CDATA[#{text}]]>"
161
162
  end
162
163
  end
163
164
 
@@ -23,11 +23,16 @@ module IsoDoc::Ietf
23
23
  super
24
24
  end
25
25
 
26
+ def output_if_translit(text)
27
+ return nil if text.nil?
28
+ text.transliterate != text ? text.transliterate : nil
29
+ end
30
+
26
31
  def title(isoxml, front)
27
32
  title = @meta.get[:doctitle] or return
28
33
  front.title title, **attr_code(abbrev: @meta.get[:docabbrev],
29
- ascii: @meta.get[:docascii] ||
30
- title.transliterate)
34
+ ascii: (@meta.get[:docascii] ||
35
+ output_if_translit(title)))
31
36
  end
32
37
 
33
38
  def seriesinfo(isoxml, front)
@@ -37,7 +42,7 @@ module IsoDoc::Ietf
37
42
 
38
43
  def seriesinfo_attr(isoxml)
39
44
  attr_code(value: @meta.get[:docnumber] || "",
40
- asciiValue: @meta.get[:docnumber]&.transliterate,
45
+ asciiValue: output_if_translit(@meta.get[:docnumber]),
41
46
  status: @meta.get[:stage],
42
47
  stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/"\
43
48
  "title"))&.text)
@@ -82,9 +87,9 @@ module IsoDoc::Ietf
82
87
 
83
88
  def pers_author_attrs1(ret, full, init, c)
84
89
  full and ret.merge!(attr_code(
85
- asciiFullname: full&.transliterate,
86
- asciiInitials: init&.transliterate,
87
- asciiSurname: c&.at(ns("./surname"))&.text&.transliterate))
90
+ asciiFullname: output_if_translit(full),
91
+ asciiInitials: output_if_translit(init),
92
+ asciiSurname: output_if_translit(c&.at(ns("./surname")))))
88
93
  ret
89
94
  end
90
95
 
@@ -113,8 +118,8 @@ module IsoDoc::Ietf
113
118
  def organization(org, out, show)
114
119
  name = org.at(ns("./name"))&.text
115
120
  out.organization name, **attr_code(
116
- showOnFrontPage: show&.text, ascii: name&.transliterate,
117
- asciiAbbrev: org&.at(ns("./abbreviation"))&.transliterate,
121
+ showOnFrontPage: show&.text, ascii: output_if_translit(name),
122
+ asciiAbbrev: output_if_translit(org.at(ns("./abbreviation"))),
118
123
  abbrev: org.at(ns("./abbreviation")))
119
124
  end
120
125
 
@@ -163,7 +168,7 @@ module IsoDoc::Ietf
163
168
 
164
169
  def date(isoxml, front)
165
170
  date = @meta.get[:publisheddate] || @meta.get[:circulateddate] || return
166
- date.gsub!(/T.*$/, "")
171
+ date = date.gsub(/T.*$/, "")
167
172
  attr = date_attr(date) || return
168
173
  front.date **attr_code(attr)
169
174
  end
@@ -1,5 +1,10 @@
1
1
  module IsoDoc::Ietf
2
2
  class RfcConvert < ::IsoDoc::Convert
3
+ def recommendation_labels(node)
4
+ [node.at(ns("./label")), node.at(ns("./title")),
5
+ @xrefs.anchor(node['id'], :label, false)]
6
+ end
7
+
3
8
  def recommendation_name(node, out, type)
4
9
  label, title, lbl = recommendation_labels(node)
5
10
  out.t **{ keepWithNext: "true" } do |b|
@@ -27,7 +32,7 @@ module IsoDoc::Ietf
27
32
  end
28
33
 
29
34
  def recommendation_parse(node, out)
30
- recommendation_name(node, out, @recommendation_lbl)
35
+ recommendation_name(node, out, @i18n.recommendation)
31
36
  recommendation_attributes(node, out)
32
37
  node.children.each do |n|
33
38
  parse(n, out) unless %w(label title).include? n.name
@@ -35,7 +40,7 @@ module IsoDoc::Ietf
35
40
  end
36
41
 
37
42
  def requirement_parse(node, out)
38
- recommendation_name(node, out, @requirement_lbl)
43
+ recommendation_name(node, out, @i18n.requirement)
39
44
  recommendation_attributes(node, out)
40
45
  node.children.each do |n|
41
46
  parse(n, out) unless %w(label title).include? n.name
@@ -43,7 +48,7 @@ module IsoDoc::Ietf
43
48
  end
44
49
 
45
50
  def permission_parse(node, out)
46
- recommendation_name(node, out, @permission_lbl)
51
+ recommendation_name(node, out, @i18n.permission)
47
52
  recommendation_attributes(node, out)
48
53
  node.children.each do |n|
49
54
  parse(n, out) unless %w(label title).include? n.name
@@ -27,12 +27,12 @@ module IsoDoc::Ietf
27
27
  set_pis(docxml, Nokogiri::XML(xml))
28
28
  end
29
29
 
30
- def metadata_init(lang, script, labels)
31
- @meta = Metadata.new(lang, script, labels)
30
+ def metadata_init(lang, script, i18n)
31
+ @meta = Metadata.new(lang, script, i18n)
32
32
  end
33
33
 
34
- def xref_init(lang, script, klass, labels, options)
35
- @xrefs = Xref.new(lang, script, klass, labels, options)
34
+ def xref_init(lang, script, klass, i18n, options)
35
+ @xrefs = Xref.new(lang, script, klass, i18n, options)
36
36
  end
37
37
 
38
38
  def extract_delims(text)
@@ -63,6 +63,7 @@ module IsoDoc::Ietf
63
63
  category: series2category(
64
64
  docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text),
65
65
  ipr: docxml&.at(ns("//bibdata/ext/ipr"))&.text,
66
+ consensus: docxml&.at(ns("//bibdata/ext/consensus"))&.text,
66
67
  obsoletes: obs,
67
68
  updates: upd,
68
69
  indexInclude: docxml&.at(ns("//bibdata/ext/indexInclude"))&.text,
@@ -81,11 +82,11 @@ module IsoDoc::Ietf
81
82
 
82
83
  def series2category(series)
83
84
  case series&.downcase
84
- when "standard" then "std"
85
- when "informational" then "info"
86
- when "experimental" then "exp"
85
+ when "standard", "std" then "std"
86
+ when "informational", "info" then "info"
87
+ when "experimental", "exp" then "exp"
87
88
  when "bcp" then "bcp"
88
- when "fyi" then "info"
89
+ when "fyi", "info" then "info"
89
90
  when "full-standard" then "std"
90
91
  when "historic" then "historic"
91
92
  else
@@ -132,7 +133,7 @@ module IsoDoc::Ietf
132
133
  end
133
134
  end
134
135
 
135
- def clause_parse_title(node, div, c1, out)
136
+ def clause_parse_title(node, div, c1, out, _heading_attrs = {})
136
137
  return unless c1
137
138
  div.name do |n|
138
139
  c1&.children&.each { |c2| parse(c2, n) }
@@ -13,7 +13,7 @@ module IsoDoc::Ietf
13
13
 
14
14
  def deprecated_term_parse(node, out)
15
15
  out.t do |p|
16
- p << l10n("#{@deprecated_lbl}: ")
16
+ p << l10n("#{@i18n.deprecated}: ")
17
17
  node.children.each { |c| parse(c, p) }
18
18
  end
19
19
  end
@@ -26,11 +26,6 @@ module Metanorma
26
26
  "Metanorma::Ietf #{::Metanorma::Ietf::VERSION}"
27
27
  end
28
28
 
29
- def input_to_isodoc(file, filename)
30
- # This is XML RFC v3 output in text
31
- Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
32
- end
33
-
34
29
  def extract_options(isodocxml)
35
30
  {}
36
31
  end
@@ -48,6 +43,10 @@ module Metanorma
48
43
  nil
49
44
  end
50
45
 
46
+ def use_presentation_xml(ext)
47
+ false
48
+ end
49
+
51
50
  def xml2rfc_present?
52
51
  !which("xml2rfc").nil?
53
52
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.2.1".freeze
4
4
  end
5
5
  end
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
37
37
 
38
- spec.add_dependency "metanorma-standoc", "~> 1.4.0"
39
- spec.add_dependency "isodoc", "~> 1.1.0"
38
+ spec.add_dependency "metanorma-standoc", "~> 1.5.0"
39
+ spec.add_dependency "isodoc", "~> 1.2.0"
40
40
  spec.add_dependency "mathml2asciimath"
41
41
 
42
42
  spec.add_development_dependency "byebug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
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-06-26 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.0
19
+ version: 1.5.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.0
26
+ version: 1.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.0
33
+ version: 1.2.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.1.0
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mathml2asciimath
43
43
  requirement: !ruby/object:Gem::Requirement