Class: Plansheet::DailyLaTeXSheet
- Inherits:
-
Object
- Object
- Plansheet::DailyLaTeXSheet
show all
- Includes:
- LaTeXMixins
- Defined in:
- lib/plansheet/sheet/daily.rb
Constant Summary
collapse
- INCOLUMN_SPACING =
"7mm".freeze
Constants included
from LaTeXMixins
LaTeXMixins::HARD_NL, LaTeXMixins::SQUARE
Instance Method Summary
collapse
#checkbox_item, #config_file_sanity_check, #itemize_tightlist, #itemline, #minipage, #sanitize_string, #sheet_header, #vbox, #vspace, #writein_line
Constructor Details
#initialize(output_file, config) ⇒ DailyLaTeXSheet
Returns a new instance of DailyLaTeXSheet.
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/plansheet/sheet/daily.rb', line 7
def initialize(output_file, config)
@config = config
projects_str =
projects_str << document do
sheet_body
end
puts "Writing to #{output_file}"
File.write(output_file, projects_str)
end
|
Instance Method Details
#checkbox_and_lines(items) ⇒ Object
71
72
73
74
75
|
# File 'lib/plansheet/sheet/daily.rb', line 71
def checkbox_and_lines(items)
items.map do |i|
checkbox_item(i, line: "4cm")
end.join(HARD_NL)
end
|
#checkboxes(items) ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/plansheet/sheet/daily.rb', line 63
def checkboxes(items)
items.map do |l|
l.map do |i|
checkbox_item i
end.join(" ")
end.join(HARD_NL)
end
|
#dateline ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/plansheet/sheet/daily.rb', line 18
def dateline
<<~DATELINE
\\thispagestyle{empty}
Date \\(\\underline{\\hspace{4cm}}\\)
DATELINE
end
|
#multiline_checkbox_and_lines(items) ⇒ Object
77
78
79
80
81
|
# File 'lib/plansheet/sheet/daily.rb', line 77
def multiline_checkbox_and_lines(items)
items.map do |q|
"#{checkbox_item q} #{HARD_NL}#{writein_line("\\textwidth")}"
end.join(HARD_NL)
end
|
#section_output(section) ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/plansheet/sheet/daily.rb', line 52
def section_output(section)
case section["type"]
when "checkboxes"
checkboxes(section["items"])
when "checkbox_and_lines"
checkbox_and_lines(section["items"])
when "multiline_checkbox_and_lines"
multiline_checkbox_and_lines(section["items"])
end
end
|
#sheet_body ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/plansheet/sheet/daily.rb', line 28
def sheet_body
[
dateline,
vspace("1cm"),
vbox do
@config["top"].map do |section|
minipage("8cm") do
section_output(section)
end
end.join
end,
%w[left_bar right_bar].map do |col|
minipage("8cm") do
@config[col].map do |section|
minipage("\\textwidth") do
section_output(section)
end
end.join(vspace(INCOLUMN_SPACING))
end
end
].flatten.join
end
|