isodoc 2.9.2 → 2.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/convert.rb +7 -4
- data/lib/isodoc/function/inline.rb +5 -1
- data/lib/isodoc/function/references.rb +12 -2
- data/lib/isodoc/function/utils.rb +1 -0
- data/lib/isodoc/html_function/html.rb +7 -5
- data/lib/isodoc/html_function/postprocess.rb +3 -2
- data/lib/isodoc/presentation_function/bibdata.rb +0 -1
- data/lib/isodoc/presentation_function/refs.rb +4 -4
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_sect_gen.rb +4 -2
- data/lib/isodoc/xref.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03204b29c322d499b52efcfd302668356cc8ba422d42748dda089eaa39f5c6dc
|
4
|
+
data.tar.gz: 2757e0f765b4b83a50f0a88fbbaf3396da2015361c799a92ede42a4b5dcda854
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e2c0e97b4a59bcd5597037e5bcd9a719c9cfcbc60dfd765dbfac4d24408f686e8e13c44e5da0f61b847809ecf5a2d83b5c27baed8a3cd28522e7d5bfa230f9e
|
7
|
+
data.tar.gz: 2b2225a8d1cb5891f0dac44b6be35d075323aaa7ee8792d6b879e4f7a768ac24faec07c3e6d2fc3734fbfeabcbeb1f5f5a7cec8540bfcaa3420d931aebf96d60
|
data/lib/isodoc/convert.rb
CHANGED
@@ -10,7 +10,7 @@ require "mn-requirements"
|
|
10
10
|
module IsoDoc
|
11
11
|
class Convert < ::IsoDoc::Common
|
12
12
|
attr_accessor :options, :i18n, :meta, :xrefs, :reqt_models,
|
13
|
-
:requirements_processor, :doctype
|
13
|
+
:requirements_processor, :doctype, :bibrender
|
14
14
|
|
15
15
|
# htmlstylesheet: Generic stylesheet for HTML
|
16
16
|
# htmlstylesheet_override: Override stylesheet for HTML
|
@@ -86,7 +86,7 @@ module IsoDoc
|
|
86
86
|
|
87
87
|
def bibrenderer(options = {})
|
88
88
|
::Relaton::Render::IsoDoc::General.new(options.merge(language: @lang,
|
89
|
-
|
89
|
+
i18nhash: @i18n.get))
|
90
90
|
end
|
91
91
|
|
92
92
|
def convert1(docxml, filename, dir)
|
@@ -108,7 +108,8 @@ module IsoDoc
|
|
108
108
|
docxml.root.default_namespace = ""
|
109
109
|
convert_i18n_init(docxml)
|
110
110
|
metadata_init(@lang, @script, @locale, @i18n)
|
111
|
-
xref_init(@lang, @script, self, @i18n,
|
111
|
+
xref_init(@lang, @script, self, @i18n,
|
112
|
+
{ locale: @locale, bibrender: @bibrender })
|
112
113
|
docxml = preprocess_xslt(docxml)
|
113
114
|
toc_init(docxml)
|
114
115
|
[docxml, filename, dir]
|
@@ -121,7 +122,8 @@ module IsoDoc
|
|
121
122
|
end
|
122
123
|
docxml
|
123
124
|
rescue ::Error => e
|
124
|
-
require "debug"
|
125
|
+
require "debug"
|
126
|
+
binding.b
|
125
127
|
end
|
126
128
|
|
127
129
|
def extract_preprocess_xslt(docxml)
|
@@ -136,6 +138,7 @@ module IsoDoc
|
|
136
138
|
def convert_i18n_init(docxml)
|
137
139
|
convert_i18n_init1(docxml)
|
138
140
|
i18n_init(@lang, @script, @locale)
|
141
|
+
@bibrender ||= bibrenderer
|
139
142
|
@reqt_models = requirements_processor
|
140
143
|
.new({ default: "default", lang: @lang, script: @script,
|
141
144
|
locale: @locale, labels: @i18n.get,
|
@@ -118,10 +118,14 @@ module IsoDoc
|
|
118
118
|
width: node["width"] || "auto",
|
119
119
|
title: node["title"],
|
120
120
|
alt: node["alt"] }
|
121
|
-
|
121
|
+
image_body_parse(node, attrs, out)
|
122
122
|
image_title_parse(out, caption)
|
123
123
|
end
|
124
124
|
|
125
|
+
def image_body_parse(_node, attrs, out)
|
126
|
+
out.img **attr_code(attrs)
|
127
|
+
end
|
128
|
+
|
125
129
|
def smallcap_parse(node, xml)
|
126
130
|
xml.span style: "font-variant:small-caps;" do |s|
|
127
131
|
node.children.each { |n| parse(n, s) }
|
@@ -32,8 +32,18 @@ module IsoDoc
|
|
32
32
|
|
33
33
|
def pref_ref_code(bib)
|
34
34
|
bib["suppress_identifier"] == "true" and return nil
|
35
|
-
@
|
36
|
-
|
35
|
+
ret = bib.xpath(ns("./docidentifier[@scope = 'biblio-tag']"))
|
36
|
+
ret.empty? or return ret.map(&:text)
|
37
|
+
ret = pref_ref_code_parse(bib) or return nil
|
38
|
+
ins = bib.at(ns("./docidentifier[last()]"))
|
39
|
+
ret.reverse.each do |r|
|
40
|
+
ins.next = "<docidentifier scope='biblio-tag'>#{docid_l10n(r)}</docidentifier>"
|
41
|
+
end
|
42
|
+
ret
|
43
|
+
end
|
44
|
+
|
45
|
+
def pref_ref_code_parse(bib)
|
46
|
+
data, = @bibrender.parse(bib)
|
37
47
|
ret = data[:authoritative_identifier] or return nil
|
38
48
|
ret.empty? and return nil
|
39
49
|
ret
|
@@ -16,7 +16,6 @@ module IsoDoc
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def preprocess_xslt(docxml)
|
19
|
-
|
20
19
|
super
|
21
20
|
end
|
22
21
|
|
@@ -103,12 +102,15 @@ module IsoDoc
|
|
103
102
|
ret
|
104
103
|
end
|
105
104
|
|
106
|
-
def
|
105
|
+
def image_body_parse(node, attrs, out)
|
107
106
|
if svg = node.at("./m:svg", "m" => "http://www.w3.org/2000/svg")
|
108
|
-
|
109
|
-
|
107
|
+
%i(height width).each do |k|
|
108
|
+
v = attrs[k] and v != "auto" and !v.empty? and
|
109
|
+
svg[k.to_s] = v
|
110
|
+
end
|
111
|
+
out.parent.add_child(svg)
|
112
|
+
else super
|
110
113
|
end
|
111
|
-
super
|
112
114
|
end
|
113
115
|
end
|
114
116
|
end
|
@@ -66,8 +66,9 @@ module IsoDoc
|
|
66
66
|
def resize_images(docxml)
|
67
67
|
docxml.xpath("//*[local-name() = 'img' or local-name() = 'svg']")
|
68
68
|
.each do |i|
|
69
|
+
loc = image_localfile(i) or next
|
69
70
|
i["width"], i["height"] = Vectory::ImageResize.new
|
70
|
-
.call(i,
|
71
|
+
.call(i, loc, @maxheight, @maxwidth)
|
71
72
|
end
|
72
73
|
docxml
|
73
74
|
end
|
@@ -76,7 +77,7 @@ module IsoDoc
|
|
76
77
|
def move_images(docxml)
|
77
78
|
FileUtils.rm_rf tmpimagedir
|
78
79
|
FileUtils.mkdir tmpimagedir
|
79
|
-
docxml.xpath("//*[local-name() = 'img']").each do |i|
|
80
|
+
docxml.xpath("//*[local-name() = 'img'][@src]").each do |i|
|
80
81
|
/^data:/.match? i["src"] and next
|
81
82
|
@datauriimage ? datauri(i) : move_image1(i)
|
82
83
|
end
|
@@ -37,8 +37,8 @@ module IsoDoc
|
|
37
37
|
prep_for_rendering(b)
|
38
38
|
m << to_xml(b)
|
39
39
|
end.join
|
40
|
-
@
|
41
|
-
|
40
|
+
@bibrender.render_all("<references>#{refs}</references>",
|
41
|
+
type: citestyle)
|
42
42
|
end
|
43
43
|
|
44
44
|
def prep_for_rendering(bib)
|
@@ -49,10 +49,10 @@ module IsoDoc
|
|
49
49
|
|
50
50
|
def bibitem(xml, renderings)
|
51
51
|
@xrefs.klass.implicit_reference(xml) and xml["hidden"] = "true"
|
52
|
-
|
52
|
+
bibrender_item(xml, renderings)
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def bibrender_item(xml, renderings)
|
56
56
|
if (f = xml.at(ns("./formattedref"))) && xml.at(ns("./title")).nil?
|
57
57
|
bibrender_formattedref(f, xml)
|
58
58
|
else bibrender_relaton(xml, renderings)
|
data/lib/isodoc/version.rb
CHANGED
@@ -42,7 +42,9 @@ module IsoDoc
|
|
42
42
|
annex_anchor_names(xml)
|
43
43
|
back_clauses_anchor_names(xml)
|
44
44
|
end
|
45
|
-
|
45
|
+
if @klass.bibrender && (@parse_settings.empty? || @parse_settings[:refs])
|
46
|
+
references(xml)
|
47
|
+
end
|
46
48
|
end
|
47
49
|
|
48
50
|
def annex_anchor_names(xml)
|
@@ -98,7 +100,7 @@ module IsoDoc
|
|
98
100
|
|
99
101
|
# preempt clause notes with all other types of note (ISO default)
|
100
102
|
def asset_anchor_names(doc)
|
101
|
-
@parse_settings.empty? or return
|
103
|
+
(@parse_settings.empty? || @parse_settings[:assets]) or return
|
102
104
|
middle_section_asset_names(doc)
|
103
105
|
termnote_anchor_names(doc)
|
104
106
|
termexample_anchor_names(doc)
|
data/lib/isodoc/xref.rb
CHANGED
@@ -15,6 +15,7 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
attr_reader :klass
|
17
17
|
|
18
|
+
# Note: if bibrender is no passed in, do not parse references
|
18
19
|
def initialize(lang, script, klass, i18n, options = {})
|
19
20
|
@anchors = {}
|
20
21
|
@lang = lang
|
@@ -24,6 +25,7 @@ module IsoDoc
|
|
24
25
|
@i18n = i18n
|
25
26
|
@labels = @i18n.get
|
26
27
|
@klass.i18n = @i18n
|
28
|
+
@klass.bibrender ||= options[:bibrender]
|
27
29
|
@locale = options[:locale]
|
28
30
|
@reqt_models = @klass.requirements_processor
|
29
31
|
.new({
|
@@ -39,7 +41,7 @@ module IsoDoc
|
|
39
41
|
end
|
40
42
|
|
41
43
|
# parse only the elements set, if any are set
|
42
|
-
# defined are: clause: true, refs: true
|
44
|
+
# defined are: clause: true, refs: true, assets: true
|
43
45
|
def parse_inclusions(options)
|
44
46
|
@parse_settings.merge!(options)
|
45
47
|
self
|
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.9.
|
4
|
+
version: 2.9.3
|
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-03-
|
11
|
+
date: 2024-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|