Jinja-cgi interface template: Difference between revisions
From Algolit
Line 7: | Line 7: | ||
| Collectively developed by: || The people behind Python, Jinja2, cgi, html, css, Jquery & Algolit | | Collectively developed by: || The people behind Python, Jinja2, cgi, html, css, Jquery & Algolit | ||
|} | |} | ||
+ | |||
+ | The file structure is the following: | ||
+ | |||
+ | cgi-bin/ | ||
+ | export.cgi | ||
+ | interface.cgi | ||
+ | css/ | ||
+ | export.css | ||
+ | fonts/ | ||
+ | stylesheet.css | ||
+ | img/ | ||
+ | loading.gif | ||
+ | interface.html | ||
+ | js/ | ||
+ | jquery-2.1.3.js | ||
+ | output/ | ||
+ | html/ | ||
+ | pdf/ | ||
+ | README.md | ||
+ | |||
+ | ==interface.cgi== | ||
+ | This is the place where the python code goes. | ||
+ | |||
+ | ==interface.html== | ||
+ | This is the place where the variables from the .cgi script can be used. Jinja2 is used to include the variables in the html framework. | ||
+ | |||
+ | Examples: | ||
+ | |||
+ | {{ var }} | ||
+ | |||
+ | {% if var %} | ||
+ | {{ var }} | ||
+ | {% endif %} | ||
+ | |||
+ | {% for v in vars %} | ||
+ | {{ v }} | ||
+ | {% endfor %} | ||
+ | |||
+ | ==export.cgi== | ||
+ | This script is called when hitting 'submit' in the export section of the interface. Jquery uses an ajax call to run the script. It creates a .html and a .pdf document in the output/ folder. | ||
+ | |||
+ | The stylesheet export.css is applied to the exported documents. |
Revision as of 21:58, 24 October 2017
Type: | Algoliterary tool |
Technique: | |
Collectively developed by: | The people behind Python, Jinja2, cgi, html, css, Jquery & Algolit |
The file structure is the following:
cgi-bin/ export.cgi interface.cgi css/ export.css fonts/ stylesheet.css img/ loading.gif interface.html js/ jquery-2.1.3.js output/ html/ pdf/ README.md
interface.cgi
This is the place where the python code goes.
interface.html
This is the place where the variables from the .cgi script can be used. Jinja2 is used to include the variables in the html framework.
Examples:
Template:Var
{% if var %} Template:Var {% endif %}
{% for v in vars %} Template:V {% endfor %}
export.cgi
This script is called when hitting 'submit' in the export section of the interface. Jquery uses an ajax call to run the script. It creates a .html and a .pdf document in the output/ folder.
The stylesheet export.css is applied to the exported documents.