metanorma-gb 1.3.20 → 1.3.25

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: 8d38df0aea67cff245bf6cf1b6dbd5975eafd219f91cddf3b43440bf6955eba2
4
- data.tar.gz: 3dde182c4cc8a403eb09abea786c8ea2875a3176b220c7098aad95e93d895e29
3
+ metadata.gz: 9efcb324d7f28f302f1073443d496b76765b20d46fe99cadc7870baec271b853
4
+ data.tar.gz: ad193685cdf7e18f9a026738d4a50ca1186cb3ddedb273e6af01a220c57d0381
5
5
  SHA512:
6
- metadata.gz: eabebfbb64e5f20f27549340754c8f6ad6d24a3b61d4b9e299e35a35057ac7a88ac848785f3d3e3eb6589ff08005a36bfebc4fb28f31e0bdf0a8eb21087e1645
7
- data.tar.gz: 13e00179ec95b0cdc6bd4bbbcb2d19e8c0a9eacc8c7617a9d87fa74fcefeaac4fa69079ced0013dcc1c044ff79185e8b7043effbe9b2cb8e0bee6ae1d217f1c8
6
+ metadata.gz: 75c3dbf1aa5b18fa3d4a88e9b8a9093d7f75265c11990fdb451d11a68c1df1ea2acd4c211d4a4881e7bcc951c8f27daa030d9ba8b477a21b3e2e7e276c836efb
7
+ data.tar.gz: 2d77b43ed7a34a62e3ee3bec617bd6db6e2679151590e2b9c22aa54e0f955e3168acea78c1de95317832cebfe0e36a39da9cec518e9b80011a193c09b88e27e6
@@ -6,15 +6,23 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/ubuntu.yml
11
+ - .github/workflows/windows.yml
9
12
 
10
13
  jobs:
11
14
  test-macos:
12
15
  name: Test on Ruby ${{ matrix.ruby }} macOS
13
16
  runs-on: macos-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
@@ -5,16 +5,26 @@ name: ubuntu
5
5
  on:
6
6
  push:
7
7
  branches: [ master ]
8
+ tags:
9
+ - '*'
8
10
  pull_request:
11
+ paths-ignore:
12
+ - .github/workflows/macos.yml
13
+ - .github/workflows/windows.yml
9
14
 
10
15
  jobs:
11
16
  test-linux:
12
17
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
13
18
  runs-on: ubuntu-latest
19
+ continue-on-error: ${{ matrix.experimental }}
14
20
  strategy:
15
21
  fail-fast: false
16
22
  matrix:
17
23
  ruby: [ '2.6', '2.5', '2.4' ]
24
+ experimental: [false]
25
+ include:
26
+ - ruby: '2.7'
27
+ experimental: true
18
28
  steps:
19
29
  - uses: actions/checkout@master
20
30
  - name: Use Ruby
@@ -39,5 +49,5 @@ jobs:
39
49
  [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
40
50
  for repo in $DEPENDENT_REPOS
41
51
  do
42
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
52
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
43
53
  done
@@ -6,15 +6,23 @@ on:
6
6
  push:
7
7
  branches: [ master ]
8
8
  pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/macos.yml
11
+ - .github/workflows/ubuntu.yml
9
12
 
10
13
  jobs:
11
14
  test-windows:
12
15
  name: Test on Ruby ${{ matrix.ruby }} Windows
13
16
  runs-on: windows-latest
17
+ continue-on-error: ${{ matrix.experimental }}
14
18
  strategy:
15
19
  fail-fast: false
16
20
  matrix:
17
21
  ruby: [ '2.6', '2.5', '2.4' ]
22
+ experimental: [false]
23
+ include:
24
+ - ruby: '2.7'
25
+ experimental: true
18
26
  steps:
19
27
  - uses: actions/checkout@master
20
28
  - name: Use Ruby
@@ -27,7 +35,6 @@ jobs:
27
35
  run: |
28
36
  gem install bundler
29
37
  bundle config --local path vendor/bundle
30
- bundle update
31
38
  bundle install --jobs 4 --retry 3
32
39
  - name: Run specs
33
40
  run: |
@@ -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"/>
@@ -737,6 +787,8 @@
737
787
  <value>unchanged</value>
738
788
  <value>circulated</value>
739
789
  <value>adapted</value>
790
+ <value>vote-started</value>
791
+ <value>vote-ended</value>
740
792
  </choice>
741
793
  </define>
742
794
  <define name="bdate">
@@ -969,7 +1021,9 @@
969
1021
  <optional>
970
1022
  <ref name="to"/>
971
1023
  </optional>
972
- <ref name="owner"/>
1024
+ <oneOrMore>
1025
+ <ref name="owner"/>
1026
+ </oneOrMore>
973
1027
  </element>
974
1028
  </define>
975
1029
  <define name="from">
@@ -989,38 +1043,63 @@
989
1043
  </define>
990
1044
  <define name="DocRelationType">
991
1045
  <choice>
992
- <value>obsoletes</value>
993
- <value>obsoletedBy</value>
994
- <value>supersedes</value>
995
- <value>supersededBy</value>
996
- <value>updates</value>
997
- <value>updatedBy</value>
998
- <value>complements</value>
999
- <value>derivedFrom</value>
1000
- <value>translatedFrom</value>
1001
- <value>hasTranslation</value>
1002
- <value>adoptedFrom</value>
1003
- <value>equivalent</value>
1004
- <value>identical</value>
1005
- <value>nonequivalent</value>
1006
- <value>includedIn</value>
1007
1046
  <value>includes</value>
1008
- <value>instance</value>
1009
- <value>instanceOf</value>
1010
- <value>partOf</value>
1047
+ <value>includedIn</value>
1011
1048
  <value>hasPart</value>
1012
- <value>hasDraft</value>
1013
- <value>draftOf</value>
1049
+ <value>partOf</value>
1014
1050
  <value>merges</value>
1051
+ <value>mergedInto</value>
1015
1052
  <value>splits</value>
1016
- <value>amends</value>
1017
- <value>amendedBy</value>
1018
- <value>corrects</value>
1019
- <value>correctedBy</value>
1020
- <value>revises</value>
1021
- <value>revisedBy</value>
1053
+ <value>splitInto</value>
1054
+ <value>instance</value>
1055
+ <value>hasInstance</value>
1056
+ <value>exemplarOf</value>
1057
+ <value>hasExemplar</value>
1058
+ <value>manifestationOf</value>
1059
+ <value>hasManifestation</value>
1060
+ <value>reproductionOf</value>
1061
+ <value>hasReproduction</value>
1062
+ <value>reprintOf</value>
1063
+ <value>hasReprint</value>
1064
+ <value>expressionOf</value>
1065
+ <value>hasExpression</value>
1066
+ <value>translatedFrom</value>
1067
+ <value>hasTranslation</value>
1068
+ <value>arrangementOf</value>
1069
+ <value>hasArrangement</value>
1070
+ <value>abridgementOf</value>
1071
+ <value>hasAbridgement</value>
1072
+ <value>annotationOf</value>
1073
+ <value>hasAnnotation</value>
1074
+ <value>draftOf</value>
1075
+ <value>hasDraft</value>
1076
+ <value>editionOf</value>
1077
+ <value>hasEdition</value>
1078
+ <value>updates</value>
1079
+ <value>updatedBy</value>
1080
+ <value>derivedFrom</value>
1081
+ <value>derives</value>
1022
1082
  <value>describes</value>
1023
1083
  <value>describedBy</value>
1084
+ <value>catalogues</value>
1085
+ <value>cataloguedBy</value>
1086
+ <value>hasSuccessor</value>
1087
+ <value>successorOf</value>
1088
+ <value>adaptedFrom</value>
1089
+ <value>hasAdaptation</value>
1090
+ <value>adoptedFrom</value>
1091
+ <value>adoptedAs</value>
1092
+ <value>reviewOf</value>
1093
+ <value>hasReview</value>
1094
+ <value>commentaryOf</value>
1095
+ <value>hasCommentary</value>
1096
+ <value>related</value>
1097
+ <value>complements</value>
1098
+ <value>complementOf</value>
1099
+ <value>obsoletes</value>
1100
+ <value>obsoletedBy</value>
1101
+ <value>cited</value>
1102
+ <value>isCitedIn</value>
1024
1103
  </choice>
1025
1104
  </define>
1026
1105
  <define name="docrelation">
@@ -1028,12 +1107,30 @@
1028
1107
  <attribute name="type">
1029
1108
  <ref name="DocRelationType"/>
1030
1109
  </attribute>
1110
+ <optional>
1111
+ <element name="description">
1112
+ <ref name="FormattedString"/>
1113
+ </element>
1114
+ </optional>
1031
1115
  <element name="bibitem">
1032
1116
  <ref name="BibliographicItem"/>
1033
1117
  </element>
1034
- <zeroOrMore>
1035
- <ref name="locality"/>
1036
- </zeroOrMore>
1118
+ <choice>
1119
+ <zeroOrMore>
1120
+ <ref name="locality"/>
1121
+ </zeroOrMore>
1122
+ <zeroOrMore>
1123
+ <ref name="localityStack"/>
1124
+ </zeroOrMore>
1125
+ </choice>
1126
+ <choice>
1127
+ <zeroOrMore>
1128
+ <ref name="sourceLocality"/>
1129
+ </zeroOrMore>
1130
+ <zeroOrMore>
1131
+ <ref name="sourceLocalityStack"/>
1132
+ </zeroOrMore>
1133
+ </choice>
1037
1134
  </element>
1038
1135
  </define>
1039
1136
  <define name="version">
@@ -1,6 +1,24 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
3
  class Converter < ISO::Converter
4
+ STAGE_ABBRS_CN = {
5
+ "00": "新工作项目建议",
6
+ "10": "新工作项目",
7
+ "20": "标准草案工作组讨论稿",
8
+ "30": "标准草案征求意见稿",
9
+ "40": "标准草案送审稿",
10
+ "50": "标准草案报批稿",
11
+ "60": "国家标准",
12
+ "90": "(Review)",
13
+ "95": "(Withdrawal)",
14
+ }.freeze
15
+
16
+ def stage_name(stage, substage)
17
+ return "Proof" if stage == "60" && substage == "00"
18
+ @language == "en" ?
19
+ STAGE_NAMES[stage.to_sym] : STAGE_ABBRS_CN[stage.to_sym]
20
+ end
21
+
4
22
  def doctype(node)
5
23
  type = node.attr("mandate") || "mandatory"
6
24
  type = "standard" if type == "mandatory"
@@ -67,7 +85,8 @@ module Asciidoctor
67
85
  type = node.attr("equivalence") || "equivalent"
68
86
  m = /^(?<code>[^,]+),?(?<title>.*)$/.match isostd
69
87
  title = m[:title].empty? ? "[not supplied]" : m[:title]
70
- xml.relation **{ type: type } do |r|
88
+ xml.relation **{ type: "adoptedFrom" } do |r|
89
+ r.description type
71
90
  r.bibitem do |b|
72
91
  b.title { |t| t << title }
73
92
  b.docidentifier m[:code]
@@ -198,8 +217,8 @@ module Asciidoctor
198
217
  def id_stage_prefix(dn, node)
199
218
  if node.attr("docstage") && node.attr("docstage").to_i < 60
200
219
  abbr = IsoDoc::Gb::Metadata.new("en", "Latn", {}).
201
- status_abbrev(node.attr("docstage"), node.attr("iteration"),
202
- node.attr("draft"))
220
+ status_abbrev(node.attr("docstage"), nil, node.attr("iteration"),
221
+ node.attr("draft"), node.attr("doctype"))
203
222
  dn = "/#{abbr} #{dn}" # prefixes added in cleanup
204
223
  else
205
224
  dn += "-#{node.attr("copyright-year")}" if node.attr("copyright-year")
@@ -220,6 +239,7 @@ module Asciidoctor
220
239
  metadata_committee(node, xml)
221
240
  metadata_ics(node, xml)
222
241
  structured_id(node, xml)
242
+ xml.stagename stage_name(get_stage(node), get_substage(node))
223
243
  metadata_gbtype(node, xml)
224
244
  metadata_gblibraryids(node, xml)
225
245
  end
@@ -67,6 +67,9 @@
67
67
  <ref name="ics"/>
68
68
  </zeroOrMore>
69
69
  <ref name="structuredidentifier"/>
70
+ <optional>
71
+ <ref name="stagename"/>
72
+ </optional>
70
73
  <ref name="gbtype"/>
71
74
  <oneOrMore>
72
75
  <ref name="gbccs"/>
@@ -129,6 +129,9 @@
129
129
  </choice>
130
130
  </attribute>
131
131
  </optional>
132
+ <attribute name="normative">
133
+ <data type="boolean"/>
134
+ </attribute>
132
135
  <optional>
133
136
  <ref name="section-title"/>
134
137
  </optional>
@@ -305,6 +308,21 @@
305
308
  </define>
306
309
  </include>
307
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>
308
326
  <define name="BasicBlock" combine="choice">
309
327
  <choice>
310
328
  <ref name="requirement"/>
@@ -911,7 +929,10 @@
911
929
  </define>
912
930
  <define name="origin">
913
931
  <element name="origin">
914
- <ref name="erefType"/>
932
+ <choice>
933
+ <ref name="erefType"/>
934
+ <ref name="termref"/>
935
+ </choice>
915
936
  </element>
916
937
  </define>
917
938
  <define name="modification">
@@ -919,6 +940,15 @@
919
940
  <ref name="paragraph"/>
920
941
  </element>
921
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>
922
952
  <define name="structuredidentifier">
923
953
  <element name="structuredidentifier">
924
954
  <optional>
@@ -43,6 +43,9 @@
43
43
  <ref name="ics"/>
44
44
  </zeroOrMore>
45
45
  <ref name="structuredidentifier"/>
46
+ <optional>
47
+ <ref name="stagename"/>
48
+ </optional>
46
49
  </define>
47
50
  <define name="bdate">
48
51
  <element name="date">
@@ -260,6 +263,8 @@
260
263
  <value>publicly-available-specification</value>
261
264
  <value>international-workshop-agreement</value>
262
265
  <value>guide</value>
266
+ <value>amendment</value>
267
+ <value>technical-corrigendum</value>
263
268
  </choice>
264
269
  </define>
265
270
  <define name="structuredidentifier">
@@ -511,4 +516,9 @@
511
516
  </oneOrMore>
512
517
  </element>
513
518
  </define>
519
+ <define name="stagename">
520
+ <element name="stagename">
521
+ <text/>
522
+ </element>
523
+ </define>
514
524
  </grammar>
@@ -6,24 +6,6 @@ module Asciidoctor
6
6
  # A {Converter} implementation that generates GB output, and a document
7
7
  # schema encapsulation of the document for validation
8
8
  class Converter < ISO::Converter
9
-
10
- =begin
11
- # subclause contains subclauses
12
- def term_def_subclause_parse(attrs, xml, node)
13
- return clause_parse(attrs, xml, node) if node.role == "nonterm"
14
- sub = node.find_by(context: :section) {|s| s.level == node.level + 1 }
15
- sub.empty? || (return term_def_parse(attrs, xml, node, false))
16
- # TODO allow breakup of "symbols", "abbreviated terms"
17
- (node.title.downcase == "symbols and abbreviated terms" ||
18
- node.title == "符号、代号和缩略语") &&
19
- (return symbols_parse(attrs, xml, node))
20
- xml.term **attr_code(attrs) do |xml_section|
21
- xml_section.preferred { |name| name << node.title }
22
- xml_section << node.content
23
- end
24
- end
25
- =end
26
-
27
9
  def sectiontype_streamline(ret)
28
10
  case ret
29
11
  when "引言" then "introduction"
@@ -40,84 +22,10 @@ module Asciidoctor
40
22
  end
41
23
 
42
24
  def appendix_parse(attrs, xml, node)
25
+ # UNSAFE, there is no unset_option() in asciidoctor
26
+ node.remove_attr("appendix-option")
43
27
  clause_parse(attrs, xml, node)
44
28
  end
45
-
46
- =begin
47
- # spec of permissible section sequence
48
- SEQ = [
49
- { msg: "Initial section must be (content) 前言",
50
- val: [{ tag: "foreword", title: "前言" }], },
51
- { msg: "Prefatory material must be followed by (clause) 范围",
52
- val: [{ tag: "introduction", title: "引言" },
53
- { tag: "clause", title: "范围" }], },
54
- { msg: "Prefatory material must be followed by (clause) 范围",
55
- val: [{ tag: "clause", title: "范围" }], },
56
- { msg: "规范性引用文件 must be followed by "\
57
- "术语和定义",
58
- val: [
59
- { tag: "terms", title: "术语和定义" },
60
- { tag: "clause", title: "术语和定义" },
61
- { tag: "clause",
62
- title: "术语、定义、符号、代号和缩略语" },
63
- { tag: "terms",
64
- title: "术语、定义、符号、代号和缩略语" }
65
- ] },
66
- ]
67
-
68
- SECTIONS_XPATH =
69
- "//foreword | //introduction | //sections/terms | .//annex | "\
70
- "//definitions | //sections/clause | //references[not(parent::clause)] | "\
71
- "//clause[descendant::references][not(parent::clause)]".freeze
72
-
73
- def sections_sequence_validate(root)
74
- f = root.xpath(SECTIONS_XPATH)
75
- names = f.map { |s| { tag: s.name, title: s&.at("./title")&.text } }
76
- names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
77
- n = names[0]
78
- names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val]) || return
79
- if n == { tag: "introduction", title: "引言" }
80
- names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val]) || return
81
- end
82
- names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val]) || return
83
- n = names.shift
84
- if n == { tag: "definitions", title: nil }
85
- n = names.shift || return
86
- end
87
- unless n
88
- warn "ISO style: Document must contain at least one clause"
89
- return
90
- end
91
- n[:tag] == "clause" or
92
- warn "ISO style: Document must contain clause after Terms and Definitions"
93
- (n == { tag: "clause", title: "范围" }) &&
94
- warn("ISO style: 范围 must occur before 术语和定义")
95
- n = names.shift or return
96
- while n[:tag] == "clause"
97
- (n[:title] == "范围") &&
98
- warn("ISO style: 范围 must occur before 术语和定义")
99
- n = names.shift or return
100
- end
101
- unless n[:tag] == "annex" or n[:tag] == "references"
102
- warn "ISO style: Only annexes and references can follow clauses"
103
- end
104
- while n[:tag] == "annex"
105
- n = names.shift
106
- if n.nil?
107
- warn("ISO style: Document must include (references) "\
108
- "Normative References")
109
- return
110
- end
111
- end
112
- n == { tag: "references", title: "规范性引用文件" } or
113
- warn "ISO style: Document must include (references) 规范性引用文件"
114
- n = names.shift
115
- n == { tag: "references", title: "参考文献" } or
116
- warn "ISO style: Final section must be (references) 参考文献"
117
- names.empty? or
118
- warn "ISO style: There are sections after the final Bibliography"
119
- end
120
- =end
121
29
  end
122
30
  end
123
31
  end
@@ -44,8 +44,8 @@ body {
44
44
 
45
45
 
46
46
  h1 {
47
- font-size: 1.5em;
48
- line-height: 2em;
47
+ font-size: 1.5em;
48
+ line-height: 2em;
49
49
  color: #485094;
50
50
  font-weight: 400;
51
51
 
@@ -54,8 +54,8 @@ h1 {
54
54
  }
55
55
 
56
56
  h2 {
57
- font-size: 1.3em;
58
- line-height: 1.5em;
57
+ font-size: 1.3em;
58
+ line-height: 1.5em;
59
59
  color: #485094;
60
60
  font-weight: 300;
61
61
 
@@ -75,8 +75,8 @@ h2 {
75
75
  }
76
76
 
77
77
  h3 {
78
- font-size: 1.1em;
79
- line-height: 1.3em;
78
+ font-size: 1.1em;
79
+ line-height: 1.3em;
80
80
  color: #485094;
81
81
  font-weight: 300;
82
82
  }
@@ -225,7 +225,11 @@ nav {
225
225
  }
226
226
 
227
227
  .document-type-band {
228
- @include docBand($order: 2, $textLength: 210px, $offset: 180px);
228
+ @include docBand($order: 2, $offset: 180px);
229
+
230
+ .document-type {
231
+ top: 20px;
232
+ }
229
233
  }
230
234
 
231
235
  #governance-band p.document-type {
@@ -233,7 +237,6 @@ nav {
233
237
  height: 230px !important;
234
238
  }
235
239
 
236
-
237
240
  // Bibliograhy
238
241
 
239
242
  p.Biblio, p.NormRef {
@@ -249,7 +252,7 @@ p.Biblio, p.NormRef {
249
252
  background-color: #f7f7f7;
250
253
 
251
254
  /*
252
- div.figure > img:not(.logo) {
255
+ div.figure > img:not(.logo) {
253
256
  TODO: ^^^ Relevant selector?
254
257
  margin-left: auto;
255
258
  margin-right: auto;
@@ -1,24 +1,8 @@
1
- <script>
2
- //TOC generation
3
- $('#toc').toc({
4
- 'selectors': toclevel(), //elements to use as headings
5
- 'container': 'main', //element to find all selectors in
6
- 'smoothScrolling': true, //enable or disable smooth scrolling on click
7
- 'prefix': 'toc', //prefix for anchor tags and class names
8
- 'onHighlight': function(el) {}, //called when a new section is highlighted
9
- 'highlightOnScroll': true, //add class to heading that is currently in focus
10
- 'highlightOffset': 100, //offset to trigger the next headline
11
- 'anchorName': function(i, heading, prefix) { //custom function for anchor name
12
- return prefix+i;
13
- },
14
- 'headerText': function(i, heading, $heading) { //custom function building the header-item text
15
- return $heading.text();
16
- },
17
- 'itemClass': function(i, heading, $heading, prefix) { // custom function for item class
18
- return $heading[0].tagName.toLowerCase();
19
- }
20
- });
21
-
1
+ <script>
2
+ $("#toc").on('click', 'li', function(e) {
3
+ $(this).parent().find('li.toc-active').removeClass('toc-active');
4
+ $(this).addClass('toc-active');
5
+ });
22
6
  </script>
23
7
 
24
8
  <script>
@@ -69,5 +53,20 @@ $('#toggle').on('click', function(){
69
53
  });
70
54
  */
71
55
  </script>
72
-
73
-
56
+ <script>
57
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
58
+ //
59
+ // AnchorJS - v4.2.2 - 2020-04-20
60
+ // https://www.bryanbraun.com/anchorjs/
61
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
62
+ //
63
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
64
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
65
+ // @license-end
66
+ </script>
67
+ <script>
68
+ anchors.options = {
69
+ placement: 'left'
70
+ };
71
+ anchors.add('h1, h2, h3, h4');
72
+ </script>
@@ -1,12 +1,13 @@
1
1
  require "isodoc"
2
2
  require "twitter_cldr"
3
3
  require "htmlentities"
4
+ require "metanorma-iso"
4
5
 
5
6
  module IsoDoc
6
7
  module Gb
7
8
  # A {Converter} implementation that generates GB output, and a document
8
9
  # schema encapsulation of the document for validation
9
- class Metadata < IsoDoc::Metadata
10
+ class Metadata < IsoDoc::Iso::Metadata
10
11
  def initialize(lang, script, labels)
11
12
  super
12
13
  set(:docmaintitlezh, "")
@@ -21,6 +22,8 @@ module IsoDoc
21
22
  set(:doctitle, "XXXX")
22
23
  set(:obsoletes, nil)
23
24
  set(:obsoletes_part, nil)
25
+ set(:publisheddate, "XXX")
26
+ set(:implementeddate, "XXX")
24
27
  end
25
28
 
26
29
  def title(isoxml, _out)
@@ -63,19 +66,6 @@ module IsoDoc
63
66
  set(:committee, gbcommittee&.text)
64
67
  end
65
68
 
66
- # from ISO
67
- STAGE_ABBRS = {
68
- "00": "PWI",
69
- "10": "NWIP",
70
- "20": "WD",
71
- "30": "CD",
72
- "40": "DIS",
73
- "50": "FDIS",
74
- "60": "IS",
75
- "90": "(Review)",
76
- "95": "(Withdrawal)",
77
- }.freeze
78
-
79
69
  STAGE_ABBRS_CN = {
80
70
  "00": "新工作项目建议",
81
71
  "10": "新工作项目",
@@ -100,20 +90,11 @@ module IsoDoc
100
90
  "95": "obsolete",
101
91
  }
102
92
 
103
- def stage_abbr(stage)
104
- STAGE_ABBRS[stage.to_sym] || "??"
105
- end
106
-
107
- def status_abbrev(stage, iter, draft)
108
- stage = STAGE_ABBRS[stage.to_sym] || "??"
109
- stage += iter if iter
110
- stage = "Pre" + stage if draft =~ /^0\./
111
- stage
112
- end
113
-
114
- def status_abbrev_cn(stage, iter, draft)
115
- return status_abbrev(stage, iter, draft) if @lang != "zh"
116
- stage = STAGE_ABBRS_CN[stage.to_sym] || "??"
93
+ def status_abbrev_cn(stage, _substage, iter, draft, doctype)
94
+ return status_abbrev(stage, _substage, iter, draft, doctype) if @lang != "zh"
95
+ stage_num = stage == "PRF" ? "60" :
96
+ (Asciidoctor::Gb::Converter::STAGE_ABBRS&.invert[stage]&.to_s || "??")
97
+ stage = STAGE_ABBRS_CN[stage_num.to_sym] || "??"
117
98
  stage = "#{iter.to_i.localize(:zh).spellout.force_encoding("UTF-8")}次#{stage}" if iter
118
99
  stage = "Pre" + HTMLEntities.new.encode(stage, :hexadecimal) if draft =~ /^0\./
119
100
  stage
@@ -125,12 +106,14 @@ module IsoDoc
125
106
  if docstatus
126
107
  set(:stage, docstatus.text.to_i)
127
108
  set(:unpublished, unpublished(docstatus.text))
128
- set(:statusabbr, status_abbrev_cn(docstatus.text,
109
+ set(:statusabbr, status_abbrev_cn(docstatus["abbreviation"],
110
+ isoxml&.at(ns("//bibdata/status/substage"))&.text,
129
111
  isoxml&.at(ns("//bibdata/status/iteration"))&.text,
130
- isoxml&.at(ns("//version/draft"))&.text))
112
+ isoxml&.at(ns("//version/draft"))&.text,
113
+ isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
131
114
  set(:status, STATUS_CSS[docstatus.text.to_sym])
132
115
  unpublished(docstatus.text) and
133
- set(:stageabbr, stage_abbr(docstatus.text))
116
+ set(:stageabbr, docstatus["abbreviation"])
134
117
  end
135
118
  end
136
119
 
@@ -150,15 +133,15 @@ module IsoDoc
150
133
  gb_equivalence(isoxml)
151
134
  end
152
135
 
153
- ISO_STD_XPATH = "//bibdata/relation[@type = 'equivalent' or "\
154
- "@type = 'identical' or @type = 'nonequivalent']/bibitem".freeze
136
+ ISO_STD_XPATH = "//bibdata/relation[xmlns:description[text() = 'equivalent' or "\
137
+ "text() = 'identical' or text() = 'nonequivalent']]/bibitem".freeze
155
138
 
156
139
  def gb_equivalence(isoxml)
157
140
  isostdid = isoxml.at(ns("#{ISO_STD_XPATH}/docidentifier")) || return
158
141
  set(:isostandard, isostdid.text)
159
142
  isostdtitle = isoxml.at(ns("#{ISO_STD_XPATH}/title"))
160
143
  set(:isostandardtitle, isostdtitle.text) if isostdtitle
161
- eq = isoxml.at(ns("//bibdata/relation/@type"))
144
+ eq = isoxml.at(ns("//bibdata/relation/description"))
162
145
  case eq.text
163
146
  when "equivalent" then set(:gbequivalence, "MOD")
164
147
  when "nonequivalent" then set(:gbequivalence, "NEQ")
@@ -207,12 +190,9 @@ module IsoDoc
207
190
  end
208
191
 
209
192
  def gb_library_identifier(isoxml)
210
- ics = []
211
193
  ccs = []
212
- isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
213
194
  isoxml.xpath(ns("//bibdata/ext/ccs")).each { |i| ccs << i.text }
214
195
  p = isoxml.at(ns("//bibdata/ext/plannumber"))
215
- set(:libraryid_ics, ics.empty? ? "XXX" : ics.join(", "))
216
196
  set(:libraryid_ccs, ccs.empty? ? "XXX" : ccs.join(", "))
217
197
  set(:libraryid_plan, p ? p.text : "XXX")
218
198
  end
@@ -2,6 +2,14 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Gb
5
+ def self.fonts_used
6
+ {
7
+ compliant_html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
8
+ html: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
9
+ doc: ["SimSun", "Cambria", "SimHei", "Calibri", "Courier New"],
10
+ }
11
+ end
12
+
5
13
  class Processor < Metanorma::Processor
6
14
 
7
15
  def initialize
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.3.20"
3
+ VERSION = "1.3.25"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.20
4
+ version: 1.3.25
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-04-03 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso