metanorma-gb 1.3.20 → 1.3.21

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: 9572e4b6c6d084df727b40bfc2827cdba1e9238f2905213753166091ce6d7fb6
4
+ data.tar.gz: 0cc451ec6098c3fcaeb4d7f246cec4b623f2a2ce7a2ae9b9600f453163814767
5
5
  SHA512:
6
- metadata.gz: eabebfbb64e5f20f27549340754c8f6ad6d24a3b61d4b9e299e35a35057ac7a88ac848785f3d3e3eb6589ff08005a36bfebc4fb28f31e0bdf0a8eb21087e1645
7
- data.tar.gz: 13e00179ec95b0cdc6bd4bbbcb2d19e8c0a9eacc8c7617a9d87fa74fcefeaac4fa69079ced0013dcc1c044ff79185e8b7043effbe9b2cb8e0bee6ae1d217f1c8
6
+ metadata.gz: f62662c60f2f0bea290ae7bcc81cb17af9e7738f31305a90cdc9ce7259e8f2d6a31fb2596cc7e735e21cf62d3c20f240fced43f552ec04a8b359ae778b742e80
7
+ data.tar.gz: 15727819f77f7d1b9456377f5c6aa22b4fbe4e900a9fd6de656dcd0015ea0125ecad379f3079adeefa3092d0d93fbe9c5ed6b3ab5113a0f089403f04aa678f84
@@ -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>
@@ -452,9 +458,14 @@
452
458
  <attribute name="bibitemid">
453
459
  <data type="IDREF"/>
454
460
  </attribute>
455
- <zeroOrMore>
456
- <ref name="locality"/>
457
- </zeroOrMore>
461
+ <choice>
462
+ <zeroOrMore>
463
+ <ref name="locality"/>
464
+ </zeroOrMore>
465
+ <zeroOrMore>
466
+ <ref name="localityStack"/>
467
+ </zeroOrMore>
468
+ </choice>
458
469
  <optional>
459
470
  <ref name="date"/>
460
471
  </optional>
@@ -469,6 +480,25 @@
469
480
  <ref name="BibItemLocality"/>
470
481
  </element>
471
482
  </define>
483
+ <define name="localityStack">
484
+ <element name="localityStack">
485
+ <zeroOrMore>
486
+ <ref name="locality"/>
487
+ </zeroOrMore>
488
+ </element>
489
+ </define>
490
+ <define name="sourceLocality">
491
+ <element name="sourceLocality">
492
+ <ref name="BibItemLocality"/>
493
+ </element>
494
+ </define>
495
+ <define name="sourceLocalityStack">
496
+ <element name="sourceLocalityStack">
497
+ <zeroOrMore>
498
+ <ref name="sourceLocality"/>
499
+ </zeroOrMore>
500
+ </element>
501
+ </define>
472
502
  <define name="BibItemLocality">
473
503
  <attribute name="type">
474
504
  <ref name="LocalityType"/>
@@ -1028,12 +1058,30 @@
1028
1058
  <attribute name="type">
1029
1059
  <ref name="DocRelationType"/>
1030
1060
  </attribute>
1061
+ <optional>
1062
+ <element name="description">
1063
+ <ref name="FormattedString"/>
1064
+ </element>
1065
+ </optional>
1031
1066
  <element name="bibitem">
1032
1067
  <ref name="BibliographicItem"/>
1033
1068
  </element>
1034
- <zeroOrMore>
1035
- <ref name="locality"/>
1036
- </zeroOrMore>
1069
+ <choice>
1070
+ <zeroOrMore>
1071
+ <ref name="locality"/>
1072
+ </zeroOrMore>
1073
+ <zeroOrMore>
1074
+ <ref name="localityStack"/>
1075
+ </zeroOrMore>
1076
+ </choice>
1077
+ <choice>
1078
+ <zeroOrMore>
1079
+ <ref name="sourceLocality"/>
1080
+ </zeroOrMore>
1081
+ <zeroOrMore>
1082
+ <ref name="sourceLocalityStack"/>
1083
+ </zeroOrMore>
1084
+ </choice>
1037
1085
  </element>
1038
1086
  </define>
1039
1087
  <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]
@@ -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"/>
@@ -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">
@@ -511,4 +514,9 @@
511
514
  </oneOrMore>
512
515
  </element>
513
516
  </define>
517
+ <define name="stagename">
518
+ <element name="stagename">
519
+ <text/>
520
+ </element>
521
+ </define>
514
522
  </grammar>
@@ -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,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)
94
+ return status_abbrev(stage, _substage, iter, draft) 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,13 @@ 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
112
  isoxml&.at(ns("//version/draft"))&.text))
131
113
  set(:status, STATUS_CSS[docstatus.text.to_sym])
132
114
  unpublished(docstatus.text) and
133
- set(:stageabbr, stage_abbr(docstatus.text))
115
+ set(:stageabbr, docstatus["abbreviation"])
134
116
  end
135
117
  end
136
118
 
@@ -150,15 +132,15 @@ module IsoDoc
150
132
  gb_equivalence(isoxml)
151
133
  end
152
134
 
153
- ISO_STD_XPATH = "//bibdata/relation[@type = 'equivalent' or "\
154
- "@type = 'identical' or @type = 'nonequivalent']/bibitem".freeze
135
+ ISO_STD_XPATH = "//bibdata/relation[xmlns:description[text() = 'equivalent' or "\
136
+ "text() = 'identical' or text() = 'nonequivalent']]/bibitem".freeze
155
137
 
156
138
  def gb_equivalence(isoxml)
157
139
  isostdid = isoxml.at(ns("#{ISO_STD_XPATH}/docidentifier")) || return
158
140
  set(:isostandard, isostdid.text)
159
141
  isostdtitle = isoxml.at(ns("#{ISO_STD_XPATH}/title"))
160
142
  set(:isostandardtitle, isostdtitle.text) if isostdtitle
161
- eq = isoxml.at(ns("//bibdata/relation/@type"))
143
+ eq = isoxml.at(ns("//bibdata/relation/description"))
162
144
  case eq.text
163
145
  when "equivalent" then set(:gbequivalence, "MOD")
164
146
  when "nonequivalent" then set(:gbequivalence, "NEQ")
@@ -207,12 +189,9 @@ module IsoDoc
207
189
  end
208
190
 
209
191
  def gb_library_identifier(isoxml)
210
- ics = []
211
192
  ccs = []
212
- isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
213
193
  isoxml.xpath(ns("//bibdata/ext/ccs")).each { |i| ccs << i.text }
214
194
  p = isoxml.at(ns("//bibdata/ext/plannumber"))
215
- set(:libraryid_ics, ics.empty? ? "XXX" : ics.join(", "))
216
195
  set(:libraryid_ccs, ccs.empty? ? "XXX" : ccs.join(", "))
217
196
  set(:libraryid_plan, p ? p.text : "XXX")
218
197
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Gb
3
- VERSION = "1.3.20"
3
+ VERSION = "1.3.21"
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.21
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-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso