[Kde-pim] user css controlled mail appereance... reload.

Stephen Kelly steveire at gmail.com
Tue Dec 23 17:51:14 GMT 2008


Volker Krause wrote:
> On Tuesday 23 December 2008 00:42:27 Thomas McGuire wrote:
>> - One function which actually generates and returns the HTML
>> (calling the above application-implemented interface during generation to
>> get the data).

Hi,

I'm late to this discussion, but I'm interested too. I want to make it
possible to allow better templates for display of kjots books.

http://bugs.kde.org/show_bug.cgi?id=171849

I require looping so I can do something like 

file: kjotsbooktemplate.html:
<html>
<style>...</style>
<h1>{{ Book.title }}</h2>
{% for Page in Book.pages %}
        <h2><{{ Page.title }}</h2>
        <div class="whatever">{{ Page.content }}</div>
{% endfor %}
</html>

I didn't see any example or code of how the user would control the
appearance. Was it ever posted? Anyway, I'm interested how the html is
generated in the template system, and what control the template authors
have. The only template system I'm familiar with is the Django system. It
allows complete control over the templates you write, or to define a base
template with extension points. It's flexible enough to allow KNode to show
whatever headers it wants, and to {% include "referencebar.html"} etc.

http://djangobook.com/en/1.0/chapter04/
http://docs.djangoproject.com/en/dev/ref/templates/api/

Here's how it would work:

file kjotstemplatebase.html:
<html>
<style>{% block style %}{% endblock %}</style>
<body>
{% block book_content %}{% endblock %}
</body>
</html>

file kjotsbooktemplate.html:
{% extends "kjotstemplatebase.html" %}
{% block style %}
.whatever{
        color:blue;
}
{% endblock %}
{% block book_content %}
<h1>{{ Book.title }}</h1>
{% for page in Book.pages %}
        {% include "kjotspagetemplate.html" %}
{% endfor %}
{% endblock %}

file kjotspagetemplate.html:
<h2>{{Page.title }}<h2>
<div class="whatever">
{{ Page.content }}
</div>

file renderer.py:
context = {"Book": book_instance) 
// Book provides title(), and pages()
// pages() returns a list of Page instances.
// Page provides title() and content()
render_to_string("kjotsbooktemplate.html", context)

Anyone could then create a kjotsbooktemplate.html and
kjotspagetemplate.html, put them in a package and distribute it with GHNS.

There's a few templating systems in the kubuntu repositories which are
mostly written in ruby and python by the look of them. Can we depend on one
of those interpreters to do this stuff, or do we need a cpp one?


>>
>> With this API, it should be easy for application writers to use the style
>> library. Did I forget some important API bits here?
>> The API should of course be documented, like the rest.
> 
> regards
> Volker


_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list