isodoc 1.0.27 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -8
  3. data/.github/workflows/ubuntu.yml +18 -16
  4. data/.github/workflows/windows.yml +4 -8
  5. data/Rakefile +3 -1
  6. data/isodoc.gemspec +2 -2
  7. data/lib/isodoc.rb +2 -0
  8. data/lib/isodoc/base_style/metanorma_word.scss +0 -1
  9. data/lib/isodoc/base_style/reset.scss +3 -3
  10. data/lib/isodoc/common.rb +0 -4
  11. data/lib/isodoc/convert.rb +121 -58
  12. data/lib/isodoc/function/blocks.rb +42 -53
  13. data/lib/isodoc/function/blocks_example_note.rb +108 -0
  14. data/lib/isodoc/function/cleanup.rb +8 -4
  15. data/lib/isodoc/function/i18n.rb +1 -0
  16. data/lib/isodoc/function/inline.rb +70 -90
  17. data/lib/isodoc/function/inline_simple.rb +72 -0
  18. data/lib/isodoc/function/lists.rb +12 -6
  19. data/lib/isodoc/function/references.rb +33 -38
  20. data/lib/isodoc/function/reqt.rb +14 -5
  21. data/lib/isodoc/function/section.rb +8 -11
  22. data/lib/isodoc/function/table.rb +4 -4
  23. data/lib/isodoc/function/terms.rb +3 -3
  24. data/lib/isodoc/function/to_word_html.rb +21 -13
  25. data/lib/isodoc/function/utils.rb +57 -50
  26. data/lib/isodoc/gem_tasks.rb +104 -0
  27. data/lib/isodoc/headlesshtml_convert.rb +7 -6
  28. data/lib/isodoc/html_convert.rb +2 -1
  29. data/lib/isodoc/html_function/footnotes.rb +1 -1
  30. data/lib/isodoc/html_function/html.rb +13 -1
  31. data/lib/isodoc/html_function/postprocess.rb +4 -4
  32. data/lib/isodoc/metadata.rb +74 -62
  33. data/lib/isodoc/pdf_convert.rb +8 -6
  34. data/lib/isodoc/presentation_xml_convert.rb +29 -0
  35. data/lib/isodoc/sassc_importer.rb +11 -0
  36. data/lib/isodoc/version.rb +1 -1
  37. data/lib/isodoc/word_convert.rb +2 -1
  38. data/lib/isodoc/word_function/body.rb +14 -48
  39. data/lib/isodoc/word_function/footnotes.rb +1 -1
  40. data/lib/isodoc/word_function/inline.rb +75 -0
  41. data/lib/isodoc/word_function/postprocess.rb +1 -0
  42. data/lib/isodoc/word_function/table.rb +3 -3
  43. data/lib/isodoc/xref.rb +59 -0
  44. data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
  45. data/lib/isodoc/xref/xref_counter.rb +74 -0
  46. data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
  47. data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
  48. data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
  49. data/lib/isodoc/xslfo_convert.rb +16 -4
  50. data/spec/assets/{html.css → html.scss} +0 -0
  51. data/spec/assets/i18n.yaml +4 -1
  52. data/spec/assets/odf.emf +0 -0
  53. data/spec/assets/odf.svg +4 -0
  54. data/spec/assets/odf1.svg +4 -0
  55. data/spec/isodoc/blocks_spec.rb +219 -47
  56. data/spec/isodoc/cleanup_spec.rb +135 -6
  57. data/spec/isodoc/footnotes_spec.rb +22 -7
  58. data/spec/isodoc/inline_spec.rb +262 -2
  59. data/spec/isodoc/lists_spec.rb +8 -8
  60. data/spec/isodoc/metadata_spec.rb +110 -3
  61. data/spec/isodoc/postproc_spec.rb +1321 -1351
  62. data/spec/isodoc/presentation_xml_spec.rb +20 -0
  63. data/spec/isodoc/ref_spec.rb +119 -50
  64. data/spec/isodoc/section_spec.rb +84 -18
  65. data/spec/isodoc/table_spec.rb +6 -6
  66. data/spec/isodoc/terms_spec.rb +7 -7
  67. data/spec/isodoc/xref_spec.rb +165 -45
  68. metadata +36 -27
  69. data/lib/isodoc/function/blocks_example.rb +0 -53
  70. data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -1,53 +0,0 @@
1
- module IsoDoc::Function
2
- module Blocks
3
- def example_label(node, div, name)
4
- n = get_anchors[node["id"]]
5
- div.p **{ class: "example-title" } do |p|
6
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
7
- l10n("#{@example_lbl} #{n[:label]}")
8
- p << lbl
9
- name and !lbl.nil? and p << "&nbsp;&mdash; "
10
- name and name.children.each { |n| parse(n, div) }
11
- end
12
- end
13
-
14
- EXAMPLE_TBL_ATTR =
15
- { class: "example_label", style: "width:82.8pt;padding:0 0 0 0;\
16
- margin-left:0pt;vertical-align:top;" }.freeze
17
-
18
- # used if we are boxing examples
19
- def example_div_parse(node, out)
20
- out.div **attr_code(id: node["id"], class: "example") do |div|
21
- example_label(node, div, node.at(ns("./name")))
22
- node.children.each do |n|
23
- parse(n, div) unless n.name == "name"
24
- end
25
- end
26
- end
27
-
28
- def example_table_attr(node)
29
- attr_code(id: node["id"], class: "example",
30
- style: "border-collapse:collapse;border-spacing:0;" )
31
- end
32
-
33
- EXAMPLE_TD_ATTR =
34
- { style: "vertical-align:top;padding:0;", class: "example" }.freeze
35
-
36
- def example_table_parse(node, out)
37
- out.table **example_table_attr(node) do |t|
38
- t.tr do |tr|
39
- tr.td **EXAMPLE_TBL_ATTR do |td|
40
- example_label(node, td, node.at(ns("./name")))
41
- end
42
- tr.td **EXAMPLE_TD_ATTR do |td|
43
- node.children.each { |n| parse(n, td) unless n.name == "name" }
44
- end
45
- end
46
- end
47
- end
48
-
49
- def example_parse(node, out)
50
- example_div_parse(node, out)
51
- end
52
- end
53
- end
@@ -1,50 +0,0 @@
1
- require "roman-numerals"
2
-
3
- module IsoDoc::Function
4
- module XrefGen
5
- def hiersep
6
- "."
7
- end
8
-
9
- def hierfigsep
10
- "-"
11
- end
12
-
13
- class Counter
14
- def initialize
15
- @num = 0
16
- @letter = ""
17
- @subseq = ""
18
- end
19
-
20
- def increment(node)
21
- return self if node["unnumbered"]
22
- if node["subsequence"] != @subseq
23
- @subseq = node["subsequence"]
24
- @num += 1
25
- @letter = node["subsequence"] ? "a" : ""
26
- else
27
- if @letter.empty?
28
- @num += 1
29
- else
30
- @letter = (@letter.ord + 1).chr.to_s
31
- end
32
- end
33
- self
34
- end
35
-
36
- def print
37
- "#{@num}#{@letter}"
38
- end
39
-
40
- def listlabel(depth)
41
- return @num.to_s if [2, 7].include? depth
42
- return (96 + @num).chr.to_s if [1, 6].include? depth
43
- return (64 + @num).chr.to_s if [4, 9].include? depth
44
- return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
45
- return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
46
- return @num.to_s
47
- end
48
- end
49
- end
50
- end