isodoc 2.1.3 → 2.1.4

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: 3bf48bda8bc7d17d20a766f93c30bcf9f6e7e597497f8663f2c96ff292ada4f5
4
- data.tar.gz: 7efd7f5c3aff9ee37fc631eecd1a564213ab56f92780807d1dff2b17e05c402b
3
+ metadata.gz: 214cd3cfadc0aeca476766aff0722c06a46b5410beedbb9a49fd47ed15249850
4
+ data.tar.gz: f0e79db9f9dd1b456da5ba4eda163e7189509236e45f688faa92fcf821c158de
5
5
  SHA512:
6
- metadata.gz: 449d645dc7a4caaf2cd778dedfa4bb995344c3c83b076abbe4ea971b32d6fc9515ee7ae1140d76dfbc5f2c01220513979ea239c095fc2037b84263996a728e4f
7
- data.tar.gz: 2031af0175ba1ba995fe3cca887180fa0e0d097dcfd6e2afb51eb7dc60ad8934bfbf4fc17dd9f91f1f2fba8e63e46efd8cee7a2fb2e9693d3f3f804ef432f662
6
+ metadata.gz: 2e57a7551ccebc9fedc40520a1ff96d87d25de8f4c3501400d9cfdac41d4e0014f25e9b5a7d0eb9c03c6c3cf0c0a0dd3a992327591ecfcb474c6c7c369377e15
7
+ data.tar.gz: 630fb8c95eccafb843d2f25459494705087dde8c4fe857be5183fdab62eb71da7fb9211d2bbe2dc30c67a87e4ce199c200c9a53eabf5ba90a74e249005f8d997
@@ -19,7 +19,8 @@ module IsoDoc
19
19
  ref << (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
20
20
  ref << ", #{idents[sdo]}" if idents[:ordinal] && idents[:sdo]
21
21
  end
22
- ref << ", " unless biblio && !idents[:sdo]
22
+ ref << "," if idents[:sdo]
23
+ ref << " "
23
24
  reference_format(bib, ref)
24
25
  end
25
26
  end
@@ -34,7 +35,8 @@ module IsoDoc
34
35
  idents[:metanorma]) && idents[:sdo]
35
36
  end
36
37
  date_note_process(bib, ref)
37
- ref << ", " unless biblio && !idents[:sdo]
38
+ ref << "," if idents[:sdo]
39
+ ref << " "
38
40
  reference_format(bib, ref)
39
41
  end
40
42
  end
@@ -48,13 +50,21 @@ module IsoDoc
48
50
  end
49
51
 
50
52
  def pref_ref_code(bib)
51
- ret = bib.xpath(ns("./docidentifier[@primary = 'true']"))
53
+ return nil if bib["suppress_identifier"] == "true"
54
+
55
+ ret = bib.xpath(ns("./docidentifier[@primary = 'true'][@language = '#{@lang}']"))
56
+ ret.empty? and
57
+ ret = bib.xpath(ns("./docidentifier[@primary = 'true']"))
52
58
  ret.empty? and
53
59
  ret = bib.at(ns("./docidentifier[not(@type = 'DOI' or "\
54
60
  "@type = 'metanorma' "\
55
61
  "or @type = 'metanorma-ordinal' or "\
56
- "@type = 'ISSN' or @type = 'ISBN' or "\
57
- "@type = 'rfc-anchor')]"))
62
+ "@type = 'ISSN' or @type = 'ISBN')]"\
63
+ "[@language = '#{@lang}']")) ||
64
+ bib.at(ns("./docidentifier[not(@type = 'DOI' or "\
65
+ "@type = 'metanorma' "\
66
+ "or @type = 'metanorma-ordinal' or "\
67
+ "@type = 'ISSN' or @type = 'ISBN')]"))
58
68
  ret
59
69
  end
60
70
 
@@ -66,6 +76,7 @@ module IsoDoc
66
76
  "@type = 'ISBN']"))
67
77
  id3 = bib.at(ns("./docidentifier[@type = 'metanorma-ordinal']"))
68
78
  return [id, id1, id2, id3] if id || id1 || id2 || id3
79
+ return [nil, nil, nil, nil] if bib["suppress_identifier"] == "true"
69
80
 
70
81
  id = Nokogiri::XML::Node.new("docidentifier", bib.document)
71
82
  id << "(NO ID)"
@@ -20,8 +20,8 @@ module IsoDoc
20
20
  node.children.first.previous = "<#{elem}></#{elem}>"
21
21
  name = node.children.first
22
22
  end
23
- if name.children.empty? then name.add_child(cleanup_entities(number))
24
- else (name.children.first.previous = "#{number}#{delim}")
23
+ if name.children.empty? then name.add_child(cleanup_entities(number.strip))
24
+ else (name.children.first.previous = "#{number.strip}#{delim}")
25
25
  end
26
26
  end
27
27
 
@@ -11,7 +11,8 @@ module IsoDoc
11
11
  end
12
12
 
13
13
  def clause1(elem)
14
- level = @xrefs.anchor(elem["id"], :level, false) || "1"
14
+ level = @xrefs.anchor(elem["id"], :level, false) ||
15
+ (elem.ancestors("clause, annex").size + 1)
15
16
  t = elem.at(ns("./title")) and t["depth"] = level
16
17
  return if !elem.ancestors("boilerplate").empty? ||
17
18
  @suppressheadingnumbers || elem["unnumbered"]
@@ -91,15 +92,26 @@ module IsoDoc
91
92
 
92
93
  def bibrender(xml)
93
94
  if f = xml.at(ns("./formattedref"))
94
- code = render_identifier(bibitem_ref_code(xml))
95
- f << " [#{code[:sdo]}] " if code[:sdo]
96
- else
97
- xml.children =
98
- "#{bibrenderer.render(xml.to_xml)}"\
99
- "#{xml.xpath(ns('./docidentifier | ./uri | ./note')).to_xml}"
95
+ bibrender_formattedref(f, xml)
96
+ else bibrender_relaton(xml)
100
97
  end
101
98
  end
102
99
 
100
+ def bibrender_formattedref(formattedref, xml)
101
+ code = render_identifier(bibitem_ref_code(xml))
102
+ (code[:sdo] && xml["suppress_identifier"] != "true") and
103
+ formattedref << " [#{code[:sdo]}] "
104
+ end
105
+
106
+ def bibrender_relaton(xml)
107
+ bib = xml.dup
108
+ bib["suppress_identifier"] == true and
109
+ bib.xpath(ns("./docidentifier")).each(&:remove)
110
+ xml.children =
111
+ "#{bibrenderer.render(bib.to_xml)}"\
112
+ "#{xml.xpath(ns('./docidentifier | ./uri | ./note')).to_xml}"
113
+ end
114
+
103
115
  def bibrenderer
104
116
  ::Relaton::Render::IsoDoc::General.new(language: @lang)
105
117
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.1.3".freeze
2
+ VERSION = "2.1.4".freeze
3
3
  end
@@ -176,7 +176,7 @@ module IsoDoc
176
176
  div.p **{ class: "Note" } do |p|
177
177
  if name
178
178
  name.children.each { |n| parse(n, p) }
179
- p << l10n(": ")
179
+ p << termnote_delim
180
180
  end
181
181
  para_then_remainder(node.first_element_child, node, p, div)
182
182
  end
@@ -88,11 +88,20 @@ module IsoDoc
88
88
  word_pseudocode_cleanup(docxml)
89
89
  word_image_caption(docxml)
90
90
  word_section_breaks(docxml)
91
+ word_tab_clean(docxml)
91
92
  authority_cleanup(docxml)
92
93
  word_footnote_format(docxml)
93
94
  docxml
94
95
  end
95
96
 
97
+ def word_tab_clean(docxml)
98
+ docxml.xpath("//p[@class='Biblio']//span[@style='mso-tab-count:1']")
99
+ .each do |s|
100
+ s.next.text? or next
101
+ s.next.replace(s.next.text.sub(/^\s+/, ""))
102
+ end
103
+ end
104
+
96
105
  def word_colgroup(docxml)
97
106
  cells2d = {}
98
107
  docxml.xpath("//table[colgroup]").each do |t|
@@ -94,6 +94,7 @@ admonition:
94
94
  caution: حذر
95
95
  important: مهم
96
96
  safety precautions: احتياطات السلامة
97
+ editorial: ملاحظة تحريرية
97
98
  locality:
98
99
  section: قسم
99
100
  clause: فقرة
@@ -99,7 +99,8 @@ admonition: {
99
99
  warning: Warnung,
100
100
  caution: Vorsicht,
101
101
  important: Wichtig,
102
- safety precautions: Sicherheitsvorkehrungen
102
+ safety precautions: Sicherheitsvorkehrungen,
103
+ editorial: Redaktioneller Hinweis
103
104
  }
104
105
  locality: {
105
106
  section: Abschnitt,
@@ -99,7 +99,8 @@ admonition: {
99
99
  warning: Warning,
100
100
  caution: Caution,
101
101
  important: Important,
102
- safety precautions: Safety Precautions
102
+ safety precautions: Safety Precautions,
103
+ editorial: Editorial Note
103
104
  }
104
105
  locality: {
105
106
  section: Section,
@@ -99,7 +99,8 @@ admonition: {
99
99
  warning: Advertencia,
100
100
  caution: Precaución,
101
101
  important: Importante,
102
- safety precautions: Precauciones de seguridad
102
+ safety precautions: Precauciones de seguridad,
103
+ editorial: Note editorial
103
104
  }
104
105
  locality: {
105
106
  section: Sección,
@@ -98,6 +98,7 @@ admonition: {
98
98
  caution: Attention,
99
99
  important: Important,
100
100
  safety precautions: Précautions de Sécurité,
101
+ editorial: Note éditoriale
101
102
  }
102
103
  locality: {
103
104
  section: Section,
@@ -104,7 +104,8 @@ admonition: {
104
104
  warning: Предупреждение,
105
105
  caution: Предостережение,
106
106
  important: Важно,
107
- safety precautions: Меры безопасности
107
+ safety precautions: Меры безопасности,
108
+ editorial: Редакционная Заметка
108
109
  }
109
110
  locality: {
110
111
  section: Раздел,
@@ -95,6 +95,7 @@ admonition: {
95
95
  caution: 注意,
96
96
  important: 重要,
97
97
  safety precautions: 安全须知,
98
+ editorial: 编辑说明
98
99
  }
99
100
  locality: {
100
101
  section: 条,
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: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath