coradoc 1.1.5 → 1.1.7

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 (122) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +1 -0
  3. data/.irbrc +1 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +5 -1
  6. data/.rubocop_todo.yml +179 -0
  7. data/Gemfile +11 -0
  8. data/README.adoc +5 -7
  9. data/coradoc.gemspec +5 -16
  10. data/exe/reverse_adoc +1 -1
  11. data/exe/w2a +1 -1
  12. data/flake.lock +114 -0
  13. data/flake.nix +135 -0
  14. data/lib/coradoc/cli.rb +1 -1
  15. data/lib/coradoc/converter.rb +4 -5
  16. data/lib/coradoc/element/attribute.rb +10 -1
  17. data/lib/coradoc/element/attribute_list.rb +4 -3
  18. data/lib/coradoc/element/audio.rb +1 -1
  19. data/lib/coradoc/element/author.rb +2 -2
  20. data/lib/coradoc/element/base.rb +14 -2
  21. data/lib/coradoc/element/bibliography.rb +1 -1
  22. data/lib/coradoc/element/bibliography_entry.rb +1 -1
  23. data/lib/coradoc/element/block/open.rb +1 -1
  24. data/lib/coradoc/element/block.rb +1 -1
  25. data/lib/coradoc/element/document_attributes.rb +8 -2
  26. data/lib/coradoc/element/image/block_image.rb +3 -2
  27. data/lib/coradoc/element/image/core.rb +5 -4
  28. data/lib/coradoc/element/inline/attribute_reference.rb +19 -0
  29. data/lib/coradoc/element/inline/cross_reference.rb +4 -3
  30. data/lib/coradoc/element/inline/footnote.rb +24 -0
  31. data/lib/coradoc/element/inline/small.rb +19 -0
  32. data/lib/coradoc/element/inline/span.rb +37 -0
  33. data/lib/coradoc/element/inline/underline.rb +19 -0
  34. data/lib/coradoc/element/inline.rb +5 -1
  35. data/lib/coradoc/element/list/core.rb +2 -2
  36. data/lib/coradoc/element/list/ordered.rb +1 -0
  37. data/lib/coradoc/element/list/unordered.rb +1 -0
  38. data/lib/coradoc/element/list_item.rb +19 -20
  39. data/lib/coradoc/element/table.rb +4 -2
  40. data/lib/coradoc/element/term.rb +1 -0
  41. data/lib/coradoc/element/text_element.rb +4 -1
  42. data/lib/coradoc/element/title.rb +1 -1
  43. data/lib/coradoc/element/video.rb +2 -2
  44. data/lib/coradoc/input/adoc.rb +20 -18
  45. data/lib/coradoc/input/docx.rb +25 -23
  46. data/lib/coradoc/input/html/README.adoc +1 -1
  47. data/lib/coradoc/input/html/cleaner.rb +121 -117
  48. data/lib/coradoc/input/html/config.rb +58 -56
  49. data/lib/coradoc/input/html/converters/a.rb +44 -39
  50. data/lib/coradoc/input/html/converters/aside.rb +12 -8
  51. data/lib/coradoc/input/html/converters/audio.rb +24 -20
  52. data/lib/coradoc/input/html/converters/base.rb +103 -99
  53. data/lib/coradoc/input/html/converters/blockquote.rb +18 -14
  54. data/lib/coradoc/input/html/converters/br.rb +11 -7
  55. data/lib/coradoc/input/html/converters/bypass.rb +77 -73
  56. data/lib/coradoc/input/html/converters/code.rb +18 -14
  57. data/lib/coradoc/input/html/converters/div.rb +15 -11
  58. data/lib/coradoc/input/html/converters/dl.rb +51 -44
  59. data/lib/coradoc/input/html/converters/drop.rb +21 -17
  60. data/lib/coradoc/input/html/converters/em.rb +16 -12
  61. data/lib/coradoc/input/html/converters/figure.rb +19 -15
  62. data/lib/coradoc/input/html/converters/h.rb +32 -30
  63. data/lib/coradoc/input/html/converters/head.rb +17 -13
  64. data/lib/coradoc/input/html/converters/hr.rb +11 -7
  65. data/lib/coradoc/input/html/converters/ignore.rb +15 -11
  66. data/lib/coradoc/input/html/converters/img.rb +98 -93
  67. data/lib/coradoc/input/html/converters/li.rb +13 -9
  68. data/lib/coradoc/input/html/converters/mark.rb +14 -10
  69. data/lib/coradoc/input/html/converters/markup.rb +22 -18
  70. data/lib/coradoc/input/html/converters/math.rb +26 -19
  71. data/lib/coradoc/input/html/converters/ol.rb +55 -50
  72. data/lib/coradoc/input/html/converters/p.rb +16 -12
  73. data/lib/coradoc/input/html/converters/pass_through.rb +12 -8
  74. data/lib/coradoc/input/html/converters/pre.rb +49 -45
  75. data/lib/coradoc/input/html/converters/q.rb +12 -8
  76. data/lib/coradoc/input/html/converters/strong.rb +15 -11
  77. data/lib/coradoc/input/html/converters/sub.rb +15 -11
  78. data/lib/coradoc/input/html/converters/sup.rb +15 -11
  79. data/lib/coradoc/input/html/converters/table.rb +21 -13
  80. data/lib/coradoc/input/html/converters/td.rb +64 -60
  81. data/lib/coradoc/input/html/converters/text.rb +24 -20
  82. data/lib/coradoc/input/html/converters/th.rb +13 -9
  83. data/lib/coradoc/input/html/converters/tr.rb +17 -13
  84. data/lib/coradoc/input/html/converters/video.rb +24 -20
  85. data/lib/coradoc/input/html/converters.rb +45 -43
  86. data/lib/coradoc/input/html/errors.rb +8 -6
  87. data/lib/coradoc/input/html/html_converter.rb +93 -90
  88. data/lib/coradoc/input/html/plugin.rb +104 -104
  89. data/lib/coradoc/input/html/plugins/plateau.rb +197 -190
  90. data/lib/coradoc/input/html/postprocessor.rb +188 -182
  91. data/lib/coradoc/input/html.rb +34 -32
  92. data/lib/coradoc/oscal.rb +18 -5
  93. data/lib/coradoc/output/adoc.rb +13 -11
  94. data/lib/coradoc/output/coradoc_tree_debug.rb +15 -13
  95. data/lib/coradoc/parser/asciidoc/admonition.rb +6 -6
  96. data/lib/coradoc/parser/asciidoc/attribute_list.rb +43 -27
  97. data/lib/coradoc/parser/asciidoc/base.rb +3 -6
  98. data/lib/coradoc/parser/asciidoc/bibliography.rb +5 -6
  99. data/lib/coradoc/parser/asciidoc/block.rb +30 -31
  100. data/lib/coradoc/parser/asciidoc/citation.rb +11 -29
  101. data/lib/coradoc/parser/asciidoc/content.rb +23 -33
  102. data/lib/coradoc/parser/asciidoc/document_attributes.rb +2 -3
  103. data/lib/coradoc/parser/asciidoc/header.rb +1 -2
  104. data/lib/coradoc/parser/asciidoc/inline.rb +165 -42
  105. data/lib/coradoc/parser/asciidoc/list.rb +27 -27
  106. data/lib/coradoc/parser/asciidoc/paragraph.rb +28 -19
  107. data/lib/coradoc/parser/asciidoc/section.rb +11 -17
  108. data/lib/coradoc/parser/asciidoc/table.rb +5 -5
  109. data/lib/coradoc/parser/asciidoc/term.rb +24 -8
  110. data/lib/coradoc/parser/asciidoc/text.rb +18 -21
  111. data/lib/coradoc/parser/base.rb +0 -3
  112. data/lib/coradoc/reverse_adoc.rb +3 -3
  113. data/lib/coradoc/transformer.rb +167 -137
  114. data/lib/coradoc/version.rb +1 -1
  115. data/lib/reverse_adoc.rb +1 -1
  116. data/utils/inspect_asciidoc.rb +29 -0
  117. data/utils/parser_analyzer.rb +14 -14
  118. data/utils/round_trip.rb +31 -15
  119. metadata +34 -137
  120. data/.hound.yml +0 -5
  121. data/lib/coradoc/element/inline/citation.rb +0 -24
  122. data/todo.md +0 -10
@@ -1,28 +1,32 @@
1
- module Coradoc::Input::HTML
2
- module Converters
3
- class Text < Base
4
- def to_coradoc(node, state = {})
5
- return treat_empty(node, state) if node.text.strip.empty?
1
+ module Coradoc
2
+ module Input
3
+ module Html
4
+ module Converters
5
+ class Text < Base
6
+ def to_coradoc(node, state = {})
7
+ return treat_empty(node, state) if node.text.strip.empty?
6
8
 
7
- Coradoc::Element::TextElement.new(node.text, html_cleanup: true)
8
- end
9
+ Coradoc::Element::TextElement.new(node.text, html_cleanup: true)
10
+ end
9
11
 
10
- private
12
+ private
11
13
 
12
- def treat_empty(node, state)
13
- parent = node.parent.name.to_sym
14
- if %i[ol ul].include?(parent) # Otherwise the identation is broken
15
- ""
16
- elsif state[:tdsinglepara]
17
- ""
18
- elsif node.text == " " # Regular whitespace text node
19
- " "
20
- else
21
- ""
14
+ def treat_empty(node, state)
15
+ parent = node.parent.name.to_sym
16
+ if %i[ol ul].include?(parent) # Otherwise the identation is broken
17
+ ""
18
+ elsif state[:tdsinglepara]
19
+ ""
20
+ elsif node.text == " " # Regular whitespace text node
21
+ " "
22
+ else
23
+ ""
24
+ end
25
+ end
22
26
  end
27
+
28
+ register :text, Text.new
23
29
  end
24
30
  end
25
-
26
- register :text, Text.new
27
31
  end
28
32
  end
@@ -1,14 +1,18 @@
1
- module Coradoc::Input::HTML
2
- module Converters
3
- class Th < Td
4
- def cellstyle(node)
5
- # this is the header row
6
- return "" if node.parent.previous_element.nil?
1
+ module Coradoc
2
+ module Input
3
+ module Html
4
+ module Converters
5
+ class Th < Td
6
+ def cellstyle(node)
7
+ # this is the header row
8
+ return "" if node.parent.previous_element.nil?
7
9
 
8
- "h"
10
+ "h"
11
+ end
12
+ end
13
+
14
+ register :th, Th.new
9
15
  end
10
16
  end
11
-
12
- register :th, Th.new
13
17
  end
14
18
  end
@@ -1,18 +1,22 @@
1
- module Coradoc::Input::HTML
2
- module Converters
3
- class Tr < Base
4
- def to_coradoc(node, state = {})
5
- content = treat_children_coradoc(node, state)
6
- header = table_header_row?(node)
7
- Coradoc::Element::Table::Row.new(content, header)
8
- end
1
+ module Coradoc
2
+ module Input
3
+ module Html
4
+ module Converters
5
+ class Tr < Base
6
+ def to_coradoc(node, state = {})
7
+ content = treat_children_coradoc(node, state)
8
+ header = table_header_row?(node)
9
+ Coradoc::Element::Table::Row.new(content, header)
10
+ end
11
+
12
+ def table_header_row?(node)
13
+ # node.element_children.all? {|child| child.name.to_sym == :th}
14
+ node.previous_element.nil?
15
+ end
16
+ end
9
17
 
10
- def table_header_row?(node)
11
- # node.element_children.all? {|child| child.name.to_sym == :th}
12
- node.previous_element.nil?
18
+ register :tr, Tr.new
13
19
  end
14
20
  end
15
-
16
- register :tr, Tr.new
17
21
  end
18
22
  end
@@ -1,25 +1,29 @@
1
- module Coradoc::Input::HTML
2
- module Converters
3
- class Video < Base
4
- def to_coradoc(node, _state = {})
5
- src = node["src"]
6
- id = node["id"]
7
- title = extract_title(node)
8
- attributes = Coradoc::Element::AttributeList.new
9
- options = options(node)
10
- attributes.add_named("options", options) if options.any?
11
- Coradoc::Element::Video.new(title, id: id, src: src,
12
- attributes: attributes)
13
- end
1
+ module Coradoc
2
+ module Input
3
+ module Html
4
+ module Converters
5
+ class Video < Base
6
+ def to_coradoc(node, _state = {})
7
+ src = node["src"]
8
+ id = node["id"]
9
+ title = extract_title(node)
10
+ attributes = Coradoc::Element::AttributeList.new
11
+ options = options(node)
12
+ attributes.add_named("options", options) if options.any?
13
+ Coradoc::Element::Video.new(title, id: id, src: src,
14
+ attributes: attributes)
15
+ end
16
+
17
+ def options(node)
18
+ autoplay = node["autoplay"]
19
+ loop_attr = node["loop"]
20
+ controls = node["controls"]
21
+ [autoplay, loop_attr, controls].compact
22
+ end
23
+ end
14
24
 
15
- def options(node)
16
- autoplay = node["autoplay"]
17
- loop_attr = node["loop"]
18
- controls = node["controls"]
19
- [autoplay, loop_attr, controls].compact
25
+ register :video, Video.new
20
26
  end
21
27
  end
22
-
23
- register :video, Video.new
24
28
  end
25
29
  end
@@ -1,55 +1,57 @@
1
1
  module Coradoc
2
- module Input::HTML
3
- module Converters
4
- def self.register(tag_name, converter)
5
- @@converters ||= {}
6
- @@converters[tag_name.to_sym] = converter
7
- end
2
+ module Input
3
+ module Html
4
+ module Converters
5
+ def self.register(tag_name, converter)
6
+ @@converters ||= {}
7
+ @@converters[tag_name.to_sym] = converter
8
+ end
8
9
 
9
- def self.unregister(tag_name)
10
- @@converters.delete(tag_name.to_sym)
11
- end
10
+ def self.unregister(tag_name)
11
+ @@converters.delete(tag_name.to_sym)
12
+ end
12
13
 
13
- def self.lookup(tag_name)
14
- converter = @@converters[tag_name.to_sym] || default_converter(tag_name)
15
- converter = converter.new if converter.respond_to? :new
16
- converter
17
- end
14
+ def self.lookup(tag_name)
15
+ converter = @@converters[tag_name.to_sym] || default_converter(tag_name)
16
+ converter = converter.new if converter.respond_to? :new
17
+ converter
18
+ end
18
19
 
19
- # Note: process won't run plugin hooks
20
- def self.process(node, state)
21
- node = node.to_a if node.is_a? Nokogiri::XML::NodeSet
22
- return node.map { |i| process(i, state) }.join if node.is_a? Array
20
+ # Note: process won't run plugin hooks
21
+ def self.process(node, state)
22
+ node = node.to_a if node.is_a? Nokogiri::XML::NodeSet
23
+ return node.map { |i| process(i, state) }.join if node.is_a? Array
23
24
 
24
- lookup(node.name).convert(node, state)
25
- end
25
+ lookup(node.name).convert(node, state)
26
+ end
26
27
 
27
- def self.process_coradoc(node, state)
28
- node = node.to_a if node.is_a? Nokogiri::XML::NodeSet
29
- return node.map { |i| process_coradoc(i, state) } if node.is_a? Array
28
+ def self.process_coradoc(node, state)
29
+ node = node.to_a if node.is_a? Nokogiri::XML::NodeSet
30
+ return node.map { |i| process_coradoc(i, state) } if node.is_a? Array
30
31
 
31
- plugins = state[:plugin_instances] || {}
32
- process = proc { lookup(node.name).to_coradoc(node, state) }
33
- plugins.each do |i|
34
- prev_process = process
35
- process = proc { i.html_tree_run_hooks(node, state, &prev_process) }
32
+ plugins = state[:plugin_instances] || {}
33
+ process = proc { lookup(node.name).to_coradoc(node, state) }
34
+ plugins.each do |i|
35
+ prev_process = process
36
+ process = proc { i.html_tree_run_hooks(node, state, &prev_process) }
37
+ end
38
+ process.(node, state)
36
39
  end
37
- process.(node, state)
38
- end
39
40
 
40
- def self.default_converter(tag_name)
41
- case Coradoc::Input::HTML.config.unknown_tags.to_sym
42
- when :pass_through
43
- Coradoc::Input::HTML::Converters::PassThrough.new
44
- when :drop
45
- Coradoc::Input::HTML::Converters::Drop.new
46
- when :bypass
47
- Coradoc::Input::HTML::Converters::Bypass.new
48
- when :raise
49
- raise UnknownTagError, "unknown tag: #{tag_name}"
50
- else
51
- raise InvalidConfigurationError,
52
- "unknown value #{Coradoc::Input::HTML.config.unknown_tags.inspect} for Coradoc::Input::HTML.config.unknown_tags"
41
+ def self.default_converter(tag_name)
42
+ case Coradoc::Input::Html.config.unknown_tags.to_sym
43
+ when :pass_through
44
+ Coradoc::Input::Html::Converters::PassThrough.new
45
+ when :drop
46
+ Coradoc::Input::Html::Converters::Drop.new
47
+ when :bypass
48
+ Coradoc::Input::Html::Converters::Bypass.new
49
+ when :raise
50
+ raise UnknownTagError, "unknown tag: #{tag_name}"
51
+ else
52
+ raise InvalidConfigurationError,
53
+ "unknown value #{Coradoc::Input::Html.config.unknown_tags.inspect} for Coradoc::Input::HTML.config.unknown_tags"
54
+ end
53
55
  end
54
56
  end
55
57
  end
@@ -1,12 +1,14 @@
1
1
  module Coradoc
2
- module Input::HTML
3
- class Error < StandardError
4
- end
2
+ module Input
3
+ module Html
4
+ class Error < StandardError
5
+ end
5
6
 
6
- class UnknownTagError < Error
7
- end
7
+ class UnknownTagError < Error
8
+ end
8
9
 
9
- class InvalidConfigurationError < Error
10
+ class InvalidConfigurationError < Error
11
+ end
10
12
  end
11
13
  end
12
14
  end
@@ -37,127 +37,130 @@ require_relative "converters/video"
37
37
  require_relative "converters/math"
38
38
 
39
39
  module Coradoc
40
- module Input::HTML
41
- class HtmlConverter
42
- def self.to_coradoc(input, options = {})
43
- Input::HTML.config.with(options) do
44
- plugin_instances = prepare_plugin_instances(options)
45
-
46
- root = track_time "Loading input HTML document" do
47
- case input
48
- when String
49
- Nokogiri::HTML(input).root
50
- when Nokogiri::XML::Document
51
- input.root
52
- when Nokogiri::XML::Node
53
- input
40
+ module Input
41
+ module Html
42
+ class HtmlConverter
43
+ def self.to_coradoc(input, options = {})
44
+ Input::Html.config.with(options) do
45
+ plugin_instances = prepare_plugin_instances(options)
46
+
47
+ root = track_time "Loading input HTML document" do
48
+ case input
49
+ when String
50
+ Nokogiri::HTML(input).root
51
+ when Nokogiri::XML::Document
52
+ input.root
53
+ when Nokogiri::XML::Node
54
+ input
55
+ end
54
56
  end
55
- end
56
57
 
57
- return "" unless root
58
+ return "" unless root
58
59
 
59
- plugin_instances.each do |plugin|
60
- plugin.html_tree = root
61
- if plugin.respond_to?(:preprocess_html_tree)
62
- track_time "Preprocessing document with #{plugin.name} plugin" do
63
- plugin.preprocess_html_tree
60
+ plugin_instances.each do |plugin|
61
+ plugin.html_tree = root
62
+ if plugin.respond_to?(:preprocess_html_tree)
63
+ track_time "Preprocessing document with #{plugin.name} plugin" do
64
+ plugin.preprocess_html_tree
65
+ end
64
66
  end
67
+ root = plugin.html_tree
65
68
  end
66
- root = plugin.html_tree
67
- end
68
69
 
69
- coradoc = track_time "Converting input document tree to Coradoc tree" do
70
- Converters.process_coradoc(root, plugin_instances: plugin_instances)
71
- end
70
+ coradoc = track_time "Converting input document tree to Coradoc tree" do
71
+ Converters.process_coradoc(root,
72
+ plugin_instances: plugin_instances)
73
+ end
72
74
 
73
- coradoc = track_time "Post-process Coradoc tree" do
74
- Postprocessor.process(coradoc)
75
- end
75
+ coradoc = track_time "Post-process Coradoc tree" do
76
+ Postprocessor.process(coradoc)
77
+ end
76
78
 
77
- plugin_instances.each do |plugin|
78
- if plugin.respond_to?(:postprocess_coradoc_tree)
79
- plugin.coradoc_tree = coradoc
80
- track_time "Postprocessing Coradoc tree with #{plugin.name} plugin" do
81
- plugin.postprocess_coradoc_tree
79
+ plugin_instances.each do |plugin|
80
+ if plugin.respond_to?(:postprocess_coradoc_tree)
81
+ plugin.coradoc_tree = coradoc
82
+ track_time "Postprocessing Coradoc tree with #{plugin.name} plugin" do
83
+ plugin.postprocess_coradoc_tree
84
+ end
85
+ coradoc = plugin.coradoc_tree
82
86
  end
83
- coradoc = plugin.coradoc_tree
84
87
  end
85
- end
86
88
 
87
- options[:plugin_instances] = plugin_instances unless options.frozen?
89
+ options[:plugin_instances] = plugin_instances unless options.frozen?
88
90
 
89
- coradoc
91
+ coradoc
92
+ end
90
93
  end
91
- end
92
94
 
93
- def self.convert(input, options = {})
94
- Input::HTML.config.with(options) do
95
- plugin_instances = prepare_plugin_instances(options)
95
+ def self.convert(input, options = {})
96
+ Input::Html.config.with(options) do
97
+ prepare_plugin_instances(options)
96
98
 
97
- coradoc = to_coradoc(input, options)
99
+ coradoc = to_coradoc(input, options)
98
100
 
99
- if coradoc.is_a?(Hash)
100
- coradoc.to_h do |file, tree|
101
- track_time "Converting file #{file || 'main'}" do
102
- [file,
103
- convert_single_coradoc_to_adoc(file, tree, options)]
101
+ if coradoc.is_a?(Hash)
102
+ coradoc.to_h do |file, tree|
103
+ track_time "Converting file #{file || 'main'}" do
104
+ [file,
105
+ convert_single_coradoc_to_adoc(file, tree, options)]
106
+ end
104
107
  end
108
+ else
109
+ convert_single_coradoc_to_adoc(nil, coradoc, options)
105
110
  end
106
- else
107
- convert_single_coradoc_to_adoc(nil, coradoc, options)
108
111
  end
109
112
  end
110
- end
111
113
 
112
- def self.convert_single_coradoc_to_adoc(_file, coradoc, options)
113
- plugin_instances = prepare_plugin_instances(options)
114
+ def self.convert_single_coradoc_to_adoc(_file, coradoc, options)
115
+ prepare_plugin_instances(options)
114
116
 
115
- result = track_time "Converting Coradoc tree into Asciidoc" do
116
- Coradoc::Generator.gen_adoc(coradoc)
117
+ result = track_time "Converting Coradoc tree into Asciidoc" do
118
+ Coradoc::Generator.gen_adoc(coradoc)
119
+ end
120
+ cleanup_result(result, options)
117
121
  end
118
- cleanup_result(result, options)
119
- end
120
122
 
121
- def self.cleanup_result(result, options)
122
- Input::HTML.config.with(options) do
123
- plugin_instances = prepare_plugin_instances(options)
123
+ def self.cleanup_result(result, options)
124
+ Input::Html.config.with(options) do
125
+ plugin_instances = prepare_plugin_instances(options)
124
126
 
125
- result = track_time "Cleaning up the result" do
126
- Input::HTML.cleaner.tidy(result)
127
- end
128
- plugin_instances.each do |plugin|
129
- if plugin.respond_to?(:postprocess_asciidoc_string)
130
- plugin.asciidoc_string = result
131
- track_time "Postprocessing AsciiDoc string with #{plugin.name} plugin" do
132
- plugin.postprocess_asciidoc_string
127
+ result = track_time "Cleaning up the result" do
128
+ Input::Html.cleaner.tidy(result)
129
+ end
130
+ plugin_instances.each do |plugin|
131
+ if plugin.respond_to?(:postprocess_asciidoc_string)
132
+ plugin.asciidoc_string = result
133
+ track_time "Postprocessing AsciiDoc string with #{plugin.name} plugin" do
134
+ plugin.postprocess_asciidoc_string
135
+ end
136
+ result = plugin.asciidoc_string
133
137
  end
134
- result = plugin.asciidoc_string
135
138
  end
136
- end
137
139
 
138
- result
140
+ result
141
+ end
139
142
  end
140
- end
141
143
 
142
- def self.prepare_plugin_instances(options)
143
- options[:plugin_instances] || Coradoc::Input::HTML.config.plugins.map(&:new)
144
- end
144
+ def self.prepare_plugin_instances(options)
145
+ options[:plugin_instances] || Coradoc::Input::Html.config.plugins.map(&:new)
146
+ end
145
147
 
146
- @track_time_indentation = 0
147
- def self.track_time(task)
148
- if Input::HTML.config.track_time
149
- warn " " * @track_time_indentation +
150
- "* #{task} is starting..."
151
- @track_time_indentation += 1
152
- t0 = Time.now
153
- ret = yield
154
- time_elapsed = Time.now - t0
155
- @track_time_indentation -= 1
156
- warn " " * @track_time_indentation +
157
- "* #{task} took #{time_elapsed.round(3)} seconds"
158
- ret
159
- else
160
- yield
148
+ @track_time_indentation = 0
149
+ def self.track_time(task)
150
+ if Input::Html.config.track_time
151
+ warn " " * @track_time_indentation +
152
+ "* #{task} is starting..."
153
+ @track_time_indentation += 1
154
+ t0 = Time.now
155
+ ret = yield
156
+ time_elapsed = Time.now - t0
157
+ @track_time_indentation -= 1
158
+ warn " " * @track_time_indentation +
159
+ "* #{task} took #{time_elapsed.round(3)} seconds"
160
+ ret
161
+ else
162
+ yield
163
+ end
161
164
  end
162
165
  end
163
166
  end