isodoc 0.8.11 → 0.8.13

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: 9ae7f6c154716e6a0096058610667183d6f1b963bcc53349384bfc467266bf25
4
- data.tar.gz: 0bc77874b82d3ab7212d15a3334402070e7c5d54e9f3b32a66c664535761901c
3
+ metadata.gz: 3dcfbcdf85aacca4db89d1d07e4ec3f6e79ac4d28b9f45a5bf492c0140140738
4
+ data.tar.gz: 83450383455cb7d112a2e01d511dcf67e3fccba73b83191561849d4e7160bb01
5
5
  SHA512:
6
- metadata.gz: 32ff1b4b21ee64655f5c8f5fc85654322934342fe2800a99b7f3f01c4c47e259e2aa707c6ba60c2f8181bdb3a280e8652ccc841fca04d2c4b0a6794dbecfd654
7
- data.tar.gz: e9a3bf1c450308324e884095aff193e92b7c77ed114d0c35790a47dcb618e70e433199031bd76ba448fbd01b4ca59076e0d29231e2d0a5c6c78738f1405e3426
6
+ metadata.gz: 7dd24994b056371af1e7f6df7163681b392cf87473200036bd61036244ca97fc62c3d1ee8cd5ab23dbd3e252e6cdcc73767921cb9d19cbea4264c20ca0408d44
7
+ data.tar.gz: 9a56c3dc70f1139639749b11c875372447c53656705827d7450492f43476e9f4589953e7cc4a305d8e4523a80daa4be0c6bb8b6cbaa78917d2c2cf8c9ac9ee66
data/README.adoc CHANGED
@@ -24,6 +24,7 @@ htmlstylesheet:: Stylesheet for HTML output
24
24
  htmlcoverpage:: Cover page for HTML output
25
25
  htmlintropage:: Introductory page for HTML output
26
26
  scripts:: Scripts page for HTML output
27
+ scripts-pdf:: Scripts page for HTML > PDF output
27
28
  wordstylesheet:: Stylesheet for Word output
28
29
  standardstylesheet:: Secondary stylesheet for Word output
29
30
  header:: Header file for Word output
@@ -51,7 +51,7 @@ example: EXAMPLE
51
51
  example_xref: Example
52
52
  where: where
53
53
  wholeoftext: Whole of text
54
- draft: draft
54
+ draft_label: draft
55
55
  inform_annex: informative
56
56
  norm_annex: normative
57
57
  modified: modified
@@ -44,7 +44,7 @@ example: EXEMPLE
44
44
  example_xref: Exemple
45
45
  where: où
46
46
  wholeoftext: Ensemble du texte
47
- draft: brouillon
47
+ draft_label: brouillon
48
48
  inform_annex: informative
49
49
  norm_annex: normative
50
50
  modified: modifié
@@ -44,7 +44,7 @@ example: 示例
44
44
  example_xref: 示例
45
45
  where: 式中
46
46
  wholeoftext: 全部
47
- draft: 稿
47
+ draft_label: 稿
48
48
  inform_annex: 资料性附录
49
49
  norm_annex: 规范性附录
50
50
  modified: 改写
@@ -34,6 +34,7 @@ module IsoDoc
34
34
  @htmlintropage = options[:htmlintropage]
35
35
  @wordintropage = options[:wordintropage]
36
36
  @scripts = options[:scripts]
37
+ @scripts_pdf = options[:scripts_pdf]
37
38
  @i18nyaml = options[:i18nyaml]
38
39
  @ulstyle = options[:ulstyle]
39
40
  @olstyle = options[:olstyle]
@@ -53,7 +53,7 @@ module IsoDoc::Function
53
53
  @example_xref_lbl = y["example_xref"]
54
54
  @where_lbl = y["where"]
55
55
  @wholeoftext_lbl = y["wholeoftext"]
56
- @draft_lbl = y["draft"]
56
+ @draft_lbl = y["draft_label"]
57
57
  @inform_annex_lbl = y["inform_annex"]
58
58
  @norm_annex_lbl = y["norm_annex"]
59
59
  @modified_lbl = y["modified"]
@@ -5,16 +5,16 @@ module IsoDoc::Function
5
5
  # references anyway; keeping here instead of in IsoDoc::Iso for now
6
6
  def docid_l10n(x)
7
7
  return x if x.nil?
8
- x.gsub(/All Parts/, @all_parts_lbl)
8
+ x.gsub(/All Parts/, @all_parts_lbl.downcase)
9
9
  end
10
10
 
11
11
  def iso_bibitem_ref_code(b)
12
12
  isocode = b.at(ns("./docidentifier")).text
13
13
  isodate = b.at(ns("./date[@type = 'published']"))
14
- iso_allparts = b.at(ns("./allparts"))
14
+ allparts = b.at(ns("./allparts"))
15
15
  reference = docid_l10n(isocode)
16
16
  reference += ":#{date_range(isodate)}" if isodate
17
- reference += " (#{@all_parts_lbl})" if iso_allparts&.text == "true"
17
+ reference += " (#{@all_parts_lbl.downcase})" if allparts&.text == "true"
18
18
  reference
19
19
  end
20
20
 
@@ -128,6 +128,11 @@ module IsoDoc::Function
128
128
  Liquid::Template.parse(doc)
129
129
  end
130
130
 
131
+ def empty2nil(v)
132
+ return nil if !v.nil? && v.is_a?(String) && v.empty?
133
+ v
134
+ end
135
+
131
136
  def populate_template(docxml, _format)
132
137
  meta = @meta.get.merge(@labels)
133
138
  docxml = docxml.
@@ -135,7 +140,7 @@ module IsoDoc::Function
135
140
  gsub(/\s*\[\/TERMREF\]\s*/, l10n("]")).
136
141
  gsub(/\s*\[MODIFICATION\]/, l10n(", #{@modified_lbl} — "))
137
142
  template = liquid(docxml)
138
- template.render(meta.map { |k, v| [k.to_s, v] }.to_h)
143
+ template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h)
139
144
  end
140
145
  end
141
146
  end
@@ -204,7 +204,6 @@ module IsoDoc::HtmlFunction
204
204
  end
205
205
 
206
206
  def move_image1(i, new_full_filename)
207
- #system "cp #{i['src']} #{new_full_filename}"
208
207
  FileUtils.cp i["src"], new_full_filename
209
208
  i["src"] = new_full_filename
210
209
  i["width"], i["height"] = Html2Doc.image_resize(i, @maxheight, @maxwidth)
@@ -41,8 +41,8 @@ module IsoDoc
41
41
  end
42
42
 
43
43
  def tc(xml)
44
- tc_num = xml.at(ns("//editorialgroup/technical-committee/@number"))
45
- tc_type = xml.at(ns("//editorialgroup/technical-committee/@type"))&.
44
+ tc_num = xml.at(ns("//bibdata/editorialgroup/technical-committee/@number"))
45
+ tc_type = xml.at(ns("//bibdata/editorialgroup/technical-committee/@type"))&.
46
46
  text || "TC"
47
47
  if tc_num
48
48
  tcid = "#{tc_type} #{tc_num.text}"
@@ -52,8 +52,8 @@ module IsoDoc
52
52
  end
53
53
 
54
54
  def sc(xml)
55
- sc_num = xml.at(ns("//editorialgroup/subcommittee/@number"))
56
- sc_type = xml.at(ns("//editorialgroup/subcommittee/@type"))&.text || "SC"
55
+ sc_num = xml.at(ns("//bibdata/editorialgroup/subcommittee/@number"))
56
+ sc_type = xml.at(ns("//bibdata/editorialgroup/subcommittee/@type"))&.text || "SC"
57
57
  if sc_num
58
58
  scid = "#{sc_type} #{sc_num.text}"
59
59
  set(:sc, scid)
@@ -62,8 +62,8 @@ module IsoDoc
62
62
  end
63
63
 
64
64
  def wg(xml)
65
- wg_num = xml.at(ns("//editorialgroup/workgroup/@number"))
66
- wg_type = xml.at(ns("//editorialgroup/workgroup/@type"))&.text || "WG"
65
+ wg_num = xml.at(ns("//bibdata/editorialgroup/workgroup/@number"))
66
+ wg_type = xml.at(ns("//bibdata/editorialgroup/workgroup/@type"))&.text || "WG"
67
67
  if wg_num
68
68
  wgid = "#{wg_type} #{wg_num.text}"
69
69
  set(:wg, wgid)
@@ -72,7 +72,7 @@ module IsoDoc
72
72
  end
73
73
 
74
74
  def secretariat(xml)
75
- sec = xml.at(ns("//editorialgroup/secretariat"))
75
+ sec = xml.at(ns("//bibdata/editorialgroup/secretariat"))
76
76
  set(:secretariat, sec.text) if sec
77
77
  end
78
78
 
@@ -112,9 +112,9 @@ module IsoDoc
112
112
  end
113
113
 
114
114
  def docnumber(isoxml)
115
- docnumber = isoxml.at(ns("//project-number"))
116
- partnumber = isoxml.at(ns("//project-number/@part"))
117
- subpartnumber = isoxml.at(ns("//project-number/@subpart"))
115
+ docnumber = isoxml.at(ns("//bibdata/docidentifier/project-number"))
116
+ partnumber = isoxml.at(ns("//bibdata/docidentifier/project-number/@part"))
117
+ subpartnumber = isoxml.at(ns("//bibdata/docidentifier/project-number/@subpart"))
118
118
  dn = docnumber&.text || ""
119
119
  dn += "-#{partnumber.text}" if partnumber
120
120
  dn += "-#{subpartnumber.text}" if subpartnumber
@@ -144,7 +144,7 @@ module IsoDoc
144
144
  def draftinfo(draft, revdate)
145
145
  draftinfo = ""
146
146
  if draft
147
- draftinfo = " (#{@labels["draft"]} #{draft}"
147
+ draftinfo = " (#{@labels["draft_label"]} #{draft}"
148
148
  draftinfo += ", #{revdate}" if revdate
149
149
  draftinfo += ")"
150
150
  end
@@ -152,7 +152,7 @@ module IsoDoc
152
152
  end
153
153
 
154
154
  def version(isoxml, _out)
155
- set(:docyear, isoxml&.at(ns("//copyright/from"))&.text)
155
+ set(:docyear, isoxml&.at(ns("//bibdata/copyright/from"))&.text)
156
156
  set(:draft, isoxml&.at(ns("//version/draft"))&.text)
157
157
  set(:revdate, isoxml&.at(ns("//version/revision-date"))&.text)
158
158
  set(:draftinfo,
@@ -160,7 +160,7 @@ module IsoDoc
160
160
  end
161
161
 
162
162
  def title(isoxml, _out)
163
- main = isoxml&.at(ns("//title[@language='en']"))&.text
163
+ main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
164
164
  set(:doctitle, main)
165
165
  end
166
166
 
@@ -11,7 +11,9 @@ module IsoDoc
11
11
  include HtmlFunction::Html
12
12
 
13
13
  def initialize(options)
14
+ @standardstylesheet = nil
14
15
  super
16
+ @scripts = @scripts_pdf if @scripts_pdf
15
17
  @tmpimagedir = "_pdfimages"
16
18
  @maxwidth = 500
17
19
  @maxheight = 800
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.8.11".freeze
2
+ VERSION = "0.8.13".freeze
3
3
  end
@@ -6,7 +6,9 @@ RSpec.describe IsoDoc do
6
6
  system "rm -f test.html"
7
7
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
+ <bibdata>
9
10
  <title language="en">test</title>
11
+ </bibdata>
10
12
  <preface><foreword>
11
13
  <note>
12
14
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
@@ -94,7 +94,7 @@ RSpec.describe IsoDoc do
94
94
  <h1>1.&#160; Normative references</h1>
95
95
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
96
96
  <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
97
- <p id="ISO16634" class="NormRef">ISO 16634:-- (All Parts)<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a>, <i> Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
97
+ <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a>, <i> Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
98
98
  <p id="ISO20483" class="NormRef">ISO 20483:2013&#8211;2014, <i> Cereals and pulses</i></p>
99
99
  <p id="ref1" class="NormRef">ICC 167, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
100
100
  </div>
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: 0.8.11
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-01 00:00:00.000000000 Z
11
+ date: 2018-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath