paru 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc1a2d8d47cd75c3bc4d34a4fbbbecf8eca9d475e8e3f2aa1260f02e39f8885f
4
- data.tar.gz: df6b6ea223c9e48067ddd342a51715fb6fbab95d08e94c5f26f263b789dd63fe
3
+ metadata.gz: ce1af248bd31832347d50dff797e9923dd00a9792b29141bac379927c4f899ba
4
+ data.tar.gz: dbc4097ab13bce4d35823ab60735e3cf1b03da672877db46379ed7c68b704ffe
5
5
  SHA512:
6
- metadata.gz: ceaa544a0e8963d59c70700f3208bac827a2c2274dd4be86673ccfc26977c59914c8b8d69521d8b2629ec745bda85c316a55ac47d5b0e69fa177d88e4fef2c47
7
- data.tar.gz: 9113b9aaae1d0f4fe3e4188a76556984542b8281154faba088dd38a97630d3a66031d8d0b49b029069bd719178b355be6e240bcdd7bedfa3ad754083143668bf
6
+ metadata.gz: 960314d21f9d12868a0da353e52ef31a268ac2b0e325a50d3524decd37cdd0c79cbcbc73ee9f4fa653cf2cc47212c9950bf99bd6ff6ec7d37ddbceeaae3cfe64
7
+ data.tar.gz: 563954aac6be4ade3d6f24296364ed28ff0cfcd8c3f9fcde56e74ebc31b3e1517f325acf2bd70d49815b3f892797b46d98eca39e31559641d203f8b57bf63209
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright 2020 Huub de Beer <Huub@heerdebeer.org>
2
+ # Copyright 2020, 2023 Huub de Beer <Huub@heerdebeer.org>
3
3
  #
4
4
  # This file is part of Paru
5
5
  #
@@ -17,12 +17,15 @@
17
17
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
18
  #++
19
19
  require_relative "./block.rb"
20
+ require_relative "./inner_markdown.rb"
20
21
  require_relative "./short_caption.rb"
21
22
 
22
23
  module Paru
23
24
  module PandocFilter
24
- # A table's caption, can contain an optional short caption
25
+ # A table or figure's caption, can contain an optional short caption
25
26
  class Caption < Block
27
+ include InnerMarkdown
28
+
26
29
  attr_accessor :short
27
30
 
28
31
  # Create a new Caption based on the contents
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright 2015, 2016, 2017, 2020 Huub de Beer <Huub@heerdebeer.org>
2
+ # Copyright 2015, 2016, 2017, 2020, 2023 Huub de Beer <Huub@heerdebeer.org>
3
3
  #
4
4
  # This file is part of Paru
5
5
  #
@@ -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, 22]
39
+ CURRENT_PANDOC_VERSION = [1, 23]
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,65 @@
1
+ #--
2
+ # Copyright 2023 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 "./block.rb"
20
+ require_relative "./attr.rb"
21
+ require_relative "./caption.rb"
22
+ require_relative "./inner_markdown.rb"
23
+
24
+ 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
29
+
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
38
+
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
47
+
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
56
+
57
+ # Has this Figure node Blocks as children?
58
+ #
59
+ # @return [Boolean] true
60
+ def has_block?
61
+ true
62
+ end
63
+ end
64
+ end
65
+ end
@@ -68,6 +68,7 @@ module Paru
68
68
  require_relative './table_foot.rb'
69
69
  require_relative './row.rb'
70
70
  require_relative './cell.rb'
71
+ require_relative './figure.rb'
71
72
 
72
73
  # Inline level nodes
73
74
  require_relative './cite.rb'
@@ -386,7 +387,7 @@ module Paru
386
387
  # Only using first block node (paragraph?)
387
388
  if is_inline?
388
389
  temp_doc = temp_doc.children.first
389
-
390
+
390
391
  if not temp_doc.children.all? {|node| node.is_inline?}
391
392
  raise Error.new "Cannot replace the inline level node represented by '#{self.markdown}' with markdown that converts to block level nodes: '#{markdown}'."
392
393
  end
data/lib/paru/filter.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright 2015, 2016, 2017, 2022 Huub de Beer <Huub@heerdebeer.org>
2
+ # Copyright 2015, 2016, 2017, 2022, 2023 Huub de Beer <Huub@heerdebeer.org>
3
3
  #
4
4
  # This file is part of Paru
5
5
  #
@@ -22,7 +22,7 @@ require_relative "./filter/metadata.rb"
22
22
 
23
23
  module Paru
24
24
  # Paru filter is a wrapper around pandoc's JSON api, which is based on
25
- # {pandoc-types}[https://hackage.haskell.org/package/pandoc-types-1.17.0.4/docs/Text-Pandoc-Definition.html].
25
+ # {pandoc-types}[https://hackage.haskell.org/package/pandoc-types-1.23/docs/Text-Pandoc-Definition.html].
26
26
  # Pandoc treats block elements and inline elements differently.
27
27
  #
28
28
  # Pandoc's block elements are:
@@ -44,6 +44,7 @@ module Paru
44
44
  "TableBody",
45
45
  "Row",
46
46
  "Cell",
47
+ "Figure",
47
48
  "Caption",
48
49
  "Div",
49
50
  "Null"
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright 2015, 2016, 2017 Huub de Beer <Huub@heerdebeer.org>
2
+ # Copyright 2015, 2016, 2017, 2022, 2023 Huub de Beer <Huub@heerdebeer.org>
3
3
  #
4
4
  # This file is part of Paru
5
5
  #
@@ -17,7 +17,7 @@
17
17
  # along with Paru. If not, see <http://www.gnu.org/licenses/>.
18
18
  # See http://pandoc.org/README.html for an overview of all options
19
19
  #++
20
- # In order as listed on http://pandoc.org/MANUAL.html (version 2)
20
+ # In order as listed on http://pandoc.org/MANUAL.html (version 3)
21
21
  #####
22
22
  # General options:
23
23
  #####
@@ -90,11 +90,13 @@ no_check_certificate: true
90
90
  # Options affecting specific writers
91
91
  #####
92
92
  self_contained: true
93
+ embed_resources: true
93
94
  html_q_tags: true
94
95
  ascii: true
95
96
  reference_links: true
96
97
  reference_location: "block"
97
98
  markdown_headings: "atx"
99
+ list_tables: true
98
100
  atx_headers: true
99
101
  top_level_division: "section"
100
102
  number_sections: true
@@ -108,7 +110,10 @@ id_prefix: ""
108
110
  title_prefix: ""
109
111
  css: [""]
110
112
  reference_doc: ""
113
+ split_level: 1
114
+ chunk_template: ""
111
115
  epub_cover_image: ""
116
+ epub_title_page: true
112
117
  epub_metadata: ""
113
118
  epub_embed_font: ""
114
119
  epub_chapter_level: 1
data/lib/paru.rb CHANGED
@@ -18,5 +18,5 @@
18
18
  #++
19
19
  module Paru
20
20
  # Paru's current version
21
- VERSION = [1, 0, 2].freeze
21
+ VERSION = [1, 1, 0].freeze
22
22
  end
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: 1.0.2
4
+ version: 1.1.0
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: 2022-06-22 00:00:00.000000000 Z
11
+ date: 2023-02-08 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
@@ -42,6 +42,7 @@ files:
42
42
  - lib/paru/filter/emph.rb
43
43
  - lib/paru/filter/empty_block.rb
44
44
  - lib/paru/filter/empty_inline.rb
45
+ - lib/paru/filter/figure.rb
45
46
  - lib/paru/filter/header.rb
46
47
  - lib/paru/filter/horizontal_rule.rb
47
48
  - lib/paru/filter/image.rb
@@ -110,14 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
112
  - - ">="
112
113
  - !ruby/object:Gem::Version
113
- version: 2.7.6
114
+ version: 2.6.8
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
117
  - - ">="
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.2.3
121
+ rubygems_version: 3.4.1
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: Paru is a ruby wrapper around pandoc