From 7b000f0f3614d29e166986bd08c1cebbaaa667ca Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Fri, 9 Aug 2019 10:49:12 -0400 Subject: [PATCH] Initial commit with daily planner template --- .gitignore | 429 ++++++++++++++++++++++ generate.go | 50 +++ templates/daily-planner/body.tpl | 57 +++ templates/daily-planner/daily-planner.tpl | 91 +++++ templates/daily-planner/foot.tpl | 2 + templates/daily-planner/head.tpl | 29 ++ 6 files changed, 658 insertions(+) create mode 100644 .gitignore create mode 100644 generate.go create mode 100644 templates/daily-planner/body.tpl create mode 100644 templates/daily-planner/daily-planner.tpl create mode 100644 templates/daily-planner/foot.tpl create mode 100644 templates/daily-planner/head.tpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b89093 --- /dev/null +++ b/.gitignore @@ -0,0 +1,429 @@ + +# Created by https://www.gitignore.io/api/go,vim,osx,intellij+all,latex +# Edit at https://www.gitignore.io/?templates=go,vim,osx,intellij+all,latex + +### Go ### +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +### Go Patch ### +/vendor/ +/Godeps/ + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### LaTeX ### +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Comment the next line if you want to keep your tikz graphics files +*.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices +*.xyc + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# KBibTeX +*~[0-9]* + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +### LaTeX Patch ### +# glossaries +*.glstex + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# End of https://www.gitignore.io/api/go,vim,osx,intellij+all,latex diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..87d0c14 --- /dev/null +++ b/generate.go @@ -0,0 +1,50 @@ +package main + +import ( + "flag" + "log" + "os" + "path" + "text/template" + "time" +) + +var ( + fileName = flag.String("file", "output.tex", "Name of output file") + tplPath = flag.String("tpl", "templates/daily-planner", "Path to templates") + startDate = flag.String("start", "", "date of start (yyy-mm-dd)") + days = flag.Int("days", 7, "number of days") + + output = os.Stdout +) + +func main() { + flag.Parse() + head := template.Must(template.ParseFiles(path.Join(*tplPath, "head.tpl"))) + body := template.Must(template.ParseFiles(path.Join(*tplPath, "body.tpl"))) + foot := template.Must(template.ParseFiles(path.Join(*tplPath, "foot.tpl"))) + + if *startDate == "" { + *startDate = time.Now().Format("2006-01-02") + } + day, err := time.Parse("2006-01-02", *startDate) + check(err) + + check(head.Execute(output, nil)) + for i := 0; i < *days; i++ { + info := map[string]interface{}{ + "Date": day.Format("2 Jan"), + "DayOfWeek": day.Format("Monday"), + } + check(body.Execute(output, info)) + day = day.Add(24 * time.Hour) + } + check(foot.Execute(output, nil)) + +} + +func check(err error) { + if err != nil { + log.Fatal(err) + } +} diff --git a/templates/daily-planner/body.tpl b/templates/daily-planner/body.tpl new file mode 100644 index 0000000..eb54e5f --- /dev/null +++ b/templates/daily-planner/body.tpl @@ -0,0 +1,57 @@ +\begin{tabular}{ |r|r|p{59mm}|p{82mm}| } + \hline + \multicolumn{4}{|c|}{ + \cellcolor{anti-flashwhite} + \noindent + \textbox{ {{.Date}} \hfill} + \textbox{\hfil Daily Planner \hfil} + \textbox{\hfill {{.DayOfWeek}}} + }\\ + \hline + \hline + \multicolumn{1}{|c|}{Time} & + \multicolumn{1}{ c|}{i.} & + \multicolumn{1}{ c|}{Schedule} & + \multicolumn{1}{ c|}{Bullets} + \\\hline + + 6:00 &&&\\\grayline + 6:30 &&&\\\grayline + 7:00 &&&\\\grayline + 7:30 &&&\\\grayline + 8:00 &&&\\\grayline + 8:30 &&&\\\grayline + 9:00 &&&\\\grayline + 9:30 &&&\\\grayline + 10:00 &&&\\\grayline + 10:30 &&&\\\grayline + 11:00 &&&\\\grayline + 11:30 &&&\\\grayline + 12:00 &&&\\\grayline + 12:30 &&&\\\grayline + 13:00 &&&\\\grayline + 13:30 &&&\\\grayline + 14:00 &&&\\\grayline + 14:30 &&&\\\grayline + 15:00 &&&\\\grayline + 15:30 &&&\\\grayline + 16:00 &&&\\\grayline + 16:30 &&&\\\grayline + 17:00 &&&\\\grayline + 17:30 &&&\\\grayline + 18:00 &&&\\\grayline + 18:30 &&&\\\grayline + 19:00 &&&\\\grayline + 19:30 &&&\\\grayline + 20:00 &&&\\\grayline + 20:30 &&&\\\grayline + 21:00 &&&\\\grayline + 21:30 &&&\\\grayline + 22:00 &&&\\\grayline + 22:30 &&&\\\grayline + 23:00 &&&\\\grayline + 23:30 &&&\\ + + \hline + + \end{tabular} diff --git a/templates/daily-planner/daily-planner.tpl b/templates/daily-planner/daily-planner.tpl new file mode 100644 index 0000000..f66862c --- /dev/null +++ b/templates/daily-planner/daily-planner.tpl @@ -0,0 +1,91 @@ +\documentclass[a5paper]{article} +%\input \jobname + +\def \dayOfWeek{Wednesday} +\def \date{2019/08/07} + +\usepackage[utf8]{inputenc} +\usepackage[a5paper, margin=1cm]{geometry} +\usepackage{array} +\usepackage{colortbl} +\usepackage[x11names]{xcolor} + +\pagenumbering{gobble} + +\renewcommand{\arraystretch}{1.17} + +\definecolor{anti-flashwhite}{rgb}{0.95, 0.95, 0.96} + +\newcommand*{\grayline}{% + \arrayrulecolor{anti-flashwhite} + \cline{1-3} + \arrayrulecolor{black} +} + +% TODO: Make this reactive +\newcommand\textbox[1]{% + \parbox{3.5cm}{#1}% +} + +\begin{document} + \centering + +\begin{tabular}{ |r|r|p{35mm}|p{48mm}| } + \hline + \multicolumn{4}{|c|}{ + \cellcolor{anti-flashwhite} + \noindent + \textbox{\date \hfill} + \textbox{\hfil Daily Planner \hfil} + \textbox{\hfill \dayOfWeek} + }\\ + \hline + \hline + \multicolumn{1}{|c|}{Time} & + \multicolumn{1}{ c|}{i.} & + \multicolumn{1}{ c|}{Schedule} & + \multicolumn{1}{ c|}{Bullets} + \\\hline + + 6:00 &&&\\\grayline + 6:30 &&&\\\grayline + 7:00 &&&\\\grayline + 7:30 &&&\\\grayline + 8:00 &&&\\\grayline + 8:30 &&&\\\grayline + 9:00 &&&\\\grayline + 9:30 &&&\\\grayline + 10:00 &&&\\\grayline + 10:30 &&&\\\grayline + 11:00 &&&\\\grayline + 11:30 &&&\\\grayline + 12:00 &&&\\\grayline + 12:30 &&&\\\grayline + 13:00 &&&\\\grayline + 13:30 &&&\\\grayline + 14:00 &&&\\\grayline + 14:30 &&&\\\grayline + 15:00 &&&\\\grayline + 15:30 &&&\\\grayline + 16:00 &&&\\\grayline + 16:30 &&&\\\grayline + 17:00 &&&\\\grayline + 17:30 &&&\\\grayline + 18:00 &&&\\\grayline + 18:30 &&&\\\grayline + 19:00 &&&\\\grayline + 19:30 &&&\\\grayline + 20:00 &&&\\\grayline + 20:30 &&&\\\grayline + 21:00 &&&\\\grayline + 21:30 &&&\\\grayline + 22:00 &&&\\\grayline + 22:30 &&&\\\grayline + 23:00 &&&\\\grayline + 23:30 &&&\\ + + \hline + + \end{tabular} + +\end{document} diff --git a/templates/daily-planner/foot.tpl b/templates/daily-planner/foot.tpl new file mode 100644 index 0000000..a9ee343 --- /dev/null +++ b/templates/daily-planner/foot.tpl @@ -0,0 +1,2 @@ + +\end{document} diff --git a/templates/daily-planner/head.tpl b/templates/daily-planner/head.tpl new file mode 100644 index 0000000..8d5ac1e --- /dev/null +++ b/templates/daily-planner/head.tpl @@ -0,0 +1,29 @@ +\documentclass[letter]{article} + +\usepackage[utf8]{inputenc} +\usepackage[letterpaper, margin=1cm]{geometry} +\usepackage{array} +\usepackage{colortbl} +\usepackage[x11names]{xcolor} + +\pagenumbering{gobble} + +%\renewcommand{\arraystretch}{1.17} +\renewcommand{\arraystretch}{1.6} + +\definecolor{anti-flashwhite}{rgb}{0.95, 0.95, 0.96} + +\newcommand*{\grayline}{% + \arrayrulecolor{anti-flashwhite} + \cline{1-3} + \arrayrulecolor{black} +} + +% TODO: Make this reactive +\newcommand\textbox[1]{% + \parbox{6cm}{#1}% +} + +\begin{document} + \centering +