Class: RbLatex::MetaInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rb_latex/meta_info.rb

Constant Summary collapse

ATTRS =
i(title creator page_progression_direction language publisher)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetaInfo

Returns a new instance of MetaInfo.



12
13
14
15
# File 'lib/rb_latex/meta_info.rb', line 12

def initialize
  @creator = Hash.new
  @pubdate = nil
end

Instance Attribute Details

#lastmodifiedObject

Returns the value of attribute lastmodified.



10
11
12
# File 'lib/rb_latex/meta_info.rb', line 10

def lastmodified
  @lastmodified
end

#pubdateObject

Returns the value of attribute pubdate.



10
11
12
# File 'lib/rb_latex/meta_info.rb', line 10

def pubdate
  @pubdate
end

Instance Method Details

#add_creator(name, role) ⇒ Object



57
58
59
60
61
62
# File 'lib/rb_latex/meta_info.rb', line 57

def add_creator(name, role)
  if !@creator[role]
    !@creator[role] = Array.new
  end
  @creator[role] << name
end

#allObject



41
42
43
# File 'lib/rb_latex/meta_info.rb', line 41

def all
##      @info
end

#author(sep = ", ") ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/rb_latex/meta_info.rb', line 64

def author(sep = ", ")
  aut = @creator["aut"]
  if aut
    aut.join(sep)
  else
    ""
  end
end

#date_format(time) ⇒ Object



53
54
55
# File 'lib/rb_latex/meta_info.rb', line 53

def date_format(time)
  time.strftime("%Y年%-m月%-d日")
end

#lastmodified_to_sObject



37
38
39
# File 'lib/rb_latex/meta_info.rb', line 37

def lastmodified_to_s
  date_format(@lastmodified)
end

#pubdate_to_sObject



25
26
27
# File 'lib/rb_latex/meta_info.rb', line 25

def pubdate_to_s
  date_format(@pubdate)
end

#to_latexObject



45
46
47
48
49
50
51
# File 'lib/rb_latex/meta_info.rb', line 45

def to_latex
  "\\newcommand{\\rblatexTitle}{#{escape_latex(title)}}\n"+
  "\\newcommand{\\rblatexAuthor}{#{escape_latex(author)}}\n"+
  "\\newcommand{\\rblatexPubdate}{#{escape_latex(date_to_s)}}\n"+
  "\\newcommand{\\rblatexPublisher}{#{escape_latex(publisher)}}\n"+
  "\\newcommand{\\rblatexPageDirection}{#{escape_latex(page_progression_direction)}}\n"
end