Sha256: 57670bac392278f075049930011c32405a05d9043796ede362fb0fa408c86284

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 Bytes

Contents

# frozen_string_literal: true
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

4 entries across 4 versions & 1 rubygems

Version Path
asciidoctor-pdf-1.5.0.beta.5 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.beta.4 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.beta.3 lib/asciidoctor-pdf/pdfmark.rb
asciidoctor-pdf-1.5.0.beta.2 lib/asciidoctor-pdf/pdfmark.rb