isodoc 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +4 -1
  3. data/lib/isodoc/base_style/blocks.scss +7 -0
  4. data/lib/isodoc/function/inline.rb +2 -0
  5. data/lib/isodoc/function/lists.rb +24 -9
  6. data/lib/isodoc/function/to_word_html.rb +1 -0
  7. data/lib/isodoc/function/utils.rb +17 -7
  8. data/lib/isodoc/gem_tasks.rb +19 -10
  9. data/lib/isodoc/i18n.rb +19 -0
  10. data/lib/isodoc/metadata.rb +2 -2
  11. data/lib/isodoc/presentation_function/inline.rb +11 -4
  12. data/lib/isodoc/presentation_function/xrefs.rb +22 -6
  13. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  14. data/lib/isodoc/version.rb +1 -1
  15. data/lib/isodoc/word_function/body.rb +6 -3
  16. data/lib/isodoc/xref/xref_gen.rb +4 -4
  17. metadata +3 -50
  18. data/.github/workflows/rake.yml +0 -15
  19. data/.github/workflows/release.yml +0 -24
  20. data/.hound.yml +0 -5
  21. data/.oss-guides.rubocop.yml +0 -1077
  22. data/.rubocop.yml +0 -10
  23. data/Rakefile +0 -8
  24. data/bin/rspec +0 -17
  25. data/spec/assets/header.html +0 -7
  26. data/spec/assets/html.scss +0 -20
  27. data/spec/assets/html_override.css +0 -1
  28. data/spec/assets/htmlcover.html +0 -4
  29. data/spec/assets/htmlintro.html +0 -5
  30. data/spec/assets/i18n.yaml +0 -41
  31. data/spec/assets/iso.xml +0 -8
  32. data/spec/assets/odf.emf +0 -0
  33. data/spec/assets/odf.svg +0 -1
  34. data/spec/assets/odf1.svg +0 -4
  35. data/spec/assets/outputtest/a.xml +0 -66
  36. data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
  37. data/spec/assets/rice_image1 +0 -0
  38. data/spec/assets/rice_image1.png +0 -0
  39. data/spec/assets/scripts.html +0 -3
  40. data/spec/assets/scripts_override.html +0 -3
  41. data/spec/assets/std.css +0 -2
  42. data/spec/assets/word.css +0 -2
  43. data/spec/assets/word_override.css +0 -1
  44. data/spec/assets/wordcover.html +0 -3
  45. data/spec/assets/wordintro.html +0 -4
  46. data/spec/isodoc/blocks_spec.rb +0 -2934
  47. data/spec/isodoc/cleanup_spec.rb +0 -1056
  48. data/spec/isodoc/footnotes_spec.rb +0 -264
  49. data/spec/isodoc/form_spec.rb +0 -160
  50. data/spec/isodoc/i18n_spec.rb +0 -1201
  51. data/spec/isodoc/inline_spec.rb +0 -2301
  52. data/spec/isodoc/lists_spec.rb +0 -469
  53. data/spec/isodoc/metadata_spec.rb +0 -401
  54. data/spec/isodoc/postproc_spec.rb +0 -2938
  55. data/spec/isodoc/presentation_xml_spec.rb +0 -1476
  56. data/spec/isodoc/ref_spec.rb +0 -955
  57. data/spec/isodoc/section_spec.rb +0 -2123
  58. data/spec/isodoc/table_spec.rb +0 -588
  59. data/spec/isodoc/terms_spec.rb +0 -712
  60. data/spec/isodoc/utils_spec.rb +0 -57
  61. data/spec/isodoc/xref_numbering_spec.rb +0 -378
  62. data/spec/isodoc/xref_spec.rb +0 -1837
  63. data/spec/isodoc/xslfo_convert_spec.rb +0 -103
  64. data/spec/spec_helper.rb +0 -88
@@ -1,103 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc do
4
- it "test default pdf_options" do
5
- convert = IsoDoc::XslfoPdfConvert.new(
6
- {
7
- datauriimage: false,
8
- },
9
- )
10
-
11
- expect(convert.pdf_options(nil)).to eq({ "--syntax-highlight": nil })
12
- end
13
-
14
- it "test default pdf_options for nil font_manifest_file" do
15
- convert = IsoDoc::XslfoPdfConvert.new(
16
- {
17
- datauriimage: false,
18
- IsoDoc::XslfoPdfConvert::MN_OPTIONS_KEY => {
19
- IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => nil,
20
- },
21
- },
22
- )
23
-
24
- expect(convert.pdf_options(nil)).to eq({ "--syntax-highlight": nil })
25
- end
26
-
27
- it "test --font-manifest pdf_options" do
28
- mn2pdf_opts = {
29
- "--syntax-highlight": nil,
30
- font_manifest: "/tmp/manifest.yml",
31
- }
32
- convert = IsoDoc::XslfoPdfConvert.new(
33
- {
34
- datauriimage: false,
35
- IsoDoc::XslfoPdfConvert::MN_OPTIONS_KEY => mn2pdf_opts,
36
- },
37
- )
38
-
39
- expect(convert.pdf_options(nil)).to eq(mn2pdf_opts)
40
- end
41
-
42
- it "test --param align-cross-elements pdf_options" do
43
- convert = IsoDoc::XslfoPdfConvert.new(
44
- {
45
- datauriimage: false,
46
- aligncrosselements: "clause table note",
47
- },
48
- )
49
-
50
- expect(convert.pdf_options(nil))
51
- .to eq({ "--param align-cross-elements=" => "clause table note",
52
- "--syntax-highlight": nil })
53
- end
54
-
55
- it "test --baseassetpath pdf_options" do
56
- convert = IsoDoc::XslfoPdfConvert.new(
57
- {
58
- datauriimage: false,
59
- baseassetpath: "ABC",
60
- },
61
- )
62
-
63
- expect(convert.pdf_options(nil))
64
- .to eq({ "--param baseassetpath=" => "ABC",
65
- "--syntax-highlight": nil })
66
- end
67
-
68
- it "test pdf encryption options" do
69
- convert = IsoDoc::XslfoPdfConvert.new(
70
- {
71
- pdfencryptionlength: "a",
72
- pdfownerpassword: "b",
73
- pdfuserpassword: "c",
74
- pdfallowprint: "d",
75
- pdfallowcopycontent: "e",
76
- pdfalloweditcontent: "f",
77
- pdfalloweditannotations: "g",
78
- pdfallowfillinforms: "h",
79
- pdfallowaccesscontent: "i",
80
- pdfallowassembledocument: "j",
81
- pdfallowprinthq: "k",
82
- pdfencryptmetadata: "l",
83
- },
84
- )
85
-
86
- expect(convert.pdf_options(nil))
87
- .to eq({
88
- "--allow-access-content" => "i",
89
- "--allow-assemble-document" => "j",
90
- "--allow-copy-content" => "e",
91
- "--allow-edit-annotations" => "g",
92
- "--allow-edit-content" => "f",
93
- "--allow-fill-in-forms" => "h",
94
- "--allow-print" => "d",
95
- "--allow-print-hq" => "k",
96
- "--encrypt-metadata" => "l",
97
- "--encryption-length" => "a",
98
- "--owner-password" => "b",
99
- :"--syntax-highlight" => nil,
100
- "--user-password" => "c",
101
- })
102
- end
103
- end
data/spec/spec_helper.rb DELETED
@@ -1,88 +0,0 @@
1
- require "simplecov"
2
- SimpleCov.start do
3
- add_filter "/spec/"
4
- end
5
-
6
- require "bundler/setup"
7
- require "isodoc"
8
- require "rspec/matchers"
9
- require "equivalent-xml"
10
- require "rexml/document"
11
-
12
- RSpec.configure do |config|
13
- # Enable flags like --only-failures and --next-failure
14
- config.example_status_persistence_file_path = ".rspec_status"
15
-
16
- # Disable RSpec exposing methods globally on `Module` and `main`
17
- config.disable_monkey_patching!
18
-
19
- config.expect_with :rspec do |c|
20
- c.syntax = :expect
21
- end
22
- end
23
-
24
- def xmlpp(xml)
25
- c = HTMLEntities.new
26
- xml &&= xml.split(/(&\S+?;)/).map do |n|
27
- if /^&\S+?;$/.match?(n)
28
- c.encode(c.decode(n), :hexadecimal)
29
- else n
30
- end
31
- end.join
32
- s = ""
33
- f = REXML::Formatters::Pretty.new(2)
34
- f.compact = true
35
- f.write(REXML::Document.new(xml), s)
36
- s
37
- end
38
-
39
- def metadata(hash)
40
- hash.sort.to_h.delete_if do |_k, v|
41
- v.nil? || (v.respond_to?(:empty?) && v.empty?)
42
- end
43
- end
44
-
45
- def strip_guid(xml)
46
- xml.gsub(%r{ id="_[^"]+"}, ' id="_"')
47
- .gsub(%r{ target="_[^"]+"}, ' target="_"')
48
- .gsub(%r( href="#[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' href="#_"')
49
- .gsub(%r( id="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' id="_"')
50
- .gsub(%r( id="ftn[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' id="ftn_"')
51
- .gsub(%r( id="fn:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' id="fn:_"')
52
- .gsub(%r[ src="([^/]+)/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.], ' src="\\1/_.')
53
- end
54
-
55
- HTML_HDR = <<~HEADER.freeze
56
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
57
- <head/>
58
- <body lang="en">
59
- <div class="title-section">
60
- <p>&#160;</p>
61
- </div>
62
- <br/>
63
- <div class="prefatory-section">
64
- <p>&#160;</p>
65
- </div>
66
- <br/>
67
- <div class="main-section">
68
- HEADER
69
-
70
- WORD_HDR = <<~HEADER.freeze
71
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
72
- <head>
73
- <style>
74
- <!--
75
- -->
76
- </style>
77
- </head>
78
- <body lang="EN-US" link="blue" vlink="#954F72">
79
- <div class="WordSection1">
80
- <p>&#160;</p>
81
- </div>
82
- <p><br clear="all" class="section"/></p>
83
- <div class="WordSection2">
84
- <p>&#160;</p>
85
- </div>
86
- <p><br clear="all" class="section"/></p>
87
- <div class="WordSection3">
88
- HEADER