Class: RbLatex::MetaInfo
- Inherits:
-
Object
- Object
- RbLatex::MetaInfo
- Defined in:
- lib/rb_latex/meta_info.rb
Constant Summary collapse
- ATTRS =
i(title creator page_progression_direction language publisher)
Instance Attribute Summary collapse
-
#lastmodified ⇒ Object
Returns the value of attribute lastmodified.
-
#pubdate ⇒ Object
Returns the value of attribute pubdate.
Instance Method Summary collapse
- #add_creator(name, role) ⇒ Object
- #all ⇒ Object
- #author(sep = ", ") ⇒ Object
- #date_format(time) ⇒ Object
-
#initialize ⇒ MetaInfo
constructor
A new instance of MetaInfo.
- #lastmodified_to_s ⇒ Object
- #pubdate_to_s ⇒ Object
- #to_latex ⇒ Object
Constructor Details
#initialize ⇒ MetaInfo
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
#lastmodified ⇒ Object
Returns the value of attribute lastmodified.
10 11 12 |
# File 'lib/rb_latex/meta_info.rb', line 10 def lastmodified @lastmodified end |
#pubdate ⇒ Object
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 |
#all ⇒ Object
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 (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_s ⇒ Object
37 38 39 |
# File 'lib/rb_latex/meta_info.rb', line 37 def lastmodified_to_s date_format(@lastmodified) end |
#pubdate_to_s ⇒ Object
25 26 27 |
# File 'lib/rb_latex/meta_info.rb', line 25 def pubdate_to_s date_format(@pubdate) end |
#to_latex ⇒ Object
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 |