isodoc 1.7.6.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +2 -2
  3. data/lib/isodoc/class_utils.rb +24 -1
  4. data/lib/isodoc/convert.rb +9 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/inline.rb +3 -5
  7. data/lib/isodoc/html_function/html.rb +1 -0
  8. data/lib/isodoc/html_function/postprocess.rb +4 -6
  9. data/lib/isodoc/metadata_date.rb +13 -11
  10. data/lib/isodoc/presentation_function/bibdata.rb +2 -2
  11. data/lib/isodoc/presentation_function/block.rb +0 -36
  12. data/lib/isodoc/presentation_function/inline.rb +14 -11
  13. data/lib/isodoc/presentation_function/terms.rb +223 -0
  14. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  15. data/lib/isodoc/version.rb +1 -1
  16. data/lib/isodoc/word_function/body.rb +24 -14
  17. data/lib/isodoc/word_function/comments.rb +0 -4
  18. data/lib/isodoc/word_function/postprocess.rb +184 -176
  19. data/lib/isodoc/xref/xref_gen.rb +18 -22
  20. data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
  21. data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
  22. data/lib/isodoc/xslfo_convert.rb +11 -7
  23. data/lib/isodoc-yaml/i18n-ar.yaml +25 -0
  24. data/lib/isodoc-yaml/i18n-de.yaml +23 -0
  25. data/lib/isodoc-yaml/i18n-en.yaml +23 -0
  26. data/lib/isodoc-yaml/i18n-es.yaml +23 -0
  27. data/lib/isodoc-yaml/i18n-fr.yaml +23 -0
  28. data/lib/isodoc-yaml/i18n-ru.yaml +24 -1
  29. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +24 -0
  30. data/lib/metanorma/output/xslfo.rb +4 -11
  31. data/spec/assets/i18n.yaml +3 -1
  32. data/spec/isodoc/blocks_spec.rb +14 -8
  33. data/spec/isodoc/i18n_spec.rb +23 -18
  34. data/spec/isodoc/inline_spec.rb +193 -9
  35. data/spec/isodoc/lists_spec.rb +344 -222
  36. data/spec/isodoc/section_spec.rb +23 -22
  37. data/spec/isodoc/table_spec.rb +71 -73
  38. data/spec/isodoc/terms_spec.rb +498 -124
  39. data/spec/isodoc/xref_numbering_spec.rb +347 -0
  40. data/spec/isodoc/xref_spec.rb +274 -353
  41. data/spec/isodoc/xslfo_convert_spec.rb +34 -9
  42. metadata +12 -11
  43. 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
- IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => "/tmp/manifest.yml",
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)).to eq("--font-manifest /tmp/manifest.yml")
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.7.6.1
4
+ version: 1.8.2
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-09-27 00:00:00.000000000 Z
11
+ date: 2021-11-29 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.1.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.1.1
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -193,19 +193,19 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: byebug
196
+ name: debug
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - ">="
200
200
  - !ruby/object:Gem::Version
201
- version: '9.1'
201
+ version: '0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - "~>"
206
+ - - ">="
207
207
  - !ruby/object:Gem::Version
208
- version: '9.1'
208
+ version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: equivalent-xml
211
211
  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.1.4
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