Regarding the Sage Notebook, I propose that we use a templating engine
instead of using Python string templates class and writing HTML code
in the Python code. I have converted the existing templates in Extcode
to templates that use the Jinja engine, see
http://trac.sagemath.org/sage_trac/ticket/3923. I also moved the HTML
for the Account Settings page to a Jinja template, see
http://trac.sagemath.org/sage_trac/ticket/3937.
I think using Jinja makes the Python code more readable. In addition,
I like be able to create a base template that other templates build
upon. Plus it's nice to be able to use for loops and if statements in
the templates. I use both in the templates at the two tickets.
Jinja is a clone of the templating engine used in the most popular
Python web framework Django. I am very interested in the possibility
of migrating the Sage Notebook to Django. Moving all the Notebook's
HTML to Jinja templates is the first step in migrating.
If Sphinx, a documentation system, is distributed with Sage then Jinja
would also be. See the sage-devel thread "Sphinx and the Sage
Documentation" at
http://groups.google.com/group/sage-devel/browse_thread/thread/7b0b2f0b34f1f892/
Timothy
Timothy,
I strongly support your proposal to use Jinja to template the HTML
generation code for the Sage notebook. Go for it!
William
>
> I think using Jinja makes the Python code more readable. In addition,
> I like be able to create a base template that other templates build
> upon. Plus it's nice to be able to use for loops and if statements in
> the templates. I use both in the templates at the two tickets.
>
> Jinja is a clone of the templating engine used in the most popular
> Python web framework Django. I am very interested in the possibility
> of migrating the Sage Notebook to Django. Moving all the Notebook's
> HTML to Jinja templates is the first step in migrating.
>
> If Sphinx, a documentation system, is distributed with Sage then Jinja
> would also be. See the sage-devel thread "Sphinx and the Sage
> Documentation" at
> http://groups.google.com/group/sage-devel/browse_thread/thread/7b0b2f0b34f1f892/
>
> Timothy
>
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
One argument against using Django for the notebook is that you
might end up trying to code around a bunch of the abstractions that
Django puts on top of what is really going on.
Either way, this is definitely something to consider, because in my
experience, Django is really good at what it does.
-Alex