paru 1.5.0 → 1.5.1

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paru/error.rb +6 -4
  3. data/lib/paru/filter/ast_manipulation.rb +90 -91
  4. data/lib/paru/filter/attr.rb +75 -69
  5. data/lib/paru/filter/block.rb +15 -14
  6. data/lib/paru/filter/block_quote.rb +14 -12
  7. data/lib/paru/filter/bullet_list.rb +17 -16
  8. data/lib/paru/filter/caption.rb +50 -48
  9. data/lib/paru/filter/cell.rb +52 -50
  10. data/lib/paru/filter/citation.rb +53 -51
  11. data/lib/paru/filter/cite.rb +34 -33
  12. data/lib/paru/filter/code.rb +51 -49
  13. data/lib/paru/filter/code_block.rb +76 -76
  14. data/lib/paru/filter/col_spec.rb +58 -56
  15. data/lib/paru/filter/definition_list.rb +51 -52
  16. data/lib/paru/filter/definition_list_item.rb +45 -43
  17. data/lib/paru/filter/div.rb +37 -35
  18. data/lib/paru/filter/document.rb +112 -115
  19. data/lib/paru/filter/emph.rb +7 -5
  20. data/lib/paru/filter/empty_block.rb +17 -16
  21. data/lib/paru/filter/empty_inline.rb +23 -22
  22. data/lib/paru/filter/figure.rb +41 -39
  23. data/lib/paru/filter/header.rb +41 -39
  24. data/lib/paru/filter/horizontal_rule.rb +7 -5
  25. data/lib/paru/filter/image.rb +13 -12
  26. data/lib/paru/filter/inline.rb +27 -26
  27. data/lib/paru/filter/inner_markdown.rb +60 -62
  28. data/lib/paru/filter/int_value.rb +19 -18
  29. data/lib/paru/filter/line_block.rb +13 -11
  30. data/lib/paru/filter/line_break.rb +7 -5
  31. data/lib/paru/filter/link.rb +34 -33
  32. data/lib/paru/filter/list.rb +37 -37
  33. data/lib/paru/filter/list_attributes.rb +52 -51
  34. data/lib/paru/filter/math.rb +66 -64
  35. data/lib/paru/filter/meta.rb +40 -39
  36. data/lib/paru/filter/meta_blocks.rb +7 -5
  37. data/lib/paru/filter/meta_bool.rb +7 -5
  38. data/lib/paru/filter/meta_inlines.rb +9 -7
  39. data/lib/paru/filter/meta_list.rb +7 -5
  40. data/lib/paru/filter/meta_map.rb +50 -49
  41. data/lib/paru/filter/meta_string.rb +7 -6
  42. data/lib/paru/filter/meta_value.rb +26 -25
  43. data/lib/paru/filter/metadata.rb +150 -88
  44. data/lib/paru/filter/node.rb +400 -406
  45. data/lib/paru/filter/note.rb +29 -29
  46. data/lib/paru/filter/null.rb +7 -5
  47. data/lib/paru/filter/ordered_list.rb +50 -49
  48. data/lib/paru/filter/para.rb +21 -20
  49. data/lib/paru/filter/plain.rb +23 -21
  50. data/lib/paru/filter/quoted.rb +28 -26
  51. data/lib/paru/filter/short_caption.rb +7 -5
  52. data/lib/paru/filter/small_caps.rb +8 -7
  53. data/lib/paru/filter/soft_break.rb +7 -5
  54. data/lib/paru/filter/space.rb +7 -5
  55. data/lib/paru/filter/span.rb +29 -27
  56. data/lib/paru/filter/str.rb +33 -32
  57. data/lib/paru/filter/strikeout.rb +7 -6
  58. data/lib/paru/filter/strong.rb +7 -6
  59. data/lib/paru/filter/subscript.rb +7 -6
  60. data/lib/paru/filter/superscript.rb +7 -6
  61. data/lib/paru/filter/table.rb +201 -210
  62. data/lib/paru/filter/table_body.rb +67 -67
  63. data/lib/paru/filter/table_end.rb +53 -55
  64. data/lib/paru/filter/table_foot.rb +8 -7
  65. data/lib/paru/filter/table_head.rb +8 -7
  66. data/lib/paru/filter/target.rb +29 -27
  67. data/lib/paru/filter/underline.rb +7 -5
  68. data/lib/paru/filter/value.rb +74 -75
  69. data/lib/paru/filter/version.rb +23 -22
  70. data/lib/paru/filter.rb +355 -331
  71. data/lib/paru/filter_error.rb +7 -5
  72. data/lib/paru/info.rb +29 -30
  73. data/lib/paru/pandoc.rb +241 -248
  74. data/lib/paru/pandoc2yaml.rb +51 -42
  75. data/lib/paru/selector.rb +193 -184
  76. data/lib/paru.rb +3 -1
  77. metadata +4 -73
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
- # Copyright 2015, 2016, 2017, 2020, 2023 Huub de Beer <Huub@heerdebeer.org>
4
+ # Copyright 2015--2025 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
4
6
  # This file is part of Paru
5
7
  #
@@ -16,125 +18,120 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require "json"
21
+ require 'json'
20
22
 
21
- require_relative "./node.rb"
22
- require_relative "./plain.rb"
23
- require_relative "./meta.rb"
24
- require_relative "./version.rb"
23
+ require_relative 'node'
24
+ require_relative 'plain'
25
+ require_relative 'meta'
26
+ require_relative 'version'
25
27
 
26
- require_relative "../filter_error.rb"
28
+ require_relative '../filter_error'
27
29
 
28
30
  module Paru
29
- module PandocFilter
30
- # Pandoc type version key
31
- VERSION = "pandoc-api-version"
32
- # Pandoc type meta key
33
- META = "meta"
34
- # Pandoc type block key
35
- BLOCKS = "blocks"
36
-
37
- # The current pandoc type version
38
- # @see https://hackage.haskell.org/package/pandoc-types
39
- CURRENT_PANDOC_VERSION = [1, 23]
40
-
41
- # Each file that is being filtered by pandoc is represented by a root
42
- # Document. It is the root node of the AST of the document in the file.
43
- #
44
- # @!attribute meta
45
- # @return [Meta] the metadata of this document
46
- class Document < Node
47
-
48
- attr_accessor :meta
49
-
50
- # Create a new Document from a JSON representation of the AST
51
- #
52
- # @param json [String] a JSON string representation of the AST of a document
53
- # @return [Document] the newly created document
54
- #
55
- # @raise [ParuFilterError] when parsing JSON AST from pandoc fails
56
- # or the parsed results do not make sense.
57
- def self.from_JSON(json)
58
- begin
59
- doc = JSON.parse json
60
- version, metadata, contents = doc.values_at(VERSION, META, BLOCKS)
61
- rescue Exception => e
62
- raise FilterError.new <<WARNING
63
- Unable to read document.
64
-
65
- Most likely cause: Paru expects a pandoc installation that has been
66
- compiled with pandoc-types >= #{CURRENT_PANDOC_VERSION.join('.')}. You can
67
- check which pandoc-types have been compiled with your pandoc installation by
68
- running `pandoc -v`.
69
-
70
- Original error message: #{e.message}
71
- WARNING
72
- end
73
-
74
- if -1 == (version <=> CURRENT_PANDOC_VERSION)
75
- if metadata.has_key?('debug_')
76
- warn <<WARNING
77
- pandoc-types API version used in document (version = #{version.join('.')}) is
78
- lower than the version of pandoc-types used by paru
79
- (#{CURRENT_PANDOC_VERSION.join('.')}. If you experience unexpected results,
80
- please try updating pandoc or downgrading paru.
81
- WARNING
82
- end
83
- end
84
-
85
- PandocFilter::Document.new version, metadata, contents
86
- end
87
-
88
- # Create a new Document fragment from a list of Node elements
89
- #
90
- # @param node_list [Node[]] a list of nodes to create a Document
91
- # fragment from
92
- #
93
- # @return [Document] the document containing nodes in node_list
94
- def self.fragment(node_list)
95
- meta = Hash.new
96
-
97
- if node_list.nil? or node_list.any? {|n| n.is_block?}
98
- new_doc = Document.new CURRENT_PANDOC_VERSION, meta, []
99
- new_doc.children = node_list
100
- else
101
- node = PandocFilter::Plain.new []
102
- node.children = node_list
103
- new_doc = Document.new CURRENT_PANDOC_VERSION, meta, [node.to_ast]
104
- end
105
-
106
- new_doc
107
- end
108
-
109
- # Create a new Document node based on the pandoc type version,
110
- # metadata, and the contents of the document
111
- #
112
- # @param version [Integer = CURRENT_PANDOC_VERSION] the version of pandoc types
113
- # @param meta [Array = []] metadata
114
- # @param contents [Array = []] contents
115
- def initialize(version = CURRENT_PANDOC_VERSION, meta = [], contents = [])
116
- @version = Version.new version
117
- @meta = Meta.new meta
118
- super contents
119
- end
120
-
121
-
122
- # Create an AST representation of this Document
123
- def to_ast()
124
- {
125
- VERSION => @version.to_ast,
126
- META => @meta.to_ast,
127
- BLOCKS => ast_contents
128
- }
129
- end
130
-
131
- # Create a JSON string representation of the AST of this Document.
132
- # Use this to write back the manipulated AST in a format that
133
- # pandoc understands.
134
- def to_JSON
135
- to_ast.to_json
136
- end
31
+ module PandocFilter
32
+ # Pandoc type version key
33
+ VERSION = 'pandoc-api-version'
34
+ # Pandoc type meta key
35
+ META = 'meta'
36
+ # Pandoc type block key
37
+ BLOCKS = 'blocks'
38
+
39
+ # The current pandoc type version
40
+ # @see https://hackage.haskell.org/package/pandoc-types
41
+ CURRENT_PANDOC_VERSION = [1, 23].freeze
42
+
43
+ # Each file that is being filtered by pandoc is represented by a root
44
+ # Document. It is the root node of the AST of the document in the file.
45
+ #
46
+ # @!attribute meta
47
+ # @return [Meta] the metadata of this document
48
+ class Document < Node
49
+ attr_accessor :meta
50
+
51
+ # Create a new Document from a JSON representation of the AST
52
+ #
53
+ # @param json [String] a JSON string representation of the AST of a document
54
+ # @return [Document] the newly created document
55
+ #
56
+ # @raise [ParuFilterError] when parsing JSON AST from pandoc fails
57
+ # or the parsed results do not make sense.
58
+ def self.from_JSON(json)
59
+ begin
60
+ doc = JSON.parse json
61
+ version, metadata, contents = doc.values_at(VERSION, META, BLOCKS)
62
+ rescue Exception => e
63
+ raise FilterError, <<~WARNING
64
+ Unable to read document.
65
+
66
+ Most likely cause: Paru expects a pandoc installation that has been
67
+ compiled with pandoc-types >= #{CURRENT_PANDOC_VERSION.join('.')}. You can
68
+ check which pandoc-types have been compiled with your pandoc installation by
69
+ running `pandoc -v`.#{' '}
70
+
71
+ Original error message: #{e.message}
72
+ WARNING
73
+ end
137
74
 
75
+ if ((version <=> CURRENT_PANDOC_VERSION) == -1) && metadata.key?('debug_')
76
+ warn <<~WARNING
77
+ pandoc-types API version used in document (version = #{version.join('.')}) is
78
+ lower than the version of pandoc-types used by paru
79
+ (#{CURRENT_PANDOC_VERSION.join('.')}. If you experience unexpected results,
80
+ please try updating pandoc or downgrading paru.
81
+ WARNING
138
82
  end
83
+
84
+ PandocFilter::Document.new version, metadata, contents
85
+ end
86
+
87
+ # Create a new Document fragment from a list of Node elements
88
+ #
89
+ # @param node_list [Node[]] a list of nodes to create a Document
90
+ # fragment from
91
+ #
92
+ # @return [Document] the document containing nodes in node_list
93
+ def self.fragment(node_list)
94
+ meta = {}
95
+
96
+ if node_list.nil? || node_list.any?(&:is_block?)
97
+ new_doc = Document.new CURRENT_PANDOC_VERSION, meta, []
98
+ new_doc.children = node_list
99
+ else
100
+ node = PandocFilter::Plain.new []
101
+ node.children = node_list
102
+ new_doc = Document.new CURRENT_PANDOC_VERSION, meta, [node.to_ast]
103
+ end
104
+
105
+ new_doc
106
+ end
107
+
108
+ # Create a new Document node based on the pandoc type version,
109
+ # metadata, and the contents of the document
110
+ #
111
+ # @param version [Integer = CURRENT_PANDOC_VERSION] the version of pandoc types
112
+ # @param meta [Array = []] metadata
113
+ # @param contents [Array = []] contents
114
+ def initialize(version = CURRENT_PANDOC_VERSION, meta = [], contents = [])
115
+ @version = Version.new version
116
+ @meta = Meta.new meta
117
+ super(contents)
118
+ end
119
+
120
+ # Create an AST representation of this Document
121
+ def to_ast
122
+ {
123
+ VERSION => @version.to_ast,
124
+ META => @meta.to_ast,
125
+ BLOCKS => ast_contents
126
+ }
127
+ end
128
+
129
+ # Create a JSON string representation of the AST of this Document.
130
+ # Use this to write back the manipulated AST in a format that
131
+ # pandoc understands.
132
+ def to_JSON
133
+ to_ast.to_json
134
+ end
139
135
  end
136
+ end
140
137
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,12 +18,12 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./inline.rb"
21
+ require_relative 'inline'
20
22
 
21
23
  module Paru
22
- module PandocFilter
23
- # An Emph, emphasized Inline
24
- class Emph < Inline
25
- end
24
+ module PandocFilter
25
+ # An Emph, emphasized Inline
26
+ class Emph < Inline
26
27
  end
28
+ end
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,24 +18,23 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./block.rb"
21
+ require_relative 'block'
20
22
 
21
23
  module Paru
22
- module PandocFilter
23
- # An EmptyBlock, has not contents
24
- class EmptyBlock < Block
25
-
26
- # Create an empty block
27
- def initialize(contents = [])
28
- super []
29
- end
24
+ module PandocFilter
25
+ # An EmptyBlock, has not contents
26
+ class EmptyBlock < Block
27
+ # Create an empty block
28
+ def initialize(_contents = [])
29
+ super([])
30
+ end
30
31
 
31
- # Create an AST representation of this EmptyBlock
32
- def to_ast
33
- {
34
- "t" => ast_type
35
- }
36
- end
37
- end
32
+ # Create an AST representation of this EmptyBlock
33
+ def to_ast
34
+ {
35
+ 't' => ast_type
36
+ }
37
+ end
38
38
  end
39
+ end
39
40
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,31 +18,30 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./inline.rb"
21
+ require_relative 'inline'
20
22
 
21
23
  module Paru
22
- module PandocFilter
23
- # An EmptyInline node, has no content
24
- class EmptyInline < Inline
25
-
26
- # Create an EmptyInline node
27
- def initialize _
28
- super []
29
- end
24
+ module PandocFilter
25
+ # An EmptyInline node, has no content
26
+ class EmptyInline < Inline
27
+ # Create an EmptyInline node
28
+ def initialize(_)
29
+ super([])
30
+ end
30
31
 
31
- # Has this empty inline contents?
32
- #
33
- # @return [Boolean] false
34
- def has_inline?
35
- false
36
- end
32
+ # Has this empty inline contents?
33
+ #
34
+ # @return [Boolean] false
35
+ def has_inline?
36
+ false
37
+ end
37
38
 
38
- # Create an AST representation of this EmptyInline
39
- def to_ast
40
- {
41
- "t" => ast_type
42
- }
43
- end
44
- end
39
+ # Create an AST representation of this EmptyInline
40
+ def to_ast
41
+ {
42
+ 't' => ast_type
43
+ }
44
+ end
45
45
  end
46
+ end
46
47
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2023 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,50 +18,50 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./block.rb"
20
- require_relative "./attr.rb"
21
- require_relative "./caption.rb"
22
- require_relative "./inner_markdown.rb"
21
+ require_relative 'block'
22
+ require_relative 'attr'
23
+ require_relative 'caption'
24
+ require_relative 'inner_markdown'
23
25
 
24
26
  module Paru
25
- module PandocFilter
26
- # A Figure node consisting of an attribute object, a caption, and a list of Block nodes.
27
- class Figure < Block
28
- include InnerMarkdown
27
+ module PandocFilter
28
+ # A Figure node consisting of an attribute object, a caption, and a list of Block nodes.
29
+ class Figure < Block
30
+ include InnerMarkdown
29
31
 
30
- # A Figure node has an attribute object
31
- #
32
- # @!attribute attr
33
- # @return [Attr]
34
- #
35
- # @!attribute caption
36
- # @return Caption
37
- attr_accessor :attr, :caption
32
+ # A Figure node has an attribute object
33
+ #
34
+ # @!attribute attr
35
+ # @return [Attr]
36
+ #
37
+ # @!attribute caption
38
+ # @return Caption
39
+ attr_accessor :attr, :caption
38
40
 
39
- # Create a new Figure node based on the contents
40
- #
41
- # @param contents [Array]
42
- def initialize(contents)
43
- @attr = Attr.new contents[0]
44
- @caption = Caption.new contents[1]
45
- super contents[2]
46
- end
41
+ # Create a new Figure node based on the contents
42
+ #
43
+ # @param contents [Array]
44
+ def initialize(contents)
45
+ @attr = Attr.new contents[0]
46
+ @caption = Caption.new contents[1]
47
+ super(contents[2])
48
+ end
47
49
 
48
- # Create an AST representation of this Figure node.
49
- def ast_contents()
50
- [
51
- @attr.to_ast,
52
- @caption.to_ast,
53
- super
54
- ]
55
- end
50
+ # Create an AST representation of this Figure node.
51
+ def ast_contents
52
+ [
53
+ @attr.to_ast,
54
+ @caption.to_ast,
55
+ super
56
+ ]
57
+ end
56
58
 
57
- # Has this Figure node Blocks as children?
58
- #
59
- # @return [Boolean] true
60
- def has_block?
61
- true
62
- end
63
- end
59
+ # Has this Figure node Blocks as children?
60
+ #
61
+ # @return [Boolean] true
62
+ def has_block?
63
+ true
64
+ end
64
65
  end
66
+ end
65
67
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,50 +18,50 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./block.rb"
20
- require_relative "./attr.rb"
21
- require_relative "./inner_markdown.rb"
21
+ require_relative 'block'
22
+ require_relative 'attr'
23
+ require_relative 'inner_markdown'
22
24
 
23
25
  module Paru
24
- module PandocFilter
25
- # A Header node has a level, an attribute object and the contents of
26
- # the header as a list on Inline nodes.
27
- #
28
- # @!attribute level
29
- # @return [Integer]
30
- #
31
- # @!attribute attr
32
- # @return [Attr]
33
- class Header < Block
34
- include InnerMarkdown
26
+ module PandocFilter
27
+ # A Header node has a level, an attribute object and the contents of
28
+ # the header as a list on Inline nodes.
29
+ #
30
+ # @!attribute level
31
+ # @return [Integer]
32
+ #
33
+ # @!attribute attr
34
+ # @return [Attr]
35
+ class Header < Block
36
+ include InnerMarkdown
35
37
 
36
- attr_accessor :level, :attr
38
+ attr_accessor :level, :attr
37
39
 
38
- # Create a new Header node
39
- #
40
- # @param contents [Array] an array with the level, attribute, and
41
- # the header contents
42
- def initialize(contents)
43
- @level = contents[0]
44
- @attr = Attr.new contents[1]
45
- super contents[2], true
46
- end
40
+ # Create a new Header node
41
+ #
42
+ # @param contents [Array] an array with the level, attribute, and
43
+ # the header contents
44
+ def initialize(contents)
45
+ @level = contents[0]
46
+ @attr = Attr.new contents[1]
47
+ super(contents[2], true)
48
+ end
47
49
 
48
- # Create an AST representation of this Header node
49
- def ast_contents()
50
- [
51
- @level,
52
- @attr.to_ast,
53
- super
54
- ]
55
- end
50
+ # Create an AST representation of this Header node
51
+ def ast_contents
52
+ [
53
+ @level,
54
+ @attr.to_ast,
55
+ super
56
+ ]
57
+ end
56
58
 
57
- # Has this Header node inline contents?
58
- #
59
- # @return [Boolean] true
60
- def has_inline?
61
- true
62
- end
63
- end
59
+ # Has this Header node inline contents?
60
+ #
61
+ # @return [Boolean] true
62
+ def has_inline?
63
+ true
64
+ end
64
65
  end
66
+ end
65
67
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,12 +18,12 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./empty_block.rb"
21
+ require_relative 'empty_block'
20
22
 
21
23
  module Paru
22
- module PandocFilter
23
- # HorizontalRule
24
- class HorizontalRule < EmptyBlock
25
- end
24
+ module PandocFilter
25
+ # HorizontalRule
26
+ class HorizontalRule < EmptyBlock
26
27
  end
28
+ end
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
3
5
  #
@@ -16,19 +18,18 @@
16
18
  # You should have received a copy of the GNU General Public License
17
19
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
20
  #++
19
- require_relative "./link.rb"
21
+ require_relative 'link'
20
22
 
21
23
  module Paru
22
- module PandocFilter
23
- # An Image has an attribute object, a caption, and a target
24
- class Image < Link
25
-
26
- # Although Image is defined to be inline, probably because in HTML it
27
- # can be an inline element, often it acts like a block element.
28
- # @return [Boolean] true
29
- def can_act_as_both_block_and_inline?
30
- true
31
- end
32
- end
24
+ module PandocFilter
25
+ # An Image has an attribute object, a caption, and a target
26
+ class Image < Link
27
+ # Although Image is defined to be inline, probably because in HTML it
28
+ # can be an inline element, often it acts like a block element.
29
+ # @return [Boolean] true
30
+ def can_act_as_both_block_and_inline?
31
+ true
32
+ end
33
33
  end
34
+ end
34
35
  end