diff README @ 526:31282f97b807

Reworked the --help function * More information about the templates * Information about the templates and how to create them added to the README file.
author Magnus Schieder <mschieder@intevation.de>
date Tue, 22 Jan 2019 15:35:28 +0100
parents d749ded62687
children fab6ff9b248e
line wrap: on
line diff
--- a/README	Thu Jan 17 19:27:07 2019 +0100
+++ b/README	Tue Jan 22 15:35:28 2019 +0100
@@ -167,6 +167,74 @@
     $ getan /path/to/mytime.db
 
 
+Writing Templates
+=================
+
+Getan uses the Jinja2 templating language. You can find more information
+at `Jinja2 <http://jinja.pocoo.org/>`_.
+
+If a year or a week is specified, only the entries in this period will be
+loaded.
+
+Variables
+---------
+
+current_week: The current week.
+current_year: The current year.
+
+user: What You indicated with -u.
+week: What You indicated with -w.
+unix_week: What You indicated with -w, in unix notation.
+year: What you indicated with -y.
+
+get_total_duration(): Total duration of all entries.
+
+database: Path of the database.
+
+entries: List of all entries.
+    get_comment(): Description of the entry.
+    get_workpackage(): Work package of the entry.
+    desc: Work package and Description of the entry.
+
+    startisoday: Year, month and day in ISO format.
+    start: Start time as datetime.
+    end: End time as datetime.
+    get_duration(): Duration of the entry.
+
+projects: List of all projects.
+    get_total_duration(): Total duration of all
+    entries in the project.
+    desc: Description of the project.
+    key: Key of the project.
+
+    entries: All entries in this project (See entries).
+
+
+If -w is specified, only this week will be loaded from the database.
+
+year(): All entries in this year.
+month(): All entries in this month.
+week(): All entries in this week.
+day(): All entries in this day.
+
+Example
+-------
+
+{{ user }}, (KW {{ week }}, {{ year }})
+{% for i in user -%}
+=
+{%- endfor -%}
+ ==============
+{% for proj in projects %}
+# {{ proj.desc }}
+{% for entry in proj.entries|sort(attribute='start') -%}
+{{ entry.get_comment() }}
+{% endfor -%}
+# total time: {{ proj.get_total_duration()|human_time }}h
+{% endfor %}
+# total: {{ total_time|human_time }}h
+
+
 CREDITS
 =======
 Getan is Free Software licensed under the terms of GNU GPL v>=3.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)