forked from asciidoctor/asciidoctor-pdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves asciidoctor#353 integrate support for image float into conve…
…rter - add supports_float_wrapping? to check if the following node supports wrapping around a float - add ink_paragraph_in_float_box to handle logic to render paragraph within float box - move cursor as content is inked in float box - update example to show how to enlist a code block in float wrapping - add additional information to float_box
- Loading branch information
1 parent
59edb65
commit 244bda7
Showing
5 changed files
with
272 additions
and
177 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
docs/modules/extend/examples/pdf-converter-code-float-wrapping.rb
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,13 @@ | ||
class PDFConverterCodeFloatWrapping < (Asciidoctor::Converter.for 'pdf') | ||
register_for 'pdf' | ||
|
||
def supports_float_wrapping? node | ||
%i(paragraph listing literal).include? node.context | ||
end | ||
|
||
def convert_code node | ||
return super unless (float_box = @float_box ||= nil) | ||
indent(float_box[:left] - bounds.left, bounds.width - float_box[:right]) { super } | ||
@float_box = nil unless page_number == float_box[:page] && cursor > float_box[:bottom] | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.