From 881df1051605abc2e1babd83ba0e312eb86fe9f6 Mon Sep 17 00:00:00 2001 From: Ibrahim El Shar Date: Tue, 24 Dec 2024 01:48:18 -0800 Subject: [PATCH] Added grid option and changed font --- app/config/config.go | 9 ++++++++- cfg/base.yaml | 8 +++++++- tpls/_common_03_monthly.tpl | 2 +- tpls/_common_04_weekly.tpl | 4 ++++ tpls/_common_04_weekly_blank.tpl | 29 ++++++++++++++++++++++++++++ tpls/_common_04_weekly_grid.tpl | 29 ++++++++++++++++++++++++++++ tpls/_common_07_daily_notes.tpl | 16 +++++++++++----- tpls/_common_09_notes.tpl | 16 +++++++++++----- tpls/document.tpl | 5 ++++- tpls/macro.tpl | 33 +++++++++++++++++++++++++++++--- 10 files changed, 134 insertions(+), 17 deletions(-) create mode 100644 tpls/_common_04_weekly_blank.tpl create mode 100644 tpls/_common_04_weekly_grid.tpl diff --git a/app/config/config.go b/app/config/config.go index 00f8a594..d5769695 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -16,13 +16,15 @@ type Config struct { Year int `env:"PLANNER_YEAR"` WeekStart time.Weekday Dotted bool + Blank bool + Grid bool CalAfterSchedule bool ClearTopRightCorner bool AMPMTime bool AddLastHalfHour bool Pages Pages - + Font Font Layout Layout } @@ -59,6 +61,7 @@ type RenderBlock struct { type Colors struct { Gray string LightGray string + VeryLightGray string } type Layout struct { @@ -109,6 +112,10 @@ type Margin struct { Right string `env:"PLANNER_LAYOUT_PAPER_MARGIN_RIGHT"` } +type Font struct { + Family string +} + func New(pathConfigs ...string) (Config, error) { var ( bts []byte diff --git a/cfg/base.yaml b/cfg/base.yaml index 49784390..ebbab695 100644 --- a/cfg/base.yaml +++ b/cfg/base.yaml @@ -1,9 +1,14 @@ weekstart: 1 ampmtime: false -dotted: true +dotted: false +blank: false +grid: true calafterschedule: false addlasthalfhour: true +font: + family: "Helvetica" + layout: paper: width: 15.6cm @@ -57,3 +62,4 @@ layout: colors: gray: gray lightgray: gray!50 + verylightgray: gray!20 diff --git a/tpls/_common_03_monthly.tpl b/tpls/_common_03_monthly.tpl index c61c8659..f198c758 100644 --- a/tpls/_common_03_monthly.tpl +++ b/tpls/_common_03_monthly.tpl @@ -1,7 +1,7 @@ {{- template "monthTabularV2.tpl" dict "Month" .Body.Month "Large" true -}} \medskip -{{ if $.Cfg.Dotted -}} +{{ if or $.Cfg.Dotted $.Cfg.Blank $.Cfg.Grid -}} \myUnderline{Notes} \vbox to 0pt{\myMash[\myMonthlySpring]{20}{\myNumDotWidthFull}} {{- else -}} diff --git a/tpls/_common_04_weekly.tpl b/tpls/_common_04_weekly.tpl index c561bba1..d243c124 100644 --- a/tpls/_common_04_weekly.tpl +++ b/tpls/_common_04_weekly.tpl @@ -1,5 +1,9 @@ {{ if $.Cfg.Dotted -}} {{ template "_common_04_weekly_dotted.tpl" dict "Cfg" .Cfg "Body" .Body }} +{{- else if $.Cfg.Blank -}} + {{ template "_common_04_weekly_blank.tpl" dict "Cfg" .Cfg "Body" .Body }} +{{- else if $.Cfg.Grid -}} + {{ template "_common_04_weekly_grid.tpl" dict "Cfg" .Cfg "Body" .Body }} {{- else -}} {{ template "_common_04_weekly_lined.tpl" dict "Cfg" .Cfg "Body" .Body }} {{- end }} diff --git a/tpls/_common_04_weekly_blank.tpl b/tpls/_common_04_weekly_blank.tpl new file mode 100644 index 00000000..6cab2906 --- /dev/null +++ b/tpls/_common_04_weekly_blank.tpl @@ -0,0 +1,29 @@ +{{- $days := .Body.Week.Days -}} +{{- $day1 := index $days 0 -}} +{{- $day2 := index $days 1 -}} +{{- $day3 := index $days 2 -}} +{{- $day4 := index $days 3 -}} +{{- $day5 := index $days 4 -}} +{{- $day6 := index $days 5 -}} +{{- $day7 := index $days 6 -}} + +\parbox{\myLenTriCol}{\myUnderline{ {{- $day1.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day2.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day3.WeekLink -}} }} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} +\vfill + +\parbox{\myLenTriCol}{\myUnderline{ {{- $day4.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day5.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day6.WeekLink -}} }} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} +\vfill + +\parbox{\myLenTriCol}{ \myUnderline{ {{- $day7.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\dimexpr2\myLenTriCol+\myLenTriColSep}{\myUnderline{Notes\myDummyQ}} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} \ No newline at end of file diff --git a/tpls/_common_04_weekly_grid.tpl b/tpls/_common_04_weekly_grid.tpl new file mode 100644 index 00000000..5bb2762d --- /dev/null +++ b/tpls/_common_04_weekly_grid.tpl @@ -0,0 +1,29 @@ +{{- $days := .Body.Week.Days -}} +{{- $day1 := index $days 0 -}} +{{- $day2 := index $days 1 -}} +{{- $day3 := index $days 2 -}} +{{- $day4 := index $days 3 -}} +{{- $day5 := index $days 4 -}} +{{- $day6 := index $days 5 -}} +{{- $day7 := index $days 6 -}} + +\parbox{\myLenTriCol}{\myUnderline{ {{- $day1.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day2.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day3.WeekLink -}} }} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} +\vfill + +\parbox{\myLenTriCol}{\myUnderline{ {{- $day4.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day5.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\myLenTriCol}{\myUnderline{ {{- $day6.WeekLink -}} }} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} +\vfill + +\parbox{\myLenTriCol}{ \myUnderline{ {{- $day7.WeekLink -}} }}% +\hspace{\myLenTriColSep}% +\parbox{\dimexpr2\myLenTriCol+\myLenTriColSep}{\myUnderline{Notes\myDummyQ}} +\myMash{\myNumWeeklyLines}{\myNumDotWidthFull} diff --git a/tpls/_common_07_daily_notes.tpl b/tpls/_common_07_daily_notes.tpl index 4deebb67..32c4521f 100644 --- a/tpls/_common_07_daily_notes.tpl +++ b/tpls/_common_07_daily_notes.tpl @@ -1,5 +1,11 @@ -{{ if $.Cfg.Dotted -}} \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} {{- else -}} -\vbox to \dimexpr\textheight-\pagetotal-\myLenLineHeightButLine\relax {% - \leaders\hbox to \linewidth{\textcolor{\myColorGray}{\rule{0pt}{\myLenLineHeightButLine}\hrulefill}}\vfil -} -{{end}} \ No newline at end of file +{{- if $.Cfg.Dotted -}} + \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} +{{- else if $.Cfg.Blank -}} + \vskip\textheight minus \pagetotal +{{- else if $.Cfg.Grid -}} + \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} +{{- else -}} + \vbox to \dimexpr\textheight-\pagetotal-\myLenLineHeightButLine\relax {% + \leaders\hbox to \linewidth{\textcolor{\myColorGray}{\rule{0pt}{\myLenLineHeightButLine}\hrulefill}}\vfil + } +{{- end}} \ No newline at end of file diff --git a/tpls/_common_09_notes.tpl b/tpls/_common_09_notes.tpl index 4deebb67..32c4521f 100644 --- a/tpls/_common_09_notes.tpl +++ b/tpls/_common_09_notes.tpl @@ -1,5 +1,11 @@ -{{ if $.Cfg.Dotted -}} \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} {{- else -}} -\vbox to \dimexpr\textheight-\pagetotal-\myLenLineHeightButLine\relax {% - \leaders\hbox to \linewidth{\textcolor{\myColorGray}{\rule{0pt}{\myLenLineHeightButLine}\hrulefill}}\vfil -} -{{end}} \ No newline at end of file +{{- if $.Cfg.Dotted -}} + \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} +{{- else if $.Cfg.Blank -}} + \vskip\textheight minus \pagetotal +{{- else if $.Cfg.Grid -}} + \vskip-.5\myLenLineHeightButLine\myMash{\myNumDotHeightFull}{\myNumDotWidthFull} +{{- else -}} + \vbox to \dimexpr\textheight-\pagetotal-\myLenLineHeightButLine\relax {% + \leaders\hbox to \linewidth{\textcolor{\myColorGray}{\rule{0pt}{\myLenLineHeightButLine}\hrulefill}}\vfil + } +{{- end}} \ No newline at end of file diff --git a/tpls/document.tpl b/tpls/document.tpl index bb1e7f0e..6e235939 100644 --- a/tpls/document.tpl +++ b/tpls/document.tpl @@ -1,4 +1,4 @@ -\documentclass[9pt]{extarticle} +\documentclass[8pt]{extarticle} \usepackage{geometry} \usepackage[table]{xcolor} @@ -24,6 +24,9 @@ \usepackage{adjustbox} \usepackage{multido} +\usepackage{fontspec} +\setmainfont{ {{- .Cfg.Font.Family -}} } + \hypersetup{ {{- if not .Cfg.Debug.ShowLinks}}hidelinks=true{{end -}} } diff --git a/tpls/macro.tpl b/tpls/macro.tpl index 9a4ee0d4..d57a38ea 100644 --- a/tpls/macro.tpl +++ b/tpls/macro.tpl @@ -61,6 +61,7 @@ \newcommand{\myDailySpring}{ {{- $lengths.DailySpring -}} } \newcommand{\myColorGray}{ {{- .Cfg.Layout.Colors.Gray -}} } \newcommand{\myColorLightGray}{ {{- .Cfg.Layout.Colors.LightGray -}} } +\newcommand{\myColorVeryLightGray}{ {{- .Cfg.Layout.Colors.VeryLightGray -}} } \newcommand{\myLinePlain}{\hrule width \linewidth height \myLenLineThicknessDefault} \newcommand{\myLineThick}{\hrule width \linewidth height \myLenLineThicknessThick} @@ -69,6 +70,7 @@ \newcommand{\myUnderline}[1]{#1\vskip1mm\myLineThick\par} \newcommand{\myLineColor}[1]{\textcolor{#1}{\myLinePlain}} \newcommand{\myLineGray}{\myLineColor{\myColorGray}} +\newcommand{\myLineVeryLightGray}{\myLineColor{\myColorVeryLightGray}} \newcommand{\myLineLightGray}{\myLineColor{\myColorLightGray}} \newcommand{\myLineGrayVskipBottom}{\myLineGray\vskip\myLenLineHeightButLine} \newcommand{\myLineGrayVskipTop}{\vskip\myLenLineHeightButLine\myLineGray} @@ -76,12 +78,37 @@ \newcommand{\myTodo}{\myLineHeightButLine$\square$\myLinePlain} \newcommand{\myTodoLineGray}{\myLineHeightButLine$\square$\myLineGray} -\newcommand{\myDotGrid}[2]{\leavevmode\multido{\dC=0mm+5mm}{#1}{\multido{\dR=0mm+5mm}{#2}{\put(\dR,\dC){\circle*{0.1}}}}} +\newcommand{\myDotGrid}[2]{% + \leavevmode + \multido{\dC=0mm+5mm}{#1}{% + \multido{\dR=0mm+5mm}{#2}{% + \put(\dR,\dC){\circle*{0.1}}% + }% + }% +} +\newcommand{\myGridPattern}[2]{% + \leavevmode + \setlength{\fboxrule}{0.0005pt}% % Set line thickness for the squares + \multido{\dC=0mm+5mm}{#1}{% % Vertical spacing (increased to 7mm) + \multido{\dR=0mm+5mm}{#2}{% % Horizontal spacing (increased to 7mm) + \put(\dR,\dC){\textcolor{\myColorVeryLightGray}{% + \makebox(0,0){\framebox(5mm,5mm){}}% % Hollow square, centered at intersection + }}% + }% + }% +} \newcommand{\myMash}[3][]{ - {{- if $.Cfg.Dotted -}} \vskip\myLenLineHeightButLine#1\myDotGrid{#2}{#3} {{- else -}} \Repeat{#2}{\myLineGrayVskipTop} {{- end -}} + {{- if $.Cfg.Dotted -}} + \vskip\myLenLineHeightButLine#1\myDotGrid{#2}{#3} + {{- else if $.Cfg.Blank -}} + \vskip#2\myLenLineHeightButLine + {{- else if $.Cfg.Grid -}} + \vskip\myLenLineHeightButLine#1\myGridPattern{#2}{#3} + {{- else -}} + \Repeat{#2}{\myLineGrayVskipTop} + {{- end -}} } - \newcommand{\remainingHeight}{% \ifdim\pagegoal=\maxdimen \dimexpr\textheight-9.4pt\relax