metanorma-ietf 2.0.6 → 2.0.11

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: ea7691960ebd06212c10a16ef04f39a86d44312c496fd190e03ead96dac484c7
4
- data.tar.gz: 44f0aeaa5ad12410d58660afdcd4b4c17d63b3bc8d26bd420a0adc275c05a648
3
+ metadata.gz: 0cdde2dd756f4b98e9e1ad918916b0fc983ced8c3917f5c365394d03b2e5510b
4
+ data.tar.gz: d53d5c9fadfd23fa1d9f5c400c66ecc003643e519937063180cd9574daa5cd76
5
5
  SHA512:
6
- metadata.gz: 7e618fbc5f61ddc1419ed6a48c59a9aa03694dcd7e09e77fe79b8f8f08f37bf6c7ffde6656d1b3d6dbcd934aa80c5cf6754df234dd55577ae28ea2eea22c1991
7
- data.tar.gz: 8fa3bb4b08545037774b2080c541d60df663b79f3c7c58b33fd1df91049f5f11af1732846a1185ce856ee0ef6d2a0888720ca50b84041d865f145a039d98debd
6
+ metadata.gz: 76de6e92a10f1a8789557d2543eda42acda12f0002e48738a7b38502eb21ec7e3927aa2a2acbc536ac5b2353ce62b32817b30ca0588c880bf72a8248c7df8076
7
+ data.tar.gz: 4141c256ce2b15729296f48852d42a8b0194f58b83978bb1cb2c72c2c04613ed07a9c6d1346999e96e86a99ba120ef029b85b62ae4c8e268bbadf5bd022c9afe
@@ -1,23 +1,37 @@
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: [ '**' ]
9
+ paths-ignore:
10
+ - .github/workflows/ubuntu.yml
11
+ - .github/workflows/windows.yml
10
12
 
11
13
  jobs:
12
14
  test-macos:
13
15
  name: Test on Ruby ${{ matrix.ruby }} macOS
14
16
  runs-on: macos-latest
17
+ continue-on-error: ${{ matrix.experimental }}
15
18
  strategy:
16
19
  fail-fast: false
17
20
  matrix:
18
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
19
26
  steps:
20
27
  - uses: actions/checkout@master
28
+ - name: Cache xml2rfc
29
+ id: cache-xml2rfc
30
+ uses: actions/cache@v1
31
+ with:
32
+ path: ~/.cache/xml2rfc
33
+ key: xml2rfc
34
+ restore-key: xml2rfc
21
35
  - name: Use Ruby
22
36
  uses: actions/setup-ruby@v1
23
37
  with:
@@ -30,7 +44,7 @@ jobs:
30
44
  - name: Use Python
31
45
  uses: actions/setup-python@v1
32
46
  with:
33
- python-version: '2.7'
47
+ python-version: '3.6'
34
48
  architecture: 'x64'
35
49
  - name: Install xml2rfc
36
50
  run: |
@@ -38,3 +52,4 @@ jobs:
38
52
  - name: Run specs
39
53
  run: |
40
54
  bundle exec rake
55
+
@@ -1,23 +1,36 @@
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
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/windows.yml
11
12
  jobs:
12
13
  test-linux:
13
14
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
15
  runs-on: ubuntu-latest
16
+ continue-on-error: ${{ matrix.experimental }}
15
17
  strategy:
16
18
  fail-fast: false
17
19
  matrix:
18
20
  ruby: [ '2.6', '2.5', '2.4' ]
21
+ experimental: [false]
22
+ include:
23
+ - ruby: '2.7'
24
+ experimental: true
19
25
  steps:
20
26
  - uses: actions/checkout@master
27
+ - name: Cache xml2rfc
28
+ id: cache-xml2rfc
29
+ uses: actions/cache@v1
30
+ with:
31
+ path: ~/.cache/xml2rfc
32
+ key: xml2rfc
33
+ restore-key: xml2rfc
21
34
  - name: Use Ruby
22
35
  uses: actions/setup-ruby@v1
23
36
  with:
@@ -25,12 +38,12 @@ jobs:
25
38
  architecture: 'x64'
26
39
  - name: Update gems
27
40
  run: |
28
- gem install bundler
41
+ gem install bundler
29
42
  bundle install --jobs 4 --retry 3
30
43
  - name: Use Python
31
44
  uses: actions/setup-python@v1
32
45
  with:
33
- python-version: '2.7'
46
+ python-version: '3.6'
34
47
  architecture: 'x64'
35
48
  - name: Install xml2rfc
36
49
  run: |
@@ -1,23 +1,37 @@
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: [ '**' ]
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/ubuntu.yml
10
12
 
11
13
  jobs:
12
14
  test-windows:
13
15
  name: Test on Ruby ${{ matrix.ruby }} Windows
14
16
  runs-on: windows-latest
17
+ continue-on-error: ${{ matrix.experimental }}
15
18
  strategy:
16
19
  fail-fast: false
17
20
  matrix:
18
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
19
26
  steps:
20
27
  - uses: actions/checkout@master
28
+ - name: Cache xml2rfc
29
+ id: cache-xml2rfc
30
+ uses: actions/cache@v1
31
+ with:
32
+ path: ~/.cache/xml2rfc
33
+ key: xml2rfc
34
+ restore-key: xml2rfc
21
35
  - name: Use Ruby
22
36
  uses: actions/setup-ruby@v1
23
37
  with:
@@ -26,14 +40,12 @@ jobs:
26
40
  - name: Update gems
27
41
  shell: pwsh
28
42
  run: |
29
- gem install bundler
30
- bundle config --local path vendor/bundle
31
- bundle update
43
+ gem install bundler
32
44
  bundle install --jobs 4 --retry 3
33
45
  - name: Use Python
34
46
  uses: actions/setup-python@v1
35
47
  with:
36
- python-version: '2.7'
48
+ ruby-version: '3.6'
37
49
  architecture: 'x64'
38
50
  - name: Install xml2rfc
39
51
  run: |
@@ -6,8 +6,9 @@
6
6
  "`http://asciidoctor.org/[asciidoctor]-way`".
7
7
 
8
8
  image:https://img.shields.io/gem/v/metanorma-ietf.svg["Gem Version", link="https://rubygems.org/gems/metanorma-ietf"]
9
- image:https://travis-ci.com/metanorma/metanorma-ietf.svg["Build Status", link="https://travis-ci.com/metanorma/metanorma-ietf"]
10
- image:https://ci.appveyor.com/api/projects/status/or6b0wx4b0q3qm0m?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/metanorma/metanorma-ietf"]
9
+ image:https://github.com/metanorma/metanorma-ietf/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=macos"]
10
+ image:https://github.com/metanorma/metanorma-ietf/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=ubuntu"]
11
+ image:https://github.com/metanorma/metanorma-ietf/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=windows"]
11
12
  image:https://codeclimate.com/github/metanorma/metanorma-ietf/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-ietf"]
12
13
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-ietf.svg["Pull Requests", link="https://github.com/metanorma/metanorma-ietf/pulls"]
13
14
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-ietf/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-ietf/releases"]
@@ -49,11 +49,17 @@
49
49
  </define>
50
50
  <define name="stage">
51
51
  <element name="stage">
52
+ <optional>
53
+ <attribute name="abbreviation"/>
54
+ </optional>
52
55
  <text/>
53
56
  </element>
54
57
  </define>
55
58
  <define name="substage">
56
59
  <element name="substage">
60
+ <optional>
61
+ <attribute name="abbreviation"/>
62
+ </optional>
57
63
  <text/>
58
64
  </element>
59
65
  </define>
@@ -82,7 +88,7 @@
82
88
  <text/>
83
89
  </element>
84
90
  </define>
85
- <define name="LocalizedString">
91
+ <define name="LocalizedString1">
86
92
  <optional>
87
93
  <!-- multiple languages and scripts possible: comma delimit them if so -->
88
94
  <attribute name="language"/>
@@ -92,6 +98,16 @@
92
98
  </optional>
93
99
  <text/>
94
100
  </define>
101
+ <define name="LocalizedString">
102
+ <choice>
103
+ <ref name="LocalizedString1"/>
104
+ <oneOrMore>
105
+ <element name="variant">
106
+ <ref name="LocalizedString1"/>
107
+ </element>
108
+ </oneOrMore>
109
+ </choice>
110
+ </define>
95
111
  <!--
96
112
  Unlike UML, change type to format: type is overloaded
97
113
  Would be need if plain were default value and could omit the attribute
@@ -115,7 +131,7 @@
115
131
  </optional>
116
132
  <ref name="LocalizedStringOrXsAny"/>
117
133
  </define>
118
- <define name="LocalizedStringOrXsAny">
134
+ <define name="LocalizedStringOrXsAny1">
119
135
  <optional>
120
136
  <!-- multiple languages and scripts possible: comma delimit them if so -->
121
137
  <attribute name="language"/>
@@ -130,6 +146,16 @@
130
146
  </choice>
131
147
  </oneOrMore>
132
148
  </define>
149
+ <define name="LocalizedStringOrXsAny">
150
+ <choice>
151
+ <ref name="LocalizedStringOrXsAny1"/>
152
+ <oneOrMore>
153
+ <element name="variant">
154
+ <ref name="LocalizedStringOrXsAny1"/>
155
+ </element>
156
+ </oneOrMore>
157
+ </choice>
158
+ </define>
133
159
  <define name="contributor">
134
160
  <element name="contributor">
135
161
  <zeroOrMore>
@@ -452,9 +478,14 @@
452
478
  <attribute name="bibitemid">
453
479
  <data type="IDREF"/>
454
480
  </attribute>
455
- <zeroOrMore>
456
- <ref name="locality"/>
457
- </zeroOrMore>
481
+ <choice>
482
+ <zeroOrMore>
483
+ <ref name="locality"/>
484
+ </zeroOrMore>
485
+ <zeroOrMore>
486
+ <ref name="localityStack"/>
487
+ </zeroOrMore>
488
+ </choice>
458
489
  <optional>
459
490
  <ref name="date"/>
460
491
  </optional>
@@ -469,6 +500,25 @@
469
500
  <ref name="BibItemLocality"/>
470
501
  </element>
471
502
  </define>
503
+ <define name="localityStack">
504
+ <element name="localityStack">
505
+ <zeroOrMore>
506
+ <ref name="locality"/>
507
+ </zeroOrMore>
508
+ </element>
509
+ </define>
510
+ <define name="sourceLocality">
511
+ <element name="sourceLocality">
512
+ <ref name="BibItemLocality"/>
513
+ </element>
514
+ </define>
515
+ <define name="sourceLocalityStack">
516
+ <element name="sourceLocalityStack">
517
+ <zeroOrMore>
518
+ <ref name="sourceLocality"/>
519
+ </zeroOrMore>
520
+ </element>
521
+ </define>
472
522
  <define name="BibItemLocality">
473
523
  <attribute name="type">
474
524
  <ref name="LocalityType"/>
@@ -703,21 +753,11 @@
703
753
  </define>
704
754
  <define name="TypedTitleString">
705
755
  <optional>
706
- <attribute name="type">
707
- <ref name="TitleType"/>
708
- </attribute>
756
+ <attribute name="type"/>
709
757
  </optional>
710
758
  <ref name="FormattedString"/>
711
759
  </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>
760
+ <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
721
761
  <define name="TypedUri">
722
762
  <optional>
723
763
  <attribute name="type"/>
@@ -747,6 +787,8 @@
747
787
  <value>unchanged</value>
748
788
  <value>circulated</value>
749
789
  <value>adapted</value>
790
+ <value>vote-started</value>
791
+ <value>vote-ended</value>
750
792
  </choice>
751
793
  </define>
752
794
  <define name="bdate">
@@ -999,38 +1041,63 @@
999
1041
  </define>
1000
1042
  <define name="DocRelationType">
1001
1043
  <choice>
1002
- <value>obsoletes</value>
1003
- <value>obsoletedBy</value>
1004
- <value>supersedes</value>
1005
- <value>supersededBy</value>
1006
- <value>updates</value>
1007
- <value>updatedBy</value>
1008
- <value>complements</value>
1009
- <value>derivedFrom</value>
1010
- <value>translatedFrom</value>
1011
- <value>hasTranslation</value>
1012
- <value>adoptedFrom</value>
1013
- <value>equivalent</value>
1014
- <value>identical</value>
1015
- <value>nonequivalent</value>
1016
- <value>includedIn</value>
1017
1044
  <value>includes</value>
1018
- <value>instance</value>
1019
- <value>instanceOf</value>
1020
- <value>partOf</value>
1045
+ <value>includedIn</value>
1021
1046
  <value>hasPart</value>
1022
- <value>hasDraft</value>
1023
- <value>draftOf</value>
1047
+ <value>partOf</value>
1024
1048
  <value>merges</value>
1049
+ <value>mergedInto</value>
1025
1050
  <value>splits</value>
1026
- <value>amends</value>
1027
- <value>amendedBy</value>
1028
- <value>corrects</value>
1029
- <value>correctedBy</value>
1030
- <value>revises</value>
1031
- <value>revisedBy</value>
1051
+ <value>splitInto</value>
1052
+ <value>instance</value>
1053
+ <value>hasInstance</value>
1054
+ <value>exemplarOf</value>
1055
+ <value>hasExemplar</value>
1056
+ <value>manifestationOf</value>
1057
+ <value>hasManifestation</value>
1058
+ <value>reproductionOf</value>
1059
+ <value>hasReproduction</value>
1060
+ <value>reprintOf</value>
1061
+ <value>hasReprint</value>
1062
+ <value>expressionOf</value>
1063
+ <value>hasExpression</value>
1064
+ <value>translatedFrom</value>
1065
+ <value>hasTranslation</value>
1066
+ <value>arrangementOf</value>
1067
+ <value>hasArrangement</value>
1068
+ <value>abridgementOf</value>
1069
+ <value>hasAbridgement</value>
1070
+ <value>annotationOf</value>
1071
+ <value>hasAnnotation</value>
1072
+ <value>draftOf</value>
1073
+ <value>hasDraft</value>
1074
+ <value>editionOf</value>
1075
+ <value>hasEdition</value>
1076
+ <value>updates</value>
1077
+ <value>updatedBy</value>
1078
+ <value>derivedFrom</value>
1079
+ <value>derives</value>
1032
1080
  <value>describes</value>
1033
1081
  <value>describedBy</value>
1082
+ <value>catalogues</value>
1083
+ <value>cataloguedBy</value>
1084
+ <value>hasSuccessor</value>
1085
+ <value>successorOf</value>
1086
+ <value>adaptedFrom</value>
1087
+ <value>hasAdaptation</value>
1088
+ <value>adoptedFrom</value>
1089
+ <value>adoptedAs</value>
1090
+ <value>reviewOf</value>
1091
+ <value>hasReview</value>
1092
+ <value>commentaryOf</value>
1093
+ <value>hasCommentary</value>
1094
+ <value>related</value>
1095
+ <value>complements</value>
1096
+ <value>complementOf</value>
1097
+ <value>obsoletes</value>
1098
+ <value>obsoletedBy</value>
1099
+ <value>cited</value>
1100
+ <value>isCitedIn</value>
1034
1101
  </choice>
1035
1102
  </define>
1036
1103
  <define name="docrelation">
@@ -1038,12 +1105,30 @@
1038
1105
  <attribute name="type">
1039
1106
  <ref name="DocRelationType"/>
1040
1107
  </attribute>
1108
+ <optional>
1109
+ <element name="description">
1110
+ <ref name="FormattedString"/>
1111
+ </element>
1112
+ </optional>
1041
1113
  <element name="bibitem">
1042
1114
  <ref name="BibliographicItem"/>
1043
1115
  </element>
1044
- <zeroOrMore>
1045
- <ref name="locality"/>
1046
- </zeroOrMore>
1116
+ <choice>
1117
+ <zeroOrMore>
1118
+ <ref name="locality"/>
1119
+ </zeroOrMore>
1120
+ <zeroOrMore>
1121
+ <ref name="localityStack"/>
1122
+ </zeroOrMore>
1123
+ </choice>
1124
+ <choice>
1125
+ <zeroOrMore>
1126
+ <ref name="sourceLocality"/>
1127
+ </zeroOrMore>
1128
+ <zeroOrMore>
1129
+ <ref name="sourceLocalityStack"/>
1130
+ </zeroOrMore>
1131
+ </choice>
1047
1132
  </element>
1048
1133
  </define>
1049
1134
  <define name="version">
@@ -22,6 +22,7 @@ module Asciidoctor
22
22
  @draft = node.attributes.has_key?("draft")
23
23
  @workgroups = cache_workgroup(node)
24
24
  @bcp_bold = !node.attr?("no-rfc-bold-bcp14")
25
+ @xinclude = node.attr?("use-xinclude")
25
26
  super
26
27
  end
27
28
 
@@ -35,7 +36,7 @@ module Asciidoctor
35
36
  File.open(filename, "w") { |f| f.write(ret) }
36
37
  rfc_converter(node).convert filename unless node.attr("nodoc")
37
38
  end
38
- @log.write(@filename + ".err") unless @novalid
39
+ @log.write(@localdir + @filename + ".err") unless @novalid
39
40
  @files_to_delete.each { |f| FileUtils.rm f }
40
41
  ret
41
42
  end
@@ -198,6 +199,10 @@ module Asciidoctor
198
199
  end
199
200
  end
200
201
 
202
+ def html_extract_attributes(node)
203
+ super.merge(use_xinclude: node.attr("use-xinclude"))
204
+ end
205
+
201
206
  def rfc_converter(node)
202
207
  IsoDoc::Ietf::RfcConvert.new(html_extract_attributes(node))
203
208
  end
@@ -2,7 +2,7 @@ module Asciidoctor
2
2
  module Ietf
3
3
  class Converter < ::Asciidoctor::Standoc::Converter
4
4
  def relaton_relations
5
- %w(included-in described-by derived-from equivalent obsoletes updates)
5
+ %w(included-in described-by derived-from instance obsoletes updates)
6
6
  end
7
7
 
8
8
  def metadata_author(node, xml)
@@ -57,8 +57,9 @@ module Asciidoctor
57
57
  ["en"].each do |lang|
58
58
  at = { language: lang, format: "text/plain" }
59
59
  xml.title **attr_code(at.merge(type: "main")) do |t|
60
- t << ::Asciidoctor::Standoc::Utils::asciidoc_sub(
61
- node.attr("title") || node.attr("title-en") || node.title)
60
+ t << (::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title")) ||
61
+ ::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-en")) ||
62
+ node.title)
62
63
  end
63
64
  a = node.attr("abbrev") and
64
65
  xml.title a, **attr_code(at.merge(type: "abbrev"))
@@ -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>
@@ -131,6 +129,9 @@
131
129
  </choice>
132
130
  </attribute>
133
131
  </optional>
132
+ <attribute name="normative">
133
+ <data type="boolean"/>
134
+ </attribute>
134
135
  <optional>
135
136
  <ref name="section-title"/>
136
137
  </optional>
@@ -307,6 +308,21 @@
307
308
  </define>
308
309
  </include>
309
310
  <!-- end overrides -->
311
+ <define name="TextElement" combine="choice">
312
+ <ref name="concept"/>
313
+ </define>
314
+ <define name="concept">
315
+ <element name="concept">
316
+ <optional>
317
+ <attribute name="term"/>
318
+ </optional>
319
+ <choice>
320
+ <ref name="eref"/>
321
+ <ref name="xref"/>
322
+ <ref name="termref"/>
323
+ </choice>
324
+ </element>
325
+ </define>
310
326
  <define name="BasicBlock" combine="choice">
311
327
  <choice>
312
328
  <ref name="requirement"/>
@@ -913,7 +929,10 @@
913
929
  </define>
914
930
  <define name="origin">
915
931
  <element name="origin">
916
- <ref name="erefType"/>
932
+ <choice>
933
+ <ref name="erefType"/>
934
+ <ref name="termref"/>
935
+ </choice>
917
936
  </element>
918
937
  </define>
919
938
  <define name="modification">
@@ -921,6 +940,15 @@
921
940
  <ref name="paragraph"/>
922
941
  </element>
923
942
  </define>
943
+ <define name="termref">
944
+ <element name="termref">
945
+ <attribute name="base"/>
946
+ <attribute name="target"/>
947
+ <optional>
948
+ <text/>
949
+ </optional>
950
+ </element>
951
+ </define>
924
952
  <define name="structuredidentifier">
925
953
  <element name="structuredidentifier">
926
954
  <optional>
@@ -110,9 +110,17 @@ module IsoDoc::Ietf
110
110
  end
111
111
  end
112
112
 
113
+ def get_linkend(node)
114
+ contents = node.children.select { |c| !%w{locality localityStack}.include? c.name }.
115
+ select { |c| !c.text? || /\S/.match(c) }
116
+ !contents.empty? and
117
+ return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
118
+ ""
119
+ end
120
+
113
121
  def eref_parse(node, out)
114
- linkend = node.children.select { |c| c.name != "locality" }
115
- section = eref_clause(node.xpath(ns("./locality")), nil) || ""
122
+ linkend = node.children.reject { |c| %w{locality localityStack}.include? c.name }
123
+ section = eref_clause(node.xpath(ns("./locality | ./localityStack")), nil) || ""
116
124
  out.relref **attr_code(target: node["bibitemid"], section: section,
117
125
  displayFormat: node["displayFormat"]) do |l|
118
126
  linkend.each { |n| parse(n, l) }
@@ -120,11 +128,27 @@ module IsoDoc::Ietf
120
128
  end
121
129
 
122
130
  def eref_clause(refs, target)
131
+ ret = []
132
+ ret1 = ""
133
+ refs.each do |l|
134
+ if l.name == "localityStack"
135
+ ret << ret1
136
+ ret1 = ""
137
+ ret << eref_clause1(l.elements, target)
138
+ else
139
+ ret1 += eref_clause1([l], target)
140
+ end
141
+ end
142
+ ret << ret1
143
+ ret.reject { |c| c.nil? || c.empty? }.join("; ")
144
+ end
145
+
146
+ def eref_clause1(refs, target)
123
147
  refs.each do |l|
124
148
  next unless %w(clause section).include? l["type"]
125
149
  return l&.at(ns("./referenceFrom"))&.text
126
150
  end
127
- return nil
151
+ return ""
128
152
  end
129
153
 
130
154
  def index_parse(node, out)
@@ -15,7 +15,7 @@ module IsoDoc
15
15
  end
16
16
 
17
17
  def relaton_relations
18
- %w(included-in described-by derived-from equivalent)
18
+ %w(included-in described-by derived-from instance)
19
19
  # = item describedby convertedfrom alternate
20
20
  end
21
21
 
@@ -31,7 +31,13 @@ module IsoDoc::Ietf
31
31
 
32
32
  def nonstd_bibitem(list, b, ordinal, bibliography)
33
33
  uris = b.xpath(ns("./uri"))
34
- list.reference **attr_code(target: uris.empty? ? nil : uris[0]&.text,
34
+ target = nil
35
+ uris&.each do |u|
36
+ if u["type"] == "src" then
37
+ target = u.text
38
+ end
39
+ end
40
+ list.reference **attr_code(target: target,
35
41
  anchor: b["id"]) do |r|
36
42
  r.front do |f|
37
43
  relaton_to_title(b, f)
@@ -40,25 +46,31 @@ module IsoDoc::Ietf
40
46
  relaton_to_keyword(b, f)
41
47
  relaton_to_abstract(b, f)
42
48
  end
43
- uris[1..-1]&.each do |u|
49
+ uris&.each do |u|
44
50
  r.format nil, **attr_code(target: u.text, type: u["type"])
45
51
  end
52
+ docidentifiers = b.xpath(ns("./docidentifier"))
53
+ id = render_identifier(bibitem_ref_code(b))
54
+ !id[1].nil? and id[1] != "(NO ID)" and
55
+ r.refcontent id[1]
56
+ docidentifiers&.each do |u|
57
+ if %w(DOI IETF).include? u["type"]
58
+ r.seriesInfo nil, **attr_code(value: u.text, name: u["type"])
59
+ end
60
+ end
46
61
  end
47
62
  end
48
63
 
49
64
  def relaton_to_title(b, f)
50
- id = bibitem_ref_code(b)
51
- identifier = render_identifier(id)
52
65
  title = b&.at(ns("./title")) || b&.at(ns("./formattedref")) or return
53
66
  f.title do |t|
54
- t << "#{identifier}, "
55
67
  title.children.each { |n| parse(n, t) }
56
68
  end
57
69
  end
58
70
 
59
71
  def relaton_to_author(b, f)
60
72
  auths = b.xpath(ns("./contributor[xmlns:role/@type = 'author' or "\
61
- "xmlns:role/@type = 'editor']"))
73
+ "xmlns:role/@type = 'editor']"))
62
74
  auths.empty? and auths = b.xpath(ns("./contributor[xmlns:role/@type = "\
63
75
  "'publisher']"))
64
76
  auths.each do |a|
@@ -111,7 +123,13 @@ module IsoDoc::Ietf
111
123
  def relaton_to_abstract(b, f)
112
124
  b.xpath(ns("./abstract")).each do |k|
113
125
  f.abstract do |abstract|
114
- k.children.each { |n| parse(n, abstract) }
126
+ if k.at(ns("./p"))
127
+ k.children.each { |n| parse(n, abstract) }
128
+ else
129
+ abstract.t do |t|
130
+ k.children.each { |n| parse(n, t) }
131
+ end
132
+ end
115
133
  end
116
134
  end
117
135
  end
@@ -122,6 +140,7 @@ module IsoDoc::Ietf
122
140
  end
123
141
 
124
142
  def is_ietf(b)
143
+ return false if !@xinclude
125
144
  url = b.at(ns("./uri[@type = 'xml']")) or return false
126
145
  /xml2rfc\.tools\.ietf\.org/.match(url)
127
146
  end
@@ -50,11 +50,27 @@ module IsoDoc::Ietf
50
50
  end
51
51
  end
52
52
 
53
+ def textcleanup(docxml)
54
+ passthrough_cleanup(docxml)
55
+ end
56
+
53
57
  def postprocess(result, filename, dir)
54
- result = from_xhtml(cleanup(to_xhtml(result))).sub(/<!DOCTYPE[^>]+>\n/, "").
58
+ result = from_xhtml(cleanup(to_xhtml(textcleanup(result)))).
59
+ sub(/<!DOCTYPE[^>]+>\n/, "").
55
60
  sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
56
61
  File.open("#{filename}.rfc.xml", "w:UTF-8") { |f| f.write(result) }
57
62
  @files_to_delete.each { |f| FileUtils.rm_rf f }
58
63
  end
64
+
65
+ def init_file(filename, debug)
66
+ filename = filename.sub(/\.rfc\.xml$/, ".rfc")
67
+ super
68
+ end
69
+
70
+ def initialize(options)
71
+ super
72
+ @xinclude = options[:use_xinclude] == "true"
73
+ @format = :rfc
74
+ end
59
75
  end
60
76
  end
@@ -75,8 +75,6 @@ module IsoDoc::Ietf
75
75
  'xml:lang': docxml&.at(ns("//bibdata/language"))&.text,
76
76
  version: "3",
77
77
  'xmlns:xi': "http://www.w3.org/2001/XInclude",
78
- prepTime: sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
79
- t.year, t.month, t.day, t.hour, t.min, t.sec),
80
78
  }
81
79
  end
82
80
 
@@ -88,7 +86,7 @@ module IsoDoc::Ietf
88
86
  def make_link(out, isoxml)
89
87
  links = isoxml.xpath(ns(
90
88
  "//bibdata/relation[@type = 'includedIn' or @type = 'describedBy' or "\
91
- "@type = 'derivedFrom' or @type = 'equivalent']")) || return
89
+ "@type = 'derivedFrom' or @type = 'instance']")) || return
92
90
  links.each do |l|
93
91
  out.link **{ href: l&.at(ns("./bibitem/docidentifier"))&.text,
94
92
  rel: rel2iana(l["type"]) }
@@ -100,7 +98,7 @@ module IsoDoc::Ietf
100
98
  when "includedIn" then "item"
101
99
  when "describedBy" then "describedby"
102
100
  when "derivedFrom" then "convertedfrom"
103
- when "equivalent" then "alternate"
101
+ when "instance" then "alternate"
104
102
  else
105
103
  "alternate"
106
104
  end
@@ -114,8 +112,8 @@ module IsoDoc::Ietf
114
112
 
115
113
  def make_back(out, isoxml)
116
114
  out.back do |back|
117
- annex isoxml, back
118
115
  bibliography isoxml, back
116
+ annex isoxml, back
119
117
  end
120
118
  end
121
119
 
@@ -17,7 +17,8 @@ module Metanorma
17
17
  xml: "xml",
18
18
  rfc: "rfc.xml",
19
19
  html: "html",
20
- txt: "txt"
20
+ txt: "txt",
21
+ pdf: "pdf"
21
22
  }
22
23
  end
23
24
 
@@ -47,22 +48,49 @@ module Metanorma
47
48
  nil
48
49
  end
49
50
 
51
+ def xml2rfc_present?
52
+ !which("xml2rfc").nil?
53
+ end
54
+
50
55
  def output(isodoc_node, outname, format, options={})
51
56
  case format
52
57
  when :rfc
53
- IsoDoc::Ietf::RfcConvert.new(options).convert(outname.sub(/\.xml/, ""), isodoc_node)
58
+ IsoDoc::Ietf::RfcConvert.new(options).convert(outname, isodoc_node)
54
59
  @done_rfc = true
55
60
 
56
- when :txt, :html
57
- rfcname = outname.sub(/\.(html|txt)$/, ".rfc.xml")
61
+ when :txt
62
+ unless xml2rfc_present?
63
+ warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
64
+ return
65
+ end
66
+
67
+ rfcname = outname.sub(/\.txt$/, ".rfc.xml")
58
68
  output(isodoc_node, outname, :rfc, options) unless @done_rfc
59
- unless which("xml2rfc")
69
+
70
+ system("xml2rfc --text #{rfcname} -o #{outname}")
71
+
72
+ when :pdf
73
+ unless xml2rfc_present?
60
74
  warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
61
75
  return
62
76
  end
63
- # In xml2rfc, --text and --html are used
64
- format = :text if format == :txt
65
- system("xml2rfc --#{format} #{rfcname} -o #{outname}")
77
+
78
+ rfcname = outname.sub(/\.pdf$/, ".rfc.xml")
79
+ output(isodoc_node, outname, :rfc, options) unless @done_rfc
80
+
81
+ system("xml2rfc --pdf #{rfcname} -o #{outname}")
82
+
83
+ when :html
84
+ unless xml2rfc_present?
85
+ warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
86
+ return
87
+ end
88
+
89
+ rfcname = outname.sub(/\.html$/, ".rfc.xml")
90
+ output(isodoc_node, outname, :rfc, options) unless @done_rfc
91
+
92
+ system("xml2rfc --html #{rfcname} -o #{outname}")
93
+
66
94
  else
67
95
  super
68
96
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.0.6".freeze
3
+ VERSION = "2.0.11".freeze
4
4
  end
5
5
  end
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.0.6
4
+ version: 2.0.11
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-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc