File extension for Genshi templates?

10 views
Skip to first unread message

Hamish Lawson

unread,
Sep 20, 2006, 6:17:40 AM9/20/06
to Genshi
Genshi's documentation shows template files with a file extension of
.html. However I prefer to reserve .html for files that are served
as-is to the browser. I know I could use any file extension I like, but
is there a preferred alternative? .gen perhaps?

Hamish

Matt Good

unread,
Sep 20, 2006, 7:42:34 AM9/20/06
to Genshi

No, .html is normally used for Genshi HTML templates, since in general
the templates themselves are valid XHTML. I don't think anyone has
proposed a new file extension specific to Genshi.

-- Matt Good

Christian Boos

unread,
Sep 20, 2006, 7:55:44 AM9/20/06
to gen...@googlegroups.com

It would perhaps make sense for text templates, though, as having a
specific extension would make it easier to trigger an eventual syntax
highlighting of the text templates.
A new MIME type would be useful too, but I guess we could use the
generic text/x-genshi one.

-- Christian

Hamish Lawson

unread,
Sep 20, 2006, 10:39:38 AM9/20/06
to Genshi
Matt Good wrote:

> No, .html is normally used for Genshi HTML templates, since in general
> the templates themselves are valid XHTML.

Indeed, but it seems to me that file extensions aren't just about
formal syntax but also intent; and I'm uneasy about labelling with
.hrml somethig that is not normally intended to be served to a browser.
Both ZPT and Kid, 'ancestors' of Genshi, chose to use a specific
extension. In the case of Kid that was partly so that the compiler
could identify the relevant files. But even that might be an argument
for Genshi adopting a specific extension, in case it too acquires a
compiler.

Hamish

Karl Guertin

unread,
Sep 20, 2006, 10:49:23 AM9/20/06
to gen...@googlegroups.com
On 9/20/06, Hamish Lawson <hamish...@gmail.com> wrote:
> Both ZPT and Kid, 'ancestors' of Genshi, chose to use a specific
> extension. In the case of Kid that was partly so that the compiler
> could identify the relevant files. But even that might be an argument
> for Genshi adopting a specific extension, in case it too acquires a
> compiler.

For me, the only advantage of a specific extension is to have vim
insert a skeleton page when starting a file. For existing files, I can
just search for the genshi namespace declaration to get the syntax
file loaded. But mostly, it's a non-issue for me.

Matt Good

unread,
Sep 20, 2006, 12:27:17 PM9/20/06
to Genshi

Well, I believe one intent with Kid was to make sure your templates
were directly previewable in a browser, as well as being editable by
WYSIWYG editors.

As for compiling the templates see this regarding the Kid code
generation:
http://genshi.edgewall.org/wiki/GenshiFaq#SothenwhynotjustuseKid

I'm not opposed to a file extension, particularly for the text
templates (though XML and text templates should use different
extensions). However, I don't think it's "wrong" to use .html. At
least in the web frameworks I've worked with there are separate
locations for static resources and templates, so confusing the two is
unlikely.

-- Matt Good

Hamish Lawson

unread,
Sep 22, 2006, 7:48:55 AM9/22/06
to Genshi
Matt Good wrote:

> one intent ... was to make sure your templates


> were directly previewable in a browser, as well as being editable by

> WYSIWYG editors. As for compiling the templates ...

OK, ya got me! The consensus seems to be for .html. I'm biting the
bullet and doing likewise rather than being different from the
documentation.

> separate locations for static resources and templates,
> so confusing the two is unlikely.

I agree that adopting that practice helps.

Hamish

Reply all
Reply to author
Forward
0 new messages