paru 0.4.1.2 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/paru.rb +1 -1
- data/lib/paru/filter/caption.rb +4 -0
- data/lib/paru/filter/cell.rb +7 -2
- data/lib/paru/filter/document.rb +1 -1
- data/lib/paru/filter/int_value.rb +39 -0
- data/lib/paru/filter/row.rb +8 -1
- data/lib/paru/filter/table.rb +7 -4
- data/lib/paru/filter/table_body.rb +6 -2
- data/lib/paru/filter/table_end.rb +8 -1
- data/lib/paru/pandoc_options_version_2.yaml +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a9b46dce7962abd98b1fc68f3d47fdb3cb9043ed2b739a65089909985382bc5
|
4
|
+
data.tar.gz: 54b67bdf000ef4334c00fa4a784a3d380b86622b0aead7eb5d44e10b66df1465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd0c91bc0ca5b8bb5557d9c5ef318bb0406a5d29c6f23bb99d4ff8b381b3068649ed129ea1e2da148dcde12261966af6e83cfc7fc26d74c686ab305c439033a
|
7
|
+
data.tar.gz: 278cad1486d341cdba097051ee325e28f21b447fa005cb883d5acd3ed44a6509f8715e308a3f671d189d423568f0e81eafe2d38624ccbe2550657ed7ed920207
|
data/lib/paru.rb
CHANGED
data/lib/paru/filter/caption.rb
CHANGED
data/lib/paru/filter/cell.rb
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
#++
|
19
19
|
require_relative "./block.rb"
|
20
20
|
require_relative "./value.rb"
|
21
|
+
require_relative "./int_value.rb"
|
21
22
|
|
22
23
|
module Paru
|
23
24
|
module PandocFilter
|
@@ -44,8 +45,8 @@ module Paru
|
|
44
45
|
def initialize(contents)
|
45
46
|
@attr = Attr.new contents[0]
|
46
47
|
@alignment = Value.new contents[1]
|
47
|
-
@rowspan =
|
48
|
-
@colspan =
|
48
|
+
@rowspan = IntValue.new contents[2]
|
49
|
+
@colspan = IntValue.new contents[3]
|
49
50
|
|
50
51
|
super contents[4]
|
51
52
|
end
|
@@ -62,6 +63,10 @@ module Paru
|
|
62
63
|
@children.map {|child| child.to_ast}
|
63
64
|
]
|
64
65
|
end
|
66
|
+
|
67
|
+
def to_ast()
|
68
|
+
ast_contents()
|
69
|
+
end
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
data/lib/paru/filter/document.rb
CHANGED
@@ -36,7 +36,7 @@ module Paru
|
|
36
36
|
|
37
37
|
# The current pandoc type version
|
38
38
|
# @see https://hackage.haskell.org/package/pandoc-types
|
39
|
-
CURRENT_PANDOC_VERSION = [1,
|
39
|
+
CURRENT_PANDOC_VERSION = [1, 22]
|
40
40
|
|
41
41
|
# Each file that is being filtered by pandoc is represented by a root
|
42
42
|
# Document. It is the root node of the AST of the document in the file.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2020 Huub de Beer <Huub@heerdebeer.org>
|
3
|
+
#
|
4
|
+
# This file is part of Paru
|
5
|
+
#
|
6
|
+
# Paru is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# Paru is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Paru. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
require_relative "./node.rb"
|
20
|
+
require_relative "../filter_error.rb"
|
21
|
+
|
22
|
+
module Paru
|
23
|
+
module PandocFilter
|
24
|
+
|
25
|
+
# An IntValue represents some sort of integer metadata about block or
|
26
|
+
# inline nodes
|
27
|
+
class IntValue
|
28
|
+
attr_accessor :value
|
29
|
+
|
30
|
+
def initialize(value)
|
31
|
+
@value = value
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_ast()
|
35
|
+
@value
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/paru/filter/row.rb
CHANGED
@@ -38,7 +38,10 @@ module Paru
|
|
38
38
|
# this Row node
|
39
39
|
def initialize(contents = [])
|
40
40
|
@attr = Attr.new contents[0]
|
41
|
-
super
|
41
|
+
super []
|
42
|
+
contents[1].each do |cell|
|
43
|
+
@children.push Cell.new cell
|
44
|
+
end
|
42
45
|
end
|
43
46
|
|
44
47
|
# The cells of this row
|
@@ -58,6 +61,10 @@ module Paru
|
|
58
61
|
]
|
59
62
|
end
|
60
63
|
|
64
|
+
def to_ast()
|
65
|
+
ast_contents()
|
66
|
+
end
|
67
|
+
|
61
68
|
# Convert this Row to an array of markdown strings, one for
|
62
69
|
# each cell
|
63
70
|
#
|
data/lib/paru/filter/table.rb
CHANGED
@@ -54,11 +54,14 @@ module Paru
|
|
54
54
|
# @param contents [Array]
|
55
55
|
def initialize(contents)
|
56
56
|
@attr = Attr.new contents[0]
|
57
|
-
@caption = Caption.new contents[1]
|
57
|
+
@caption = Caption.new contents[1]
|
58
58
|
@colspec = contents[2].map {|p| ColSpec.new p}
|
59
|
-
@head = TableHead.new contents[3]
|
60
|
-
super
|
61
|
-
|
59
|
+
@head = TableHead.new contents[3]
|
60
|
+
super []
|
61
|
+
contents[4].each do |table_body|
|
62
|
+
@children.push TableBody.new table_body
|
63
|
+
end
|
64
|
+
@foot = TableFoot.new contents[5]
|
62
65
|
end
|
63
66
|
|
64
67
|
# The AST contents of this Table node
|
@@ -44,12 +44,12 @@ module Paru
|
|
44
44
|
# @param contents [Array] The contents of this TableBody
|
45
45
|
def initialize(contents)
|
46
46
|
@attr = Attr.new contents[0]
|
47
|
-
@rowheadcolumns =
|
47
|
+
@rowheadcolumns = IntValue.new contents[1]
|
48
48
|
@rowheadercolumns = contents[2].map {|r| Row.new r}
|
49
49
|
|
50
50
|
super []
|
51
51
|
contents[3].each do |row|
|
52
|
-
@children.push Row.new row
|
52
|
+
@children.push Row.new row
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -71,6 +71,10 @@ module Paru
|
|
71
71
|
@children.map {|child| child.to_ast}
|
72
72
|
]
|
73
73
|
end
|
74
|
+
|
75
|
+
def to_ast()
|
76
|
+
ast_contents()
|
77
|
+
end
|
74
78
|
|
75
79
|
# Convert this table end to a 2D table of markdown strings for each
|
76
80
|
# cell
|
@@ -38,7 +38,10 @@ module Paru
|
|
38
38
|
# @param contents [Array]
|
39
39
|
def initialize(contents)
|
40
40
|
@attr = Attr.new contents[0]
|
41
|
-
super
|
41
|
+
super []
|
42
|
+
contents[1].each do |row|
|
43
|
+
@children.push Row.new row
|
44
|
+
end
|
42
45
|
end
|
43
46
|
|
44
47
|
def rows()
|
@@ -54,6 +57,10 @@ module Paru
|
|
54
57
|
@children.map {|row| row.to_ast},
|
55
58
|
]
|
56
59
|
end
|
60
|
+
|
61
|
+
def to_ast()
|
62
|
+
ast_contents()
|
63
|
+
end
|
57
64
|
|
58
65
|
# Convert this table end to a 2D table of markdown strings for each
|
59
66
|
# cell
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huub de Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Control pandoc with Ruby and write pandoc filters in Ruby
|
14
14
|
email: Huub@heerdebeer.org
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/paru/filter/image.rb
|
48
48
|
- lib/paru/filter/inline.rb
|
49
49
|
- lib/paru/filter/inner_markdown.rb
|
50
|
+
- lib/paru/filter/int_value.rb
|
50
51
|
- lib/paru/filter/line_block.rb
|
51
52
|
- lib/paru/filter/line_break.rb
|
52
53
|
- lib/paru/filter/link.rb
|
@@ -116,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
119
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.7.7
|
120
|
+
rubygems_version: 3.1.2
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Paru is a ruby wrapper around pandoc
|