isodoc 1.0.23 → 1.0.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: 709ee937cab542be14ef994074c62d60df2e26ad5d858fbfd9dc9966f100a9be
4
- data.tar.gz: 809faa2a70a8d982909f15794928b19981f5e3aee33da0afdc9fc81d8a4d030b
3
+ metadata.gz: 50ac1215a8065519d1dbab07c61a8c4e84dbc90923300bef4f6e44e4b9a8a843
4
+ data.tar.gz: b89e80351f424c11fb7cb2b92c838a8b8b05f2791a1f91a1d531b14611632229
5
5
  SHA512:
6
- metadata.gz: 3b3a2e409e96f3f4e79723b06ebce456559280855c384ede05cbc15d5f9e217b7673228190190f1df84cc298ed5c89dd08e22a4eb89df5f1ff95fc978bba91e6
7
- data.tar.gz: 9d26571df295d108788bd45d527e2a9ac8ef4d8f6cc6b7ec1aabc18c508d505e88a09c909f96b1d252274f293dac1950fba9b52359c30625a4c185658a9536a2
6
+ metadata.gz: d5ca6cf434f62383545145ccb02adccc060cc9fc5b79478655a5eaa21ca03332f1032baa87abc670935a586fa2cd957f3b8c9358e40802f33dcbc978e8da4b0a
7
+ data.tar.gz: 01f839c290c1e557a162e2ae43aba2c8ecb291b86664759d72eeacd80b1f338734ce470827cd35485446b589f77b637a5cece6f3118b0855d2494f7537adc1e1
@@ -125,5 +125,5 @@ b, strong {
125
125
  }
126
126
 
127
127
  div.document-stage-band, div.document-type-band {
128
- background-color: #000000;
128
+ background-color: #333333;
129
129
  }
@@ -77,8 +77,8 @@ module IsoDoc::Function
77
77
  end
78
78
 
79
79
  # TODO: move to localization file
80
- def eref_localities1_zh(target, type, from, to)
81
- ret = ", 第#{from.text}" if from
80
+ def eref_localities1_zh(target, type, from, to, delim)
81
+ ret = "#{delim} 第#{from.text}" if from
82
82
  ret += "–#{to}" if to
83
83
  loc = (@locality[type] || type.sub(/^locality:/, "").capitalize )
84
84
  ret += " #{loc}"
@@ -86,9 +86,9 @@ module IsoDoc::Function
86
86
  end
87
87
 
88
88
  # TODO: move to localization file
89
- def eref_localities1(target, type, from, to, lang = "en")
90
- return l10n(eref_localities1_zh(target, type, from, to)) if lang == "zh"
91
- ret = ","
89
+ def eref_localities1(target, type, from, to, delim, lang = "en")
90
+ return l10n(eref_localities1_zh(target, type, from, to, delim)) if lang == "zh"
91
+ ret = delim
92
92
  loc = @locality[type] || type.sub(/^locality:/, "").capitalize
93
93
  ret += " #{loc}"
94
94
  ret += " #{from.text}" if from
@@ -55,12 +55,12 @@ module IsoDoc::Function
55
55
  end
56
56
 
57
57
  def get_linkend(node)
58
- contents = node.children.select { |c| c.name != "locality" }.
58
+ contents = node.children.select { |c| !%w{locality localityStack}.include? c.name }.
59
59
  select { |c| !c.text? || /\S/.match(c) }
60
60
  !contents.empty? and
61
61
  return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
62
62
  link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
63
- link + eref_localities(node.xpath(ns("./locality")), link)
63
+ link + eref_localities(node.xpath(ns("./locality | ./localityStack")), link)
64
64
  # so not <origin bibitemid="ISO7301" citeas="ISO 7301">
65
65
  # <locality type="section"><reference>3.1</reference></locality></origin>
66
66
  end
@@ -73,16 +73,29 @@ module IsoDoc::Function
73
73
 
74
74
  def eref_localities(refs, target)
75
75
  ret = ""
76
- refs.each do |r|
77
- ret += if r["type"] == "whole" then l10n(", #{@whole_of_text}")
78
- else
79
- eref_localities1(target, r["type"], r.at(ns("./referenceFrom")),
80
- r.at(ns("./referenceTo")), @lang)
81
- end
76
+ refs.each_with_index do |r, i|
77
+ delim = ","
78
+ delim = ";" if r.name == "localityStack" && i>0
79
+ if r.name == "localityStack"
80
+ r.elements.each_with_index do |rr, j|
81
+ ret += eref_localities0(rr, j, target, delim)
82
+ delim = ","
83
+ end
84
+ else
85
+ ret += eref_localities0(r, i, target, delim)
86
+ end
82
87
  end
83
88
  ret
84
89
  end
85
90
 
91
+ def eref_localities0(r, i, target, delim)
92
+ if r["type"] == "whole" then l10n("#{delim} #{@whole_of_text}")
93
+ else
94
+ eref_localities1(target, r["type"], r.at(ns("./referenceFrom")),
95
+ r.at(ns("./referenceTo")), delim, @lang)
96
+ end
97
+ end
98
+
86
99
  def eref_parse(node, out)
87
100
  linkend = get_linkend(node)
88
101
  if node["type"] == "footnote"
@@ -99,7 +112,7 @@ module IsoDoc::Function
99
112
  end
100
113
 
101
114
  def concept_parse(node, out)
102
- content = node.first_element_child.children.select { |c| c.name != "locality" }.
115
+ content = node.first_element_child.children.select { |c| !%w{locality localityStack}.include? c.name }.
103
116
  select { |c| !c.text? || /\S/.match(c) }
104
117
  if content.empty?
105
118
  out << "[Term defined in "
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.0.23".freeze
2
+ VERSION = "1.0.24".freeze
3
3
  end
@@ -126,13 +126,31 @@ RSpec.describe IsoDoc do
126
126
  </concept></li>
127
127
  <li><concept>
128
128
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
129
+ <localityStack>
129
130
  <locality type='clause'>
130
131
  <referenceFrom>3.1</referenceFrom>
131
132
  </locality>
133
+ </localityStack>
134
+ <localityStack>
132
135
  <locality type='figure'>
133
- <referenceFrom>a</referenceFrom>
136
+ <referenceFrom>b</referenceFrom>
137
+ </locality>
138
+ </localityStack>
139
+ </eref>
140
+ </concept></li>
141
+ <li><concept>
142
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
143
+ <localityStack>
144
+ <locality type='clause'>
145
+ <referenceFrom>3.1</referenceFrom>
146
+ </locality>
147
+ </localityStack>
148
+ <localityStack>
149
+ <locality type='figure'>
150
+ <referenceFrom>b</referenceFrom>
134
151
  </locality>
135
- <em>word</em>
152
+ </localityStack>
153
+ <em>word</em>
136
154
  </eref>
137
155
  </concept></li>
138
156
  <li><concept term='term'>
@@ -180,6 +198,9 @@ RSpec.describe IsoDoc do
180
198
  <li>
181
199
  [Term defined in <a href='#ISO712'>ISO 712, Clause 3.1, Figure a</a>]
182
200
  </li>
201
+ <li>
202
+ [Term defined in <a href='#ISO712'>ISO 712, Clause 3.1; Figure b</a>]
203
+ </li>
183
204
  <li>
184
205
  <i>word</i>
185
206
  </li>
@@ -436,6 +457,8 @@ OUTPUT
436
457
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
437
458
  <eref type="inline" bibitemid="ISO712"/>
438
459
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
460
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
461
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
439
462
  <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
440
463
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
441
464
  <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
@@ -469,6 +492,8 @@ OUTPUT
469
492
  <a href="#ISO712">ISO 712</a>
470
493
  <a href="#ISO712">ISO 712</a>
471
494
  <a href="#ISO712">ISO 712, Table 1</a>
495
+ <a href='#ISO712'>ISO 712, Table 1</a>
496
+ <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
472
497
  <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
473
498
  <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
474
499
  <a href="#ISO712">ISO 712, Clause 1</a>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.23
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
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: asciimath