isodoc 1.7.6 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/class_utils.rb +23 -0
- data/lib/isodoc/convert.rb +9 -0
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/function/inline.rb +2 -4
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/html_function/postprocess.rb +4 -6
- data/lib/isodoc/metadata_date.rb +13 -11
- data/lib/isodoc/presentation_function/bibdata.rb +2 -2
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +14 -11
- data/lib/isodoc/presentation_function/terms.rb +179 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +24 -14
- data/lib/isodoc/word_function/comments.rb +0 -4
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xref/xref_gen.rb +18 -22
- data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +11 -7
- data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
- data/lib/isodoc-yaml/i18n-de.yaml +20 -0
- data/lib/isodoc-yaml/i18n-en.yaml +20 -0
- data/lib/isodoc-yaml/i18n-es.yaml +20 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/assets/i18n.yaml +3 -1
- data/spec/isodoc/blocks_spec.rb +14 -8
- data/spec/isodoc/i18n_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +200 -6
- data/spec/isodoc/lists_spec.rb +344 -222
- data/spec/isodoc/section_spec.rb +11 -10
- data/spec/isodoc/table_spec.rb +71 -73
- data/spec/isodoc/terms_spec.rb +354 -34
- data/spec/isodoc/xref_numbering_spec.rb +347 -0
- data/spec/isodoc/xref_spec.rb +271 -350
- data/spec/isodoc/xslfo_convert_spec.rb +34 -9
- metadata +7 -6
- data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -5,10 +5,10 @@ RSpec.describe IsoDoc do
|
|
5
5
|
convert = IsoDoc::XslfoPdfConvert.new(
|
6
6
|
{
|
7
7
|
datauriimage: false,
|
8
|
-
}
|
8
|
+
},
|
9
9
|
)
|
10
10
|
|
11
|
-
expect(convert.pdf_options(nil)).to eq(
|
11
|
+
expect(convert.pdf_options(nil)).to eq({})
|
12
12
|
end
|
13
13
|
|
14
14
|
it "test empty pdf_options for nil font_manifest_file" do
|
@@ -18,22 +18,47 @@ RSpec.describe IsoDoc do
|
|
18
18
|
IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS => {
|
19
19
|
IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => nil,
|
20
20
|
},
|
21
|
-
}
|
21
|
+
},
|
22
22
|
)
|
23
23
|
|
24
|
-
expect(convert.pdf_options(nil)).to eq(
|
24
|
+
expect(convert.pdf_options(nil)).to eq({})
|
25
25
|
end
|
26
26
|
|
27
27
|
it "test --font-manifest pdf_options" do
|
28
|
+
mn2pdf_opts = {
|
29
|
+
IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => "/tmp/manifest.yml",
|
30
|
+
}
|
28
31
|
convert = IsoDoc::XslfoPdfConvert.new(
|
29
32
|
{
|
30
33
|
datauriimage: false,
|
31
|
-
IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS =>
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS => mn2pdf_opts,
|
35
|
+
},
|
36
|
+
)
|
37
|
+
|
38
|
+
expect(convert.pdf_options(nil)).to eq(mn2pdf_opts)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "test --param align-cross-elements pdf_options" do
|
42
|
+
convert = IsoDoc::XslfoPdfConvert.new(
|
43
|
+
{
|
44
|
+
datauriimage: false,
|
45
|
+
aligncrosselements: "clause table note",
|
46
|
+
},
|
47
|
+
)
|
48
|
+
|
49
|
+
expect(convert.pdf_options(nil))
|
50
|
+
.to eq({ "--param align-cross-elements=" => "clause table note" })
|
51
|
+
end
|
52
|
+
|
53
|
+
it "test --baseassetpath pdf_options" do
|
54
|
+
convert = IsoDoc::XslfoPdfConvert.new(
|
55
|
+
{
|
56
|
+
datauriimage: false,
|
57
|
+
baseassetpath: "ABC",
|
58
|
+
},
|
35
59
|
)
|
36
60
|
|
37
|
-
expect(convert.pdf_options(nil))
|
61
|
+
expect(convert.pdf_options(nil))
|
62
|
+
.to eq({ "--param baseassetpath=" => "ABC" })
|
38
63
|
end
|
39
64
|
end
|
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.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: htmlentities
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -446,11 +446,11 @@ files:
|
|
446
446
|
- lib/isodoc/pdf_convert.rb
|
447
447
|
- lib/isodoc/presentation_function/bibdata.rb
|
448
448
|
- lib/isodoc/presentation_function/block.rb
|
449
|
-
- lib/isodoc/presentation_function/concept.rb
|
450
449
|
- lib/isodoc/presentation_function/image.rb
|
451
450
|
- lib/isodoc/presentation_function/inline.rb
|
452
451
|
- lib/isodoc/presentation_function/math.rb
|
453
452
|
- lib/isodoc/presentation_function/section.rb
|
453
|
+
- lib/isodoc/presentation_function/terms.rb
|
454
454
|
- lib/isodoc/presentation_xml_convert.rb
|
455
455
|
- lib/isodoc/sassc_importer.rb
|
456
456
|
- lib/isodoc/version.rb
|
@@ -509,6 +509,7 @@ files:
|
|
509
509
|
- spec/isodoc/section_spec.rb
|
510
510
|
- spec/isodoc/table_spec.rb
|
511
511
|
- spec/isodoc/terms_spec.rb
|
512
|
+
- spec/isodoc/xref_numbering_spec.rb
|
512
513
|
- spec/isodoc/xref_spec.rb
|
513
514
|
- spec/isodoc/xslfo_convert_spec.rb
|
514
515
|
- spec/spec_helper.rb
|
@@ -531,7 +532,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
531
532
|
- !ruby/object:Gem::Version
|
532
533
|
version: '0'
|
533
534
|
requirements: []
|
534
|
-
rubygems_version: 3.
|
535
|
+
rubygems_version: 3.2.22
|
535
536
|
signing_key:
|
536
537
|
specification_version: 4
|
537
538
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
-
def concept(docxml)
|
4
|
-
docxml.xpath(ns("//concept")).each { |f| concept1(f) }
|
5
|
-
end
|
6
|
-
|
7
|
-
def concept1(node)
|
8
|
-
xref = node&.at(ns("./xref/@target"))&.text or
|
9
|
-
return concept_render(node, ital: node["ital"] || "true",
|
10
|
-
ref: node["ref"] || "true",
|
11
|
-
linkref: node["linkref"] || "true",
|
12
|
-
linkmention: node["linkmention"] || "false")
|
13
|
-
if node.at(ns("//definitions//dt[@id = '#{xref}']"))
|
14
|
-
concept_render(node, ital: node["ital"] || "false",
|
15
|
-
ref: node["ref"] || "false",
|
16
|
-
linkref: node["linkref"] || "true",
|
17
|
-
linkmention: node["linkmention"] || "false")
|
18
|
-
else concept_render(node, ital: node["ital"] || "true",
|
19
|
-
ref: node["ref"] || "true",
|
20
|
-
linkref: node["linkref"] || "true",
|
21
|
-
linkmention: node["linkmention"] || "false")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def concept_render(node, opts)
|
26
|
-
node&.at(ns("./refterm"))&.remove
|
27
|
-
r = node.at(ns("./renderterm"))
|
28
|
-
ref = node.at(ns("./xref | ./eref | ./termref"))
|
29
|
-
ref && opts[:ref] != "false" and r&.next = " "
|
30
|
-
opts[:ital] == "true" and r&.name = "em"
|
31
|
-
if opts[:linkmention] == "true" && !r.nil? && !ref.nil?
|
32
|
-
ref2 = ref.clone
|
33
|
-
r2 = r.clone
|
34
|
-
r.replace(ref2).children = r2
|
35
|
-
end
|
36
|
-
concept1_ref(node, ref, opts)
|
37
|
-
if opts[:ital] == "false"
|
38
|
-
r = node.at(ns(".//renderterm"))
|
39
|
-
r&.replace(r&.children)
|
40
|
-
end
|
41
|
-
node.replace(node.children)
|
42
|
-
end
|
43
|
-
|
44
|
-
def concept1_ref(_node, ref, opts)
|
45
|
-
ref.nil? and return
|
46
|
-
return ref.remove if opts[:ref] == "false"
|
47
|
-
|
48
|
-
r = concept1_ref_content(ref)
|
49
|
-
ref = r.at("./descendant-or-self::xmlns:xref | "\
|
50
|
-
"./descendant-or-self::xmlns:eref | "\
|
51
|
-
"./descendant-or-self::xmlns:termref")
|
52
|
-
%w(xref eref).include? ref&.name and get_linkend(ref)
|
53
|
-
if opts[:linkref] == "false" && %w(xref eref).include?(ref&.name)
|
54
|
-
ref.replace(ref.children)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def concept1_ref_content(ref)
|
59
|
-
if non_locality_elems(ref).select do |c|
|
60
|
-
!c.text? || /\S/.match(c)
|
61
|
-
end.empty?
|
62
|
-
ref.replace(@i18n.term_defined_in.sub(/%/,
|
63
|
-
ref.to_xml))
|
64
|
-
else ref.replace("[#{ref.to_xml}]")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|