Sha256: b5959dffbb32ab36d86699852d615a9f8df0c018e25196a55126b4e4291e749f

Contents?: true

Size: 868 Bytes

Versions: 3

Compression:

Stored size: 868 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?
    ::File.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.beta.1 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.alpha.18 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.alpha.17 lib/asciidoctor-pdf/pdfmark.rb