Skip to content
/ cage Public

Booklet generator from templated and manual pages

Notifications You must be signed in to change notification settings

galou/cage

Repository files navigation

h================== Calendar generator ==================

Generate a calendar or any other book from templates.

Dependencies

Steps in a glance

  • Generate extra pages manually.
  • Generate the csv data with generate_csv.py to feed inkscape_generator.
  • Generate the pages from templates and glue all pages with cmake.

Detailled steps

  • Create birthdays.csv
    • Each line: YYYY-MM-DD,name, where "YYYY-MM-DD" is the birth date. Write 0000 or 0001 for unknown birth year. Birthdays on 29th February are not supported.
    • You can use the Unicode character U+F1FD, , with Font Awesome
  • Create holidays.csv
    • Each line: YYYY-MM-DD,event, where "YYYY" is the current year.
    • holidays.csv can be generated by generate_holidays_fr.py or generate_holidays_cz.py.
  • 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.
  • 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. Call python3 /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, where YYYY-WW corresponds to the code given in calendar_data.csv, column code. 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 in template_odd.svg.
  • Copy and edit template-odd-fr.svg and adapt the path in the svg element containing the image file_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 where CMakeLists.txt is. Open a terminal and go into this directory.
  • Call cmake /path/to/directory_where_CMakeLists.txt_is and then make.
    • You can also call make ${OUTPUT_FILE}-single_page for easier debugging, where ${OUTPUT_FILE} is the variable defined in CMakeLists.txt.
  • Print with options A4, landscape, long-edge binding, color.

Managing images with spreadsheet and symbolic links

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 –.

Tips

  • 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}', where identify is from ImageMagick.

About

Booklet generator from templated and manual pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published