Skip to content

kwikwag/ok-templates

 
 

Repository files navigation

Open Knesset Templates

This repository holds the code for Open Knesset templates, sample data and code to run as development server. You are invited to fork the code, improve the design and send a pull request

Quick Start

  • Clone the repo: git clone git@github.com:daonb/ok-templates.git
  • if you don't have python installed (you can test for it by typing python on your prompt) get it from http://www.python.org/download/. Version 2.7.2 is best
  • Change your working directory to the project's: cd ok-templates
  • Start the local server: python server.py
  • Browse to http://localhost:8000/agenda/1;s

Designing

the templates themselves are located at the templates folder and written in Mustache logicless templating language. The templates have a .mustache ending and are rendered using a context based on a general context.yaml` on the project's root and a template specific json file.

Sample

The repository includes a agenda_detail.mustache file that is based on a 1.0 template and all the required template tags and include files. To see the template, point your browser at http://locahost:8000/agenda/1;s and you will see a page rendered based on the template and a context file from fixtures/agenda/1.json. Behind the scenes, when the server identify a url that ends with ;s it eaves most of the rendering to the client and uses template/small_base.mustache to render a page with basic html and the javascript needed to render the page on the client. Without the ;s rendering is done on the server, using pystache. This mode is not tested and is less usuable as pystache does not return meaningfull errors (yet?).

I18N & L10N

The templates support i18n through gnu's gettext. You can test if you have it installed by running gettext --version. If you don't, the easiest way is to run apt-get install gettext on Linux or brew install gettext for the OSX, and for the less fortunate ones, try the setup file here. To use static text in the the template, use natural language and wrap it in {{#_}}Natural Language{{/_}}. Once you've added strings to be translated you need to update the .po file. First run python makemsgs.py to update the file locale/he/LC_MESSAGES/mustache.po with the new strings. Next, edit the file using a text editor or poedit and translate the strings. Fianlly, you need to compile the file using ./compilemsgs.

Once stasified with your changes, commit your changes to your fork with a meaningful commit message and send a pull request to hasadna's fork

About

Open Knesset Templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published