Skip to content

Commit

Permalink
Add month links to little calendar (#144)
Browse files Browse the repository at this point in the history
Add links to the monthly page to the little calendar for quick access to
months from the annual page or little calendar on daily pages.
  • Loading branch information
kudrykv authored Jan 11, 2025
2 parents 50e302e + d90f041 commit 4d2a309
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/119x158-leftie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ planner:
underline_weekdays: true
sideline_week_numbers: true
highlight_week: true
link_to_month: true
link_to_week: true

large_calendar:
Expand Down
1 change: 1 addition & 0 deletions config/119x158-rightie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ planner:
underline_weekdays: true
sideline_week_numbers: true
highlight_week: true
link_to_month: true
link_to_week: true

large_calendar:
Expand Down
1 change: 1 addition & 0 deletions config/158x210-leftie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ planner:
underline_weekdays: true
sideline_week_numbers: true
highlight_week: true
link_to_month: true
link_to_week: true
take_full_width: true

Expand Down
8 changes: 6 additions & 2 deletions lib/latex_yearly_planner/xtypst/little_calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class LittleCalendar
sideline_week_numbers: true,
highlight_week: false,
link_to_week: true,
link_to_month: true,
take_full_width: true,

highlight_day: nil
Expand All @@ -35,7 +36,7 @@ def to_typst
inset: #{parameters[:inset]},
stroke: 0mm,
#{highlight_week}
table.cell(colspan: #{number_of_columns})[#{month_name}],
table.cell(colspan: #{number_of_columns},#{month_name}),
#{weekdays_row},
#{weeks}
)
Expand Down Expand Up @@ -68,7 +69,10 @@ def highlighted_week_number_in_this_month
end

def month_name
i18n.t("calendar.month.#{month.name.downcase}")
name = i18n.t("calendar.month.#{month.name.downcase}")
return name unless parameters[:link_to_month]

"link(<#{month.id}>, [#{name}])"
end

def weekdays_row
Expand Down

0 comments on commit 4d2a309

Please sign in to comment.