isodoc 2.8.4 → 2.9.0

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: 6466fa1211d5ec0be2503b68d2100bbc9b07a3e775ff3e3a1095613aa33bff7a
4
- data.tar.gz: b04fd0793c57c87359e2cc7047e4b75bbcf10fa9b290247e1f88b979d3153b6a
3
+ metadata.gz: d2ba62816edc84d73b7df065ac30ea42ac43a02bfa1bba0cc345f06f9c1044f2
4
+ data.tar.gz: 5bb7cb021f6619b23888d2b7c8bb7f9b6aae42c3469884b05059256876675d23
5
5
  SHA512:
6
- metadata.gz: 5c5ce92235ef5e730947cc9a9df8f8e2bf7730b005ff00e7107ca50bf8f135938f762e93614a3e895d8ed23314b47ca0cd31909834a34c588b6898b84470f941
7
- data.tar.gz: 59af0d2afd52a0dff6aa7adb60aae5072d80c034a6eda25512c50031b7dc91efc1d02392c21400dce432e3cc3e6680cfd3def7ef5b3dde39f5b31a16a6f9929f
6
+ metadata.gz: 62a3f5375280faeabd71fc2abdc4f4335dd8f89ab7a5c7162a18ba6c19fb1d8d94136523032e6d04cf3abadb51c73bec23e2d93bb96461642834f989a8bfb285
7
+ data.tar.gz: 233e3f7252e9e3c4d946bfc3921b89a7d776786177cd37c823b8451c2cd3fd190893eb7da290bbc10fab8e4b9f84083530ab3a1c53c8bf3a518e14000bfc9f7a
data/isodoc.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "mn2pdf"
36
36
  spec.add_dependency "mn-requirements", "~> 0.3.4"
37
37
 
38
- spec.add_dependency "relaton-render", "~> 0.7.0"
38
+ spec.add_dependency "relaton-render", "~> 0.7.1"
39
39
  spec.add_dependency "roman-numerals"
40
40
  spec.add_dependency "rouge", "~> 4.0"
41
41
  spec.add_dependency "thread_safe"
@@ -84,6 +84,11 @@ module IsoDoc
84
84
  Metanorma::Requirements
85
85
  end
86
86
 
87
+ def bibrenderer(options = {})
88
+ ::Relaton::Render::IsoDoc::General.new(options.merge(language: @lang,
89
+ i18nhash: @i18n.get))
90
+ end
91
+
87
92
  def convert1(docxml, filename, dir)
88
93
  @xrefs.parse docxml
89
94
  noko do |xml|
@@ -29,15 +29,23 @@ module IsoDoc
29
29
  SKIP_DOCID = <<~XPATH.strip.freeze
30
30
  @type = 'DOI' or @type = 'doi' or @type = 'ISSN' or @type = 'issn' or @type = 'ISBN' or @type = 'isbn' or starts-with(@type, 'ISSN.') or starts-with(@type, 'ISBN.') or starts-with(@type, 'issn.') or starts-with(@type, 'isbn.')
31
31
  XPATH
32
-
32
+ =begin
33
33
  SKIP_DOC1 = <<~XPATH.strip.freeze
34
34
  #{SKIP_DOCID} or @type = 'metanorma-ordinal' or @type = 'metanorma'
35
35
  XPATH
36
36
 
37
37
  PRIMARY_ID = "docidentifier[@primary = 'true']".freeze
38
-
38
+ =end
39
39
  def pref_ref_code(bib)
40
40
  bib["suppress_identifier"] == "true" and return nil
41
+ @bibrenderer ||= bibrenderer
42
+ data, = @bibrenderer.parse(bib)
43
+ ret = data[:authoritative_identifier]
44
+ ret.empty? and return nil
45
+ ret
46
+ end
47
+ =begin
48
+ def pref_ref_code1(bib)
41
49
  lang = "[@language = '#{@lang}']"
42
50
  ret = bib.xpath(ns("./#{PRIMARY_ID}[not(#{SKIP_DOCID})]#{lang}"))
43
51
  ret.empty? and
@@ -47,7 +55,7 @@ module IsoDoc
47
55
  bib.at(ns("./docidentifier[not(#{SKIP_DOC1})]"))
48
56
  ret
49
57
  end
50
-
58
+ =end
51
59
  # returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers
52
60
  def bibitem_ref_code(bib)
53
61
  id = bib.at(ns("./docidentifier[@type = 'metanorma']"))
@@ -72,7 +80,9 @@ module IsoDoc
72
80
  end
73
81
 
74
82
  def unbracket1(ident)
75
- ident&.text&.sub(/^\[/, "")&.sub(/\]$/, "")
83
+ ident.nil? and return nil
84
+ ident.is_a?(String) or ident = ident.text
85
+ ident.sub(/^\[/, "").sub(/\]$/, "")
76
86
  end
77
87
 
78
88
  def unbracket(ident)
@@ -68,10 +68,6 @@ module IsoDoc
68
68
  xml.children = "#{f}#{x.to_xml}"
69
69
  end
70
70
 
71
- def bibrenderer
72
- ::Relaton::Render::IsoDoc::General.new(language: @lang)
73
- end
74
-
75
71
  def citestyle
76
72
  nil
77
73
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.8.4".freeze
2
+ VERSION = "2.9.0".freeze
3
3
  end
@@ -36,8 +36,7 @@ module IsoDoc
36
36
  def word_admonition_images(docxml)
37
37
  docxml.xpath("//div[@class = 'Admonition']//img").each do |i|
38
38
  i["width"], i["height"] =
39
- Html2Doc.new({}).image_resize(i, image_localfile(i), @maxheight,
40
- 300)
39
+ Vectory.image_resize(i, image_localfile(i), @maxheight, 300)
41
40
  end
42
41
  end
43
42
 
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.8.4
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html2doc
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.7.0
61
+ version: 0.7.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.7.0
68
+ version: 0.7.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: roman-numerals
71
71
  requirement: !ruby/object:Gem::Requirement