metanorma-gb 1.3.19 → 1.3.24

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: daee15e26a48bc580373f3d97b94ae8df4ae002ca0ca733839f9393c1342325c
4
- data.tar.gz: b7fe019ce181e3b1de58268e4a0a8bd11079754ebbd22ae29bd5eb37269bb0cd
3
+ metadata.gz: f0a0123c03e951fe5b68bba2cbaf8889c7664bdeb6e1cfb36c780b088e61fade
4
+ data.tar.gz: 5ca20d6a8066a8e98c7dd0392e25f1819605142d1d6ec972c5a113698fa0754c
5
5
  SHA512:
6
- metadata.gz: 05373eccae4ad8ecc33b895767e9ee9c15b58105e5c9d045427797e508f0a4e47b877f68a01cefdd54cc410ca763bef9f4c90370c751fcd6cfa798e017c6a68e
7
- data.tar.gz: 4b0a193930a6c8896a9f4273f4c70a96ece6f55a9867c9f4c7510931da5d3d2391303decdefeaff81ab693a6451e69994c399631c96693afd398d74143403077
6
+ metadata.gz: d69b20f91514779cd7701ac4a55341a3102afc0993833cc4abc529e2e72c891260528c4287b15c76eadea3d6224c72caace13ed3ed912918a820052ac88de592
7
+ data.tar.gz: 9980c5929ee17216d83dbbbcdbd7dcc12a563ebec6bc6bdc328977cbee8bfa8a584c32585488a1d52ea86f23305442ad21d315315ba61fb84615174b9c5ec8b6
@@ -1,21 +1,28 @@
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
21
28
  - name: Use Ruby
@@ -1,21 +1,30 @@
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
+ tags:
9
+ - '*'
8
10
  pull_request:
9
- branches: [ '**' ]
11
+ paths-ignore:
12
+ - .github/workflows/macos.yml
13
+ - .github/workflows/windows.yml
10
14
 
11
15
  jobs:
12
16
  test-linux:
13
17
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
18
  runs-on: ubuntu-latest
19
+ continue-on-error: ${{ matrix.experimental }}
15
20
  strategy:
16
21
  fail-fast: false
17
22
  matrix:
18
23
  ruby: [ '2.6', '2.5', '2.4' ]
24
+ experimental: [false]
25
+ include:
26
+ - ruby: '2.7'
27
+ experimental: true
19
28
  steps:
20
29
  - uses: actions/checkout@master
21
30
  - name: Use Ruby
@@ -25,8 +34,20 @@ jobs:
25
34
  architecture: 'x64'
26
35
  - name: Update gems
27
36
  run: |
28
- gem install bundler
37
+ gem install bundler
29
38
  bundle install --jobs 4 --retry 3
30
39
  - name: Run specs
31
40
  run: |
32
41
  bundle exec rake
42
+ - name: Trigger dependent repositories
43
+ if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
44
+ env:
45
+ GH_USERNAME: ${{ secrets.PAT_USERNAME }}
46
+ GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
47
+ run: |
48
+ curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
49
+ [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
50
+ for repo in $DEPENDENT_REPOS
51
+ do
52
+ sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
53
+ done
@@ -1,21 +1,28 @@
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
21
28
  - name: Use Ruby
@@ -26,9 +33,8 @@ jobs:
26
33
  - name: Update gems
27
34
  shell: pwsh
28
35
  run: |
29
- gem install bundler
36
+ gem install bundler
30
37
  bundle config --local path vendor/bundle
31
- bundle update
32
38
  bundle install --jobs 4 --retry 3
33
39
  - name: Run specs
34
40
  run: |
@@ -1,8 +1,9 @@
1
1
  = metanorma-gb: Authoring Chinese standards (GuoBiao, sector...) in AsciiDoc
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-gb.svg["Gem Version", link="https://rubygems.org/gems/metanorma-gb"]
4
- image:https://travis-ci.com/metanorma/metanorma-gb.svg["Build Status", link="https://travis-ci.com/metanorma/metanorma-gb"]
5
- image:https://ci.appveyor.com/api/projects/status/ngoyus5vqalc7v4c?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/metanorma/metanorma-gb"]
4
+ image:https://github.com/metanorma/metanorma-gb/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-gb/actions?workflow=macos"]
5
+ image:https://github.com/metanorma/metanorma-gb/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-gb/actions?workflow=ubuntu"]
6
+ image:https://github.com/metanorma/metanorma-gb/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-gb/actions?workflow=windows"]
6
7
  image:https://codeclimate.com/github/metanorma/metanorma-gb/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-gb"]
7
8
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-gb.svg["Pull Requests", link="https://github.com/metanorma/metanorma-gb/pulls"]
8
9
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-gb/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-gb/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">
@@ -69,7 +69,7 @@ module Asciidoctor
69
69
  html_converter(node).convert(filename + ".xml")
70
70
  doc_converter(node).convert(filename + ".xml")
71
71
  end
72
- @log.write(@filename + ".err") unless @novalid
72
+ @log.write(@localdir + @filename + ".err") unless @novalid
73
73
  @files_to_delete.each { |f| FileUtils.rm f }
74
74
  ret
75
75
  end
@@ -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,7 +217,7 @@ 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"),
220
+ status_abbrev(node.attr("docstage"), nil, node.attr("iteration"),
202
221
  node.attr("draft"))
203
222
  dn = "/#{abbr} #{dn}" # prefixes added in cleanup
204
223
  else
@@ -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"/>
@@ -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>
@@ -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.19"
3
+ VERSION = "1.3.24"
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.19
4
+ version: 1.3.24
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-iso