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.
- checksums.yaml +4 -4
- data/lib/paru/error.rb +6 -4
- data/lib/paru/filter/ast_manipulation.rb +90 -91
- data/lib/paru/filter/attr.rb +75 -69
- data/lib/paru/filter/block.rb +15 -14
- data/lib/paru/filter/block_quote.rb +14 -12
- data/lib/paru/filter/bullet_list.rb +17 -16
- data/lib/paru/filter/caption.rb +50 -48
- data/lib/paru/filter/cell.rb +52 -50
- data/lib/paru/filter/citation.rb +53 -51
- data/lib/paru/filter/cite.rb +34 -33
- data/lib/paru/filter/code.rb +51 -49
- data/lib/paru/filter/code_block.rb +76 -76
- data/lib/paru/filter/col_spec.rb +58 -56
- data/lib/paru/filter/definition_list.rb +51 -52
- data/lib/paru/filter/definition_list_item.rb +45 -43
- data/lib/paru/filter/div.rb +37 -35
- data/lib/paru/filter/document.rb +112 -115
- data/lib/paru/filter/emph.rb +7 -5
- data/lib/paru/filter/empty_block.rb +17 -16
- data/lib/paru/filter/empty_inline.rb +23 -22
- data/lib/paru/filter/figure.rb +41 -39
- data/lib/paru/filter/header.rb +41 -39
- data/lib/paru/filter/horizontal_rule.rb +7 -5
- data/lib/paru/filter/image.rb +13 -12
- data/lib/paru/filter/inline.rb +27 -26
- data/lib/paru/filter/inner_markdown.rb +60 -62
- data/lib/paru/filter/int_value.rb +19 -18
- data/lib/paru/filter/line_block.rb +13 -11
- data/lib/paru/filter/line_break.rb +7 -5
- data/lib/paru/filter/link.rb +34 -33
- data/lib/paru/filter/list.rb +37 -37
- data/lib/paru/filter/list_attributes.rb +52 -51
- data/lib/paru/filter/math.rb +66 -64
- data/lib/paru/filter/meta.rb +40 -39
- data/lib/paru/filter/meta_blocks.rb +7 -5
- data/lib/paru/filter/meta_bool.rb +7 -5
- data/lib/paru/filter/meta_inlines.rb +9 -7
- data/lib/paru/filter/meta_list.rb +7 -5
- data/lib/paru/filter/meta_map.rb +50 -49
- data/lib/paru/filter/meta_string.rb +7 -6
- data/lib/paru/filter/meta_value.rb +26 -25
- data/lib/paru/filter/metadata.rb +150 -88
- data/lib/paru/filter/node.rb +400 -406
- data/lib/paru/filter/note.rb +29 -29
- data/lib/paru/filter/null.rb +7 -5
- data/lib/paru/filter/ordered_list.rb +50 -49
- data/lib/paru/filter/para.rb +21 -20
- data/lib/paru/filter/plain.rb +23 -21
- data/lib/paru/filter/quoted.rb +28 -26
- data/lib/paru/filter/short_caption.rb +7 -5
- data/lib/paru/filter/small_caps.rb +8 -7
- data/lib/paru/filter/soft_break.rb +7 -5
- data/lib/paru/filter/space.rb +7 -5
- data/lib/paru/filter/span.rb +29 -27
- data/lib/paru/filter/str.rb +33 -32
- data/lib/paru/filter/strikeout.rb +7 -6
- data/lib/paru/filter/strong.rb +7 -6
- data/lib/paru/filter/subscript.rb +7 -6
- data/lib/paru/filter/superscript.rb +7 -6
- data/lib/paru/filter/table.rb +201 -210
- data/lib/paru/filter/table_body.rb +67 -67
- data/lib/paru/filter/table_end.rb +53 -55
- data/lib/paru/filter/table_foot.rb +8 -7
- data/lib/paru/filter/table_head.rb +8 -7
- data/lib/paru/filter/target.rb +29 -27
- data/lib/paru/filter/underline.rb +7 -5
- data/lib/paru/filter/value.rb +74 -75
- data/lib/paru/filter/version.rb +23 -22
- data/lib/paru/filter.rb +355 -331
- data/lib/paru/filter_error.rb +7 -5
- data/lib/paru/info.rb +29 -30
- data/lib/paru/pandoc.rb +241 -248
- data/lib/paru/pandoc2yaml.rb +51 -42
- data/lib/paru/selector.rb +193 -184
- data/lib/paru.rb +3 -1
- metadata +4 -73
data/lib/paru/filter/document.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
|
-
# Copyright 2015
|
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
|
21
|
+
require 'json'
|
20
22
|
|
21
|
-
require_relative
|
22
|
-
require_relative
|
23
|
-
require_relative
|
24
|
-
require_relative
|
23
|
+
require_relative 'node'
|
24
|
+
require_relative 'plain'
|
25
|
+
require_relative 'meta'
|
26
|
+
require_relative 'version'
|
25
27
|
|
26
|
-
require_relative
|
28
|
+
require_relative '../filter_error'
|
27
29
|
|
28
30
|
module Paru
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
data/lib/paru/filter/emph.rb
CHANGED
@@ -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
|
21
|
+
require_relative 'inline'
|
20
22
|
|
21
23
|
module Paru
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
21
|
+
require_relative 'block'
|
20
22
|
|
21
23
|
module Paru
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
21
|
+
require_relative 'inline'
|
20
22
|
|
21
23
|
module Paru
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
# Has this empty inline contents?
|
33
|
+
#
|
34
|
+
# @return [Boolean] false
|
35
|
+
def has_inline?
|
36
|
+
false
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
data/lib/paru/filter/figure.rb
CHANGED
@@ -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
|
20
|
-
require_relative
|
21
|
-
require_relative
|
22
|
-
require_relative
|
21
|
+
require_relative 'block'
|
22
|
+
require_relative 'attr'
|
23
|
+
require_relative 'caption'
|
24
|
+
require_relative 'inner_markdown'
|
23
25
|
|
24
26
|
module Paru
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
data/lib/paru/filter/header.rb
CHANGED
@@ -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
|
20
|
-
require_relative
|
21
|
-
require_relative
|
21
|
+
require_relative 'block'
|
22
|
+
require_relative 'attr'
|
23
|
+
require_relative 'inner_markdown'
|
22
24
|
|
23
25
|
module Paru
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
38
|
+
attr_accessor :level, :attr
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
21
|
+
require_relative 'empty_block'
|
20
22
|
|
21
23
|
module Paru
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
24
|
+
module PandocFilter
|
25
|
+
# HorizontalRule
|
26
|
+
class HorizontalRule < EmptyBlock
|
26
27
|
end
|
28
|
+
end
|
27
29
|
end
|
data/lib/paru/filter/image.rb
CHANGED
@@ -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
|
21
|
+
require_relative 'link'
|
20
22
|
|
21
23
|
module Paru
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|