Class: Plansheet::LaTeXSheet
- Inherits:
-
Object
- Object
- Plansheet::LaTeXSheet
- Includes:
- LaTeXMixins
- Defined in:
- lib/plansheet/sheet/latex.rb
Overview
The Sheet class constructs a Markdown/LaTeX file for use with pdflatex
Constant Summary
Constants included from LaTeXMixins
Plansheet::LaTeXMixins::HARD_NL, Plansheet::LaTeXMixins::SQUARE
Instance Method Summary collapse
-
#initialize(output_file, project_arr) ⇒ LaTeXSheet
constructor
A new instance of LaTeXSheet.
- #project_header(proj) ⇒ Object
- #project_minipage(proj) ⇒ Object
Methods included from LaTeXMixins
#checkbox_item, #config_file_sanity_check, #itemize_tightlist, #itemline, #minipage, #sanitize_string, #sheet_header, #vbox, #vspace, #writein_line
Constructor Details
#initialize(output_file, project_arr) ⇒ LaTeXSheet
Returns a new instance of LaTeXSheet.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/plansheet/sheet/latex.rb', line 8 def initialize(output_file, project_arr) projects_str = sheet_header projects_str << document do "\\thispagestyle{empty}\n\n\\section{Date: #{Date.today}}\n".concat( project_arr.map do |p| project_minipage(p) end.join ) end puts "Writing to #{output_file}" File.write(output_file, projects_str) end |
Instance Method Details
#project_header(proj) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/plansheet/sheet/latex.rb', line 31 def project_header(proj) str = "#{sanitize_string(proj.namespace)}: #{sanitize_string(proj.name)}#{HARD_NL}" str << proj.status.to_s str << " - #{sanitize_string(proj.location)}" if proj.location str << " due: #{proj.due}" if proj.due str << " time: #{proj.time_estimate}" if proj.time_estimate str << HARD_NL str end |
#project_minipage(proj) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/plansheet/sheet/latex.rb', line 21 def project_minipage(proj) minipage("6cm") do project_header(proj)&.concat( proj&.tasks&.map do |t| "#{checkbox_item sanitize_string(t)}#{HARD_NL}" end&.join("") || "" # empty string to catch nil ) end end |