Skip to content

Commit

Permalink
Merge pull request #6 from kudrykv/rm2_vanilla
Browse files Browse the repository at this point in the history
Rm2 vanilla
  • Loading branch information
kudrykv committed Sep 17, 2021
2 parents 9b58010 + f715541 commit 4fd1ae6
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 14 deletions.
22 changes: 18 additions & 4 deletions app/components/header/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,24 @@ func NewIntItem(val int) IntItem {
}

type MonthItem struct {
Val time.Month
ref bool
Val time.Month
ref bool
shorten bool
}

func (m MonthItem) Display() string {
ref := m.Val.String()
text := ref

if m.shorten {
text = text[:3]
}

if m.ref {
return hyper.Target(m.Val.String(), m.Val.String())
return hyper.Target(ref, text)
}

return hyper.Link(m.Val.String(), m.Val.String())
return hyper.Link(ref, text)
}

func (m MonthItem) Ref() MonthItem {
Expand All @@ -174,6 +182,12 @@ func (m MonthItem) Ref() MonthItem {
return m
}

func (m MonthItem) Shorten(f bool) MonthItem {
m.shorten = f

return m
}

func NewMonthItem(m time.Month) MonthItem {
return MonthItem{Val: m}
}
Expand Down
8 changes: 6 additions & 2 deletions app/compose/header_daily_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ func HeaderDailyNotes(cfg config.Config, tpls []string) (page.Modules, error) {

modules := make(page.Modules, 0, 366)
day := calendar.DayTime{Time: time.Date(cfg.Year, time.January, 1, 0, 0, 0, 0, time.Local)}
dayLayout := "Monday, 2"
if cfg.ClearTopRightCorner {
dayLayout = "Mon, 2"
}

for day.Year() == cfg.Year {
right := header.Items{}
_, weekNum := day.ISOWeek()
left := header.Items{
header.NewIntItem(cfg.Year),
header.NewTextItem("Q" + strconv.Itoa(int(math.Ceil(float64(day.Month())/3.)))),
header.NewMonthItem(day.Month()),
header.NewMonthItem(day.Month()).Shorten(cfg.ClearTopRightCorner),
header.NewTextItem("Week " + strconv.Itoa(weekNum)),
header.NewTimeItem(day).SetLayout("Monday, 2"),
header.NewTimeItem(day).SetLayout(dayLayout),
header.NewTimeItem(day).SetLayout("Notes").Ref().RefPrefix("notes"),
}

Expand Down
8 changes: 6 additions & 2 deletions app/compose/header_daily_reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ func HeaderDailyReflect(cfg config.Config, tpls []string) (page.Modules, error)

modules := make(page.Modules, 0, 366)
day := calendar.DayTime{Time: time.Date(cfg.Year, time.January, 1, 0, 0, 0, 0, time.Local)}
dayLayout := "Monday, 2"
if cfg.ClearTopRightCorner {
dayLayout = "Mon, 2"
}

for day.Year() == cfg.Year {
right := header.Items{}
_, weekNum := day.ISOWeek()
left := header.Items{
header.NewIntItem(cfg.Year),
header.NewTextItem("Q" + strconv.Itoa(int(math.Ceil(float64(day.Month())/3.)))),
header.NewMonthItem(day.Month()),
header.NewMonthItem(day.Month()).Shorten(cfg.ClearTopRightCorner),
header.NewTextItem("Week " + strconv.Itoa(weekNum)),
header.NewTimeItem(day).SetLayout("Monday, 2"),
header.NewTimeItem(day).SetLayout(dayLayout),
header.NewTimeItem(day).SetLayout("Reflect").Ref().RefPrefix("reflect"),
}

Expand Down
5 changes: 3 additions & 2 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
type Config struct {
Debug Debug

Year int `env:"PLANNER_YEAR"`
WeekStart time.Weekday
Year int `env:"PLANNER_YEAR"`
WeekStart time.Weekday
ClearTopRightCorner bool

Pages Pages

Expand Down
16 changes: 16 additions & 0 deletions cfg/rm2.base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cleartoprightcorner: true

layout:
paper:
width: 15.6cm
height: 20.9cm

reversemargins: true
marginparwidth: 1cm
marginparsep: 4.5mm

margin:
top: .3cm
bottom: 0.7cm
left: 1.4cm
right: 0.3cm
12 changes: 12 additions & 0 deletions cfg/rm2.planner.daily-with-cal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
layout:
numbers:
dailytodos: 5
dailynotes: 18
dailypersonal: 10
dailybottomhour: 8
dailytophour: 21

lengths:
headersidecellheight: "[1.35ex]"
headersidequarterswidth: 4cm
headersidemonthswidth: 15.25cm
27 changes: 27 additions & 0 deletions cfg/rm2.planner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
weekstart: 1

layout:
numbers:
arraystretch: 1.5
quarterlylines: 12
weeklylines: 11
dailytodos: 15
dailynotes: 20
dailybottomhour: 6
dailytophour: 23
dailydiarygoals: 10
dailydiarygrateful: 11
dailydiarybest: 12
dailydiarylog: 37
todolinesintodopage: 11

lengths:
tabcolsep: 3.5pt
linethicknessdefault: .4pt
linethicknessthick: .8pt
lineheightbutline: \dimexpr5mm-.4pt
twocolsep: 5pt
tricolsep: 5pt
monthlycellheight: 55pt
notesindexcellheight: 1.45cm

3 changes: 2 additions & 1 deletion single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ for _ in 1 2; do
"out/${nakedname}.tex"
done

cp "out/${nakedname}.pdf" "${PLANNER_YEAR}.${nakedname}.pdf"
cp "out/${nakedname}.pdf" "${PLANNER_YEAR}.${nakedname}.pdf"
echo "created ${PLANNER_YEAR}.${nakedname}.pdf"
4 changes: 2 additions & 2 deletions tpls/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{{- end -}}
\hfill%
{{if gt (len .Body.Right) 0 -}}
\begin{tabular}{ {{- .Body.Right.ColSetup false -}} }
{{.Body.Right.Row}}
\begin{tabular}{ {{- .Body.Right.ColSetup false -}}{{if .Cfg.ClearTopRightCorner}}@{\hspace{\tabcolsep}}|c@{}{{end}} }
{{.Body.Right.Row}}{{if .Cfg.ClearTopRightCorner}}& \hspace{7mm}{{end}}
\end{tabular}
{{- end -}}
}
Expand Down
3 changes: 2 additions & 1 deletion tpls/header_margin_quarters_months.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
{{- end -}}
\hfill%
{\renewcommand{\arraystretch}{\myNumArrayStretch}%
\begin{tabular}{*{ {{- len .Body.Cells -}} }{c|}@{}}
\begin{tabular}{*{ {{- len .Body.Cells -}} }{c|}@{}{{if .Cfg.ClearTopRightCorner}}c@{}{{end}}}
{{range $i, $cell := .Body.Cells}}
{{$cell.Display}} {{ if not (eq (incr $i) (len $.Body.Cells)) }} &{{end}}
{{end}}
{{- if .Cfg.ClearTopRightCorner}}& \hspace{7mm}{{end}}
\end{tabular}}%
\medskip%
\myLineThick%
Expand Down

0 comments on commit 4fd1ae6

Please sign in to comment.