paru 1.0.3 → 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: 24975da849bee7997a85776e257d620b13ed93d6b389841eaebe5946c0e2db0d
4
- data.tar.gz: 861159dc635fdbea547993a479010890b2183cb37b72e20a44b507efd44bcc00
3
+ metadata.gz: ce1af248bd31832347d50dff797e9923dd00a9792b29141bac379927c4f899ba
4
+ data.tar.gz: dbc4097ab13bce4d35823ab60735e3cf1b03da672877db46379ed7c68b704ffe
5
5
  SHA512:
6
- metadata.gz: 014d9483bd9a25af560d615f2af241febd6578df578d0635215ea4368cb6e132e00f07ddf105597c60df5b381ac3934bc3d33e1309ac102212eb47ce929313e7
7
- data.tar.gz: 826338759e77839a66968c0105c3a7e90ed08023e0d3dd9b031d62142024686b80642a8a503eef700ad46b22d936277d45e8b5c7d4d046c29f380edac4ed3f68
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, 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
  #
@@ -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
  #####
@@ -96,6 +96,7 @@ ascii: true
96
96
  reference_links: true
97
97
  reference_location: "block"
98
98
  markdown_headings: "atx"
99
+ list_tables: true
99
100
  atx_headers: true
100
101
  top_level_division: "section"
101
102
  number_sections: true
@@ -109,7 +110,10 @@ id_prefix: ""
109
110
  title_prefix: ""
110
111
  css: [""]
111
112
  reference_doc: ""
113
+ split_level: 1
114
+ chunk_template: ""
112
115
  epub_cover_image: ""
116
+ epub_title_page: true
113
117
  epub_metadata: ""
114
118
  epub_embed_font: ""
115
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, 3].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.3
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-08-07 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
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.3.7
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