Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #254 support writing to STDOUT (and other IO objects) #255

Merged
merged 1 commit into from
Jul 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/asciidoctor-pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2052,11 +2052,18 @@ def add_outline_level outline, sections, num_levels, page_num_labels, numbering_
end

def write pdf_doc, target
pdf_doc.render_file target
if target.respond_to? :write
require_relative 'core_ext/quantifiable_stdout' unless defined? ::QuantifiableStdout
target = ::QuantifiableStdout.new STDOUT if target == STDOUT
pdf_doc.render target
else
pdf_doc.render_file target
# QUESTION restore attributes first?
@pdfmarks.generate_file target if @pdfmarks
end
# write scratch document if debug is enabled (or perhaps DEBUG_STEPS env)
#get_scratch_document.render_file 'scratch.pdf'
# QUESTION restore attributes first?
@pdfmarks.generate_file target if @pdfmarks
nil
end

def register_fonts font_catalog, scripts = 'latin', fonts_dir
Expand Down