-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
221 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#-- | ||
# Copyright 2023 Huub de Beer <Huub@heerdebeer.org> | ||
# | ||
# This file is part of Paru | ||
# | ||
# Paru is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Paru is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Paru. If not, see <http://www.gnu.org/licenses/>. | ||
#++ | ||
require_relative "./block.rb" | ||
require_relative "./attr.rb" | ||
require_relative "./caption.rb" | ||
require_relative "./inner_markdown.rb" | ||
|
||
module Paru | ||
module PandocFilter | ||
# A Figure node consisting of an attribute object, a caption, and a list of Block nodes. | ||
class Figure < Block | ||
include InnerMarkdown | ||
|
||
# A Figure node has an attribute object | ||
# | ||
# @!attribute attr | ||
# @return [Attr] | ||
# | ||
# @!attribute caption | ||
# @return Caption | ||
attr_accessor :attr, :caption | ||
|
||
# Create a new Figure node based on the contents | ||
# | ||
# @param contents [Array] | ||
def initialize(contents) | ||
@attr = Attr.new contents[0] | ||
@caption = Caption.new contents[1] | ||
super contents[2] | ||
end | ||
|
||
# Create an AST representation of this Figure node. | ||
def ast_contents() | ||
[ | ||
@attr.to_ast, | ||
@caption.to_ast, | ||
super | ||
] | ||
end | ||
|
||
# Has this Figure node Blocks as children? | ||
# | ||
# @return [Boolean] true | ||
def has_block? | ||
true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Pandoc 3.0 added the concept of "complex figure": | ||
|
||
 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
This is a test file for the filter `number_figures.rb`. That filter numbers | ||
all figures in a file consecutively. Thus, the following four figures are | ||
numbered 1—4: | ||
numbered 1---4: | ||
|
||
 | ||
|
||
 | ||
|
||
 | ||
|
||
 | ||
First, , then , | ||
followed by  and finally, . | ||
|
||
It does not matter if there is text in between or not. Although without the | ||
newlines in between the figures they are placed on one line when converting | ||
back to markdown again. | ||
|
||
The fifth figure that follows is numbered correctly as well: | ||
back to markdown again. | ||
|
||
 | ||
The fifth figure that follows is numbered correctly as well:  |
Oops, something went wrong.