h================== Calendar generator ==================
Generate a calendar or any other book from templates.
- cmake
- inkscape with extension inkscape_generator, a improved Python version of the original bash version.
- Python3
- Generate extra pages manually.
- Generate the csv data with
generate_csv.py
to feedinkscape_generator
. - Generate the pages from templates and glue all pages with cmake.
- Create
birthdays.csv
- Each line:
YYYY-MM-DD,name
, where "YYYY-MM-DD" is the birth date. Write0000
or0001
for unknown birth year. Birthdays on 29th February are not supported. - You can use the Unicode character U+F1FD, , with Font Awesome
- Each line:
- Create
holidays.csv
- Each line:
YYYY-MM-DD,event
, where "YYYY" is the current year. holidays.csv
can be generated bygenerate_holidays_fr.py
orgenerate_holidays_cz.py
.
- Each line:
- Create
moon.csv
- Each line:
YYYY-MM-DD,moon_phase
. moon.csv
until year 2031 is provided.- If supported by your font, you can use the following unicode characters:
- New Moon Symbol "🌑", U+1F311.
- First Quarter Moon Symbol "🌓", U+1F313 or Waxing Crescent Moon Symbol "🌒, U+1F312.
- Full Moon Symbol "🌕", U+1F315.
- Last Quarter Moon Symbol "🌗", U+1F317 or Waning Crescent Moon Symbol "🌘", U+1F318.
- You can also use the more common unicode characters:
- new moon "●" (Black Circle, U+25CF)
- first quarter moon "◑" (Circle With Left Half Black, U+25D0) or "☽" (First Quarter Moon, U+263D)
- full moon "○" (White Circle, U+25CB)
- last quarter moon "◐" (Circle With Right Half Black, U+25D1) or "☾" (Last Quarter Moon, U+263E)
- Fancier symbols can be found on https://www.unicode.org.
- Each line:
- Create
months-fr.csv
with the translations of the months of the Gregorian calendar, one month per line. - Call
python3 /path/to/generate_csv.py -s 8 -b birthdays.csv -d holidays.csv -m moon.csv -t months-fr.csv 2022 > calendar_data.csv
to generate the data for Inkscape's generator plugin. Here,calendar_data.csv
is the file containing the calendar data. Feel free to edit it but do not mix up with the first row containing the column headers used by the generator. Callpython3 /path/to/generate_csv.py --help
for command-line options. - Copy your pictures with format landscape 15:10 to
week-YYYY-WW.jpg
into a single directory, whereYYYY-WW
corresponds to the code given incalendar_data.csv
, columncode
. On operating systems supporting it, you can use symbolic links.create_links.awk
is a script allowing to do that more easily. It takes a space-separated two-column file and creates links. The first column is the original file name, the second one the symlink which will point to the original file. Another format can be chosen but must correspond to the image format intemplate_odd.svg
. - Copy and edit
template-odd-fr.svg
and adapt the path in the svg element containing the imagefile_not_found.jpg
to"/path/to/week-%VAR_code%.jpg"
, where/path/to
needs to be adapted to the directory where you copied the pictures in the previous step. - Symlink or copy/edit
template-even-fr.svg
. - Symlink or copy the directory
cmake
. - Copy
CMakeLists.txt
and adapt it to your needs. - Create a directory where to build the calendar, e.g.
build
inside the directory whereCMakeLists.txt
is. Open a terminal and go into this directory. - Call
cmake /path/to/directory_where_CMakeLists.txt_is
and thenmake
.- You can also call
make ${OUTPUT_FILE}-single_page
for easier debugging, where${OUTPUT_FILE}
is the variable defined inCMakeLists.txt
.
- You can also call
- Print with options A4, landscape, long-edge binding, color.
It's easier to create the image files as symbolic links. You create an spreadsheet with the list of relative files (original names) and a list of week, which you can create by expanding YYYY-01 and concatenating the string to obtain week-YYYY-01.jpg. You then export the list as text file, e.g. links.csv. Then gawk --file create_links.awk < links.csv. Beware that LibreOffice Calc may change -- to –.
- When using templated pictures, ensure all pictures have the same format.
- Get the picture format with
identify *.jpg | cut --delimiter=' ' --fields=1,3 | cut --delimiter='x' --output-delimiter=' ' --fields=1-3 | awk '{print $1" "$2/$3}'
, whereidentify
is from ImageMagick.