Class: RbLatex::MetaInfo
- Inherits:
-
Object
- Object
- RbLatex::MetaInfo
- Includes:
- Utils
- Defined in:
- lib/rb_latex/meta_info.rb
Constant Summary collapse
- ATTRS =
%i(title creator page_progression_direction language publisher)
Constants included from Utils
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
Methods included from Utils
Constructor Details
#initialize ⇒ MetaInfo
Returns a new instance of MetaInfo.
13 14 15 16 |
# File 'lib/rb_latex/meta_info.rb', line 13 def initialize @creator = Hash.new @pubdate = nil end |
Instance Attribute Details
#lastmodified ⇒ Object
Returns the value of attribute lastmodified.
11 12 13 |
# File 'lib/rb_latex/meta_info.rb', line 11 def lastmodified @lastmodified end |
#pubdate ⇒ Object
Returns the value of attribute pubdate.
11 12 13 |
# File 'lib/rb_latex/meta_info.rb', line 11 def pubdate @pubdate end |
Instance Method Details
#add_creator(name, role) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/rb_latex/meta_info.rb', line 65 def add_creator(name, role) if !@creator[role] !@creator[role] = Array.new end @creator[role] << name end |
#all ⇒ Object
42 43 44 |
# File 'lib/rb_latex/meta_info.rb', line 42 def all ## @info end |
#author(sep = ", ") ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/rb_latex/meta_info.rb', line 72 def (sep = ", ") aut = @creator["aut"] if aut aut.join(sep) else "" end end |
#date_format(time) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/rb_latex/meta_info.rb', line 57 def date_format(time) if time time.strftime("%Y年%-m月%-d日") else "" end end |
#lastmodified_to_s ⇒ Object
38 39 40 |
# File 'lib/rb_latex/meta_info.rb', line 38 def lastmodified_to_s date_format(@lastmodified) end |
#pubdate_to_s ⇒ Object
26 27 28 |
# File 'lib/rb_latex/meta_info.rb', line 26 def pubdate_to_s date_format(@pubdate) end |
#to_latex ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rb_latex/meta_info.rb', line 46 def to_latex "\\title{#{escape_latex(title)}}\n"+ "\\author{#{escape_latex()}}\n"+ "\\date{}\n"+ "\\newcommand{\\rblatexTitle}{#{escape_latex(title)}}\n"+ "\\newcommand{\\rblatexAuthor}{#{escape_latex()}}\n"+ "\\newcommand{\\rblatexPubdate}{#{escape_latex(pubdate_to_s)}}\n"+ "\\newcommand{\\rblatexPublisher}{#{escape_latex(publisher)}}\n"+ "\\newcommand{\\rblatexPageDirection}{#{escape_latex(page_progression_direction)}}\n" end |