class SiSU_Metadata::TeX_Metadata

Public Class Methods

new(md) click to toggle source
# File lib/sisu/shared_metadata.rb, line 994
def initialize(md)
  @md=md
  @br="\\\\\n"
  @make=SiSU_Env::ProcessingSettings.new(md)
  @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure
end

Public Instance Methods

meta_para(tag,inf,sc=true) click to toggle source
# File lib/sisu/shared_metadata.rb, line 1000
    def meta_para(tag,inf,sc=true)
      inf=((inf.is_a?(String) && sc) ? spec_char(inf) : inf)
      %{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
}
    end
metadata_tex() click to toggle source
# File lib/sisu/shared_metadata.rb, line 1014
def metadata_tex
  meta=[]
  l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language
  language=l[:n]
  tr=SiSU_Translate::Source.new(@md,language)
  if @make.build.links_to_manifest? \
  and not @o_str.dump_or_redirect?
    tag="Document Manifest @"
    inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
    meta << meta_para(tag,inf)
  end
  if defined? @md.title.full \
  and @md.title.full=~/\S+/
    tag,inf=tr.full_title,@md.title.full
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.author \
  and @md.creator.author=~/\S+/
    tag,inf=tr.author,@md.creator.author
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.translator \
  and @md.creator.translator=~/\S+/
    tag,inf=tr.translator,@md.creator.translator
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.illustrator \
  and @md.creator.illustrator=~/\S+/
    tag,inf=tr.illustrator,@md.creator.illustrator
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.prepared_by \
  and @md.creator.prepared_by=~/\S+/
    tag,inf=tr.prepared_by,@md.creator.prepared_by
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.digitized_by \
  and @md.creator.digitized_by=~/\S+/
    tag,inf=tr.digitized_by,@md.creator.digitized_by
    meta << meta_para(tag,inf)
  end
  if defined? @md.rights.all \
  and @md.rights.all=~/\S+/
    tag,inf=tr.rights,@md.rights.all
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.description \
  and @md.notes.description=~/\S+/
    tag,inf=tr.description,@md.notes.description
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.subject \
  and @md.classify.subject=~/\S+/
    tag,inf=tr.subject,@md.classify.subject
    meta << meta_para(tag,inf)
  end
  if defined? @md.publisher \
  and @md.publisher=~/\S+/
    tag,inf=tr.publisher,@md.publisher
    meta << meta_para(tag,inf)
  end
  if defined? @md.creator.contributor \
  and @md.creator.contributor=~/\S+/
    tag,inf=tr.contributor,@md.creator.contributor
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.abstract \
  and @md.notes.abstract=~/\S+/
    tag,inf=tr.abstract,@md.notes.abstract
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.created \
  and @md.date.created=~/\S+/
    tag,inf=tr.date_created,@md.date.created
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.issued \
  and @md.date.issued=~/\S+/
    tag,inf=tr.date_issued,@md.date.issued
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.available \
  and @md.date.available=~/\S+/
    tag,inf=tr.date_available,@md.date.available
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.modified \
  and @md.date.modified=~/\S+/
    tag,inf=tr.date_modified,@md.date.modified
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.valid \
  and @md.date.valid=~/\S+/
    tag,inf=tr.date_valid,@md.date.valid
    meta << meta_para(tag,inf)
  end
  if defined? @md.date.published \
  and @md.date.published=~/\S+/
    tag,inf=tr.date,@md.date.published
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.topic_register \
  and @md.classify.topic_register=~/\S+/
    tag,inf=tr.topic_register,@md.classify.topic_register
    inf=word_break_points(inf)
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.loc \
  and @md.classify.loc=~/\S+/
    tag,inf=tr.cls_loc,@md.classify.loc
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.dewey \
  and @md.classify.dewey=~/\S+/
    tag,inf=tr.cls_dewey,@md.classify.dewey
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.oclc \
  and @md.classify.oclc=~/\S+/
    tag,inf=tr.cls_oclc,@md.classify.oclc
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.pg \
  and @md.classify.pg=~/\S+/
    tag,inf=tr.cls_gutenberg,@md.classify.pg
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.isbn \
  and @md.classify.isbn=~/\S+/
    tag,inf=tr.cls_isbn,@md.classify.isbn
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.comment \
  and @md.notes.comment=~/\S+/
    tag,inf=tr.comments,@md.notes.comment
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.prefix_a \
  and @md.notes.prefix_a=~/\S+/
    tag,inf=tr.prefix_a,@md.notes.prefix_a
    meta << meta_para(tag,inf)
  end
  if defined? @md.notes.prefix_b \
  and @md.notes.prefix_b=~/\S+/
    tag,inf=tr.prefix_b,@md.notes.prefix_b
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.identifier \
  and @md.classify.identifier=~/\S+/
    tag,inf=tr.identifier,@md.classify.identifier
    meta << meta_para(tag,inf)
  end
  if defined? @md.original.source \
  and @md.original.source=~/\S+/
    tag,inf=tr.source,@md.original.source
    meta << meta_para(tag,inf)
  end
  if defined? @md.title.language \
  and @md.title.language=~/\S+/
    tag,inf=tr.language,@md.title.language
    meta << meta_para(tag,inf)
  end
  if defined? @md.original.language \
  and @md.original.language=~/\S+/
    tag,inf=tr.language_original,@md.original.language
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.format \
  and @md.classify.format=~/\S+/
    tag,inf=tr.format,@md.classify.format
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.relation \
  and @md.classify.relation=~/\S+/
    tag,inf=tr.relation,@md.classify.relation
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.coverage \
  and @md.classify.coverage=~/\S+/
    tag,inf=tr.coverage,@md.classify.coverage
    meta << meta_para(tag,inf)
  end
  if defined? @md.classify.keywords \
  and @md.classify.keywords=~/\S+/
    tag,inf=tr.keywords,@md.classify.keywords
    meta << meta_para(tag,inf)
  end
  meta << %{#{@br}\\begin\{bfseries\}Version Information \\end\{bfseries\}}
  if defined? @md.fns \
  and @md.fns=~/\S+/
    fn=spec_char(@md.fns)
    fn=word_break_points(fn)
    fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}"
    tag,inf=tr.sourcefile,fn
    meta << meta_para(tag,inf,false)
  end
  if defined? @md.file_encoding \
  and @md.file_encoding=~/\S+/
    tag,inf='Filetype',@md.file_encoding
    meta << meta_para(tag,inf)
  end
  if defined? @md.dgst \
  and @md.dgst.is_a?(Array)
    hash_of=spec_char(@md.dgst[0])
    hash_of=word_break_points(hash_of)
    dgst=number_break_points(@md.dgst[1])
    tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-\\begin\{scriptsize\}#{dgst}\\end\{scriptsize\}"
    meta << meta_para(tag,inf,false)
  end
  meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
  if defined? @md.generated \
  and @md.generated.is_a?(Time)
    tag,inf=tr.last_generated,@md.generated
    meta << meta_para(tag,inf)
  end
  if defined? @md.project_details \
  and @md.project_details.version=~/\S+/
    tag=tr.sisu_version
    inf="#{@md.project_details.project} " +
      "#{@md.project_details.version} " +
      "of #{@md.project_details.date_stamp} " +
      "(#{@md.project_details.date})"
    meta << meta_para(tag,inf)
  end
  if defined? @md.ruby_version \
  and @md.ruby_version=~/\S+/
    tag,inf=tr.ruby_version,@md.ruby_version
    meta << meta_para(tag,inf)
  end
  meta
end
number_break_points(inf) click to toggle source
# File lib/sisu/shared_metadata.rb, line 1011
def number_break_points(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_number_break_points
end
spec_char(inf) click to toggle source
# File lib/sisu/shared_metadata.rb, line 1005
def spec_char(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_characters
end
word_break_points(inf) click to toggle source
# File lib/sisu/shared_metadata.rb, line 1008
def word_break_points(inf)
  SiSU_TeX_Pdf::SpecialCharacters.new(@md,inf).special_word_break_points
end