Sha256: 1e63f7c73a52c7a6a02a918f6e0ec9e652363eb5bb1cc3afab7f109d63646149

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

module Asciidoctor
module Pdf
class Pdfmark
  include ::Asciidoctor::Pdf::Sanitizer

  def initialize doc
    @doc = doc
  end

  def generate
    doc = @doc
    # FIXME use sanitize: :plain_text once available
    content = <<-EOS
[ /Title #{sanitize(doc.doctitle use_fallback: true).to_pdf}
  /Author #{(doc.attr 'authors').to_pdf}
  /Subject #{(doc.attr 'subject').to_pdf}
  /Keywords #{(doc.attr 'keywords').to_pdf}
  /ModDate #{date = ::Time.now.to_pdf}
  /CreationDate #{date}
  /Creator (Asciidoctor PDF #{::Asciidoctor::Pdf::VERSION}, based on Prawn #{::Prawn::VERSION})
  /Producer #{(doc.attr 'publisher').to_pdf}
  /DOCINFO pdfmark
    EOS
    content
  end

  def generate_file pdf_file
    # QUESTION should we use the extension pdfmeta to be more clear?
    ::IO.write %(#{pdf_file}mark), generate
  end
end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.alpha.16 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.alpha.15 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.alpha.14 lib/asciidoctor-pdf/pdfmark.rb