isodoc 3.1.0 → 3.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +3 -12
  3. data/lib/isodoc/common.rb +2 -0
  4. data/lib/isodoc/css.rb +36 -23
  5. data/lib/isodoc/function/blocks.rb +12 -0
  6. data/lib/isodoc/function/cleanup.rb +4 -12
  7. data/lib/isodoc/function/footnotes.rb +57 -0
  8. data/lib/isodoc/function/inline.rb +10 -6
  9. data/lib/isodoc/function/section.rb +7 -0
  10. data/lib/isodoc/function/setup.rb +64 -0
  11. data/lib/isodoc/function/table.rb +2 -0
  12. data/lib/isodoc/function/to_word_html.rb +5 -57
  13. data/lib/isodoc/function/utils.rb +4 -7
  14. data/lib/isodoc/gem_tasks.rb +16 -16
  15. data/lib/isodoc/headlesshtml_convert.rb +0 -2
  16. data/lib/isodoc/html_convert.rb +0 -2
  17. data/lib/isodoc/html_function/postprocess.rb +2 -1
  18. data/lib/isodoc/html_function/postprocess_footnotes.rb +2 -1
  19. data/lib/isodoc/pdf_convert.rb +0 -2
  20. data/lib/isodoc/presentation_function/block.rb +21 -25
  21. data/lib/isodoc/presentation_function/concepts.rb +7 -8
  22. data/lib/isodoc/presentation_function/erefs.rb +2 -3
  23. data/lib/isodoc/presentation_function/footnotes.rb +140 -0
  24. data/lib/isodoc/presentation_function/image.rb +0 -18
  25. data/lib/isodoc/presentation_function/inline.rb +11 -13
  26. data/lib/isodoc/presentation_function/refs.rb +9 -4
  27. data/lib/isodoc/presentation_function/sourcecode.rb +2 -19
  28. data/lib/isodoc/presentation_xml_convert.rb +3 -1
  29. data/lib/isodoc/version.rb +1 -1
  30. data/lib/isodoc/word_function/body.rb +5 -3
  31. data/lib/isodoc/word_function/footnotes.rb +57 -68
  32. data/lib/isodoc/word_function/postprocess.rb +6 -2
  33. data/lib/isodoc/xref/xref_gen.rb +1 -9
  34. data/lib/isodoc/xref/xref_gen_seq.rb +47 -92
  35. data/lib/isodoc/xref/xref_util.rb +49 -0
  36. metadata +36 -6
  37. data/lib/isodoc/html_function/footnotes.rb +0 -92
@@ -1,92 +0,0 @@
1
- module IsoDoc
2
- module HtmlFunction
3
- module Footnotes
4
- def footnotes(div)
5
- return if @footnotes.empty?
6
-
7
- @footnotes.each { |fn| div.parent << fn }
8
- end
9
-
10
- def make_table_footnote_link(out, fnid, fnref)
11
- attrs = { href: "##{fnid}", class: "TableFootnoteRef" }
12
- out.a **attrs do |a|
13
- a << fnref
14
- end
15
- end
16
-
17
- def make_table_footnote_target(out, fnid, fnref)
18
- attrs = { id: fnid, class: "TableFootnoteRef" }
19
- out.span do |s|
20
- out.span **attrs do |a|
21
- a << fnref
22
- end
23
- insert_tab(s, 1)
24
- end
25
- end
26
-
27
- # Move to Presentation XML, as <fmt-footnote>: it's a footnote body
28
- def make_table_footnote_text(node, fnid, fnref)
29
- attrs = { id: "fn:#{fnid}" }
30
- noko do |xml|
31
- xml.div **attr_code(attrs) do |div|
32
- make_table_footnote_target(div, fnid, fnref)
33
- node.children.each { |n| parse(n, div) }
34
- end
35
- end.join("\n")
36
- end
37
-
38
- def make_generic_footnote_text(node, fnid)
39
- noko do |xml|
40
- xml.aside id: "fn:#{fnid}", class: "footnote" do |div|
41
- node.children.each { |n| parse(n, div) }
42
- end
43
- end.join("\n")
44
- end
45
-
46
- def get_table_ancestor_id(node)
47
- table = node.ancestors("table") || node.ancestors("figure")
48
- return UUIDTools::UUID.random_create.to_s if table.empty?
49
-
50
- table.last["id"]
51
- end
52
-
53
- # @seen_footnote:
54
- # do not output footnote text if we have already seen it for this table
55
-
56
- def table_footnote_parse(node, out)
57
- fn = node["reference"] || UUIDTools::UUID.random_create.to_s
58
- tid = get_table_ancestor_id(node)
59
- make_table_footnote_link(out, tid + fn, fn)
60
- return if @seen_footnote.include?(tid + fn)
61
-
62
- @in_footnote = true
63
- out.aside class: "footnote" do |a|
64
- a << make_table_footnote_text(node, tid + fn, fn)
65
- end
66
- @in_footnote = false
67
- @seen_footnote << (tid + fn)
68
- end
69
-
70
- def footnote_parse(node, out)
71
- return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
72
- !node.ancestors.map(&:name).include?("fmt-name")
73
-
74
- fn = node["reference"] || UUIDTools::UUID.random_create.to_s
75
- attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
76
- out.a **attrs do |a|
77
- a.sup { |sup| sup << fn }
78
- end
79
- make_footnote(node, fn)
80
- end
81
-
82
- def make_footnote(node, fnote)
83
- return if @seen_footnote.include?(fnote)
84
-
85
- @in_footnote = true
86
- @footnotes << make_generic_footnote_text(node, fnote)
87
- @in_footnote = false
88
- @seen_footnote << fnote
89
- end
90
- end
91
- end
92
- end