Python-based "text preprocessing" (not only static HTML)

110 views
Skip to first unread message

HansBKK

unread,
Feb 5, 2012, 9:21:16 AM2/5/12
to leo-e...@googlegroups.com
Apologies in advance to the extent this is considered off-topic, because given my level of programming experience (on a scale of 1-10: 0.2 8-) I don't think I can use Leo for this, but given the talk of using Leo for "templating" and the fact that I'm looking for recommendations from Pythonistas. . .

So do ignore if the answer isn't obvious to you or the whole topic isn't of interest

I'd like to be able to generate small static HTML websites via a combination of (all hand-coded) "content" files and templates. I don't want a full-blown CMS with a database, just a program and/or scripts to run against a directory tree.

Something at about this level of user-friendliness (i.e. not requiring programming skills). I'd actually use this package - more details here, but it's pretty inactive, and if I did end up having to learn some programming, would rather not start with a language that just had its 25th user conference!

Another prototype-example is this, (but it's perl) and this - but both are 5 years dead.

Googling so far brought me from here to here, Hyde looks like the hotness but more of a tech challenge than I'd like

I **know already** that "Leo can do this" - but that just means **you** can do this in Leo+Python, and I'm not going with "cloned snippets for templating" which would have been my approach a few weeks ago.

I have a real project starting this week, but I'll be too busy resurrecting the HTML/CSS segments of my poor old brain to start learning Python - I'm looking for something that will work out of the box to start with, but written in Python.

Thanks in advance. . .

Terry Brown

unread,
Feb 5, 2012, 11:31:50 AM2/5/12
to leo-e...@googlegroups.com
On Sun, 5 Feb 2012 06:21:16 -0800 (PST)
HansBKK <han...@gmail.com> wrote:

> I **know already** that "Leo can do this" - but that just means **you** can
> do this in Leo+Python, and I'm not going with "cloned snippets for
> templating" which would have been my approach a few weeks ago.
>
> I have a real project starting this week, but I'll be too busy resurrecting
> the HTML/CSS segments of my poor old brain to start learning Python

If you scroll down on this page

http://wiki.python.org/moin/WebFrameworks

you come to "Basic Frameworks Providing Templating"

I'm not familiar with any of them, I maintain one site using Leo +
Genshi, one of the Python templating systems, but you do need to supply
some python glue for that approach.

Cheers -Terry

HansBKK

unread,
Feb 5, 2012, 2:33:25 PM2/5/12
to leo-e...@googlegroups.com, terry_...@yahoo.com
Thanks Terry, but it looks to me like all of these are dynamic, running via server-side add-ons.

I'm looking to locally generate static HTML+CSS - maybe some javascript for stuff like analytics but that's all - that can be uploaded to a plain-vanilla Apache host.

I realize that you (sing + most of you plural) wouldn't do things this way, but just in case these details jogs anyone else's memory.

jkn

unread,
Feb 5, 2012, 4:26:53 PM2/5/12
to leo-editor
Hi Hans

jkn

unread,
Feb 5, 2012, 4:31:52 PM2/5/12
to leo-editor
Hi Hans
I have previously used Cheetah:

http://www.cheetahtemplate.org/

(and, later,) Jinja:

http://jinja.pocoo.org/

to create static HTML websites. I also used CleverCSS as a way of
writing 'structured' CSS which is preprocessed into 'the real thing':

http://sandbox.pocoo.org/clevercss/
https://github.com/clevercss/clevercss

All are python based ;-)

HTH
Jon N

Terry Brown

unread,
Feb 5, 2012, 10:39:42 PM2/5/12
to leo-e...@googlegroups.com
On Sun, 5 Feb 2012 11:33:25 -0800 (PST)
HansBKK <han...@gmail.com> wrote:

> I'm looking to locally generate static HTML+CSS - maybe some javascript for
> stuff like analytics but that's all - that can be uploaded to a
> plain-vanilla Apache host.
>
> I realize that you (sing + most of you plural) wouldn't do things this way,
> but just in case these details jogs anyone else's memory.

I don't think that's a bad way to do small sites. I've done 3-4 that
way including the one currently working with Leo + Genshi, but there's
ad hoc Python in the mix, which seems like it might not work for you.
Although the Python tutorial's not bad once you get in to it ;-)

Cheers -Terry

HansBKK

unread,
Feb 6, 2012, 1:55:28 AM2/6/12
to leo-e...@googlegroups.com
Thanks for the templating pointers. I also came across Tahchee, which uses Cheetah and also supports reST directly, which is great for possible Leo integration, plus my current markup-format transformer Pandoc supports reST as input.

Another thought for a good combination of mainstream support, active development and relative simplicity is Sphinx, I know it's aimed at "documentation" but it should also server for simple "portfolio/brochure" sites.

Based on reST as well obviously, and I've just discovered it uses Jinja2.

Matt Wilkie

unread,
Feb 13, 2012, 4:20:21 PM2/13/12
to leo-e...@googlegroups.com
> I'd like to be able to generate small static HTML websites via a combination
> of (all hand-coded) "content" files and templates. I don't want a full-blown
> CMS with a database, just a program and/or scripts to run against a
> directory tree.

A little indirect but here is one idea: run bloxsom locally, capture
the result with httrack and then sync to web host. Httrack can be run
in a refresh mode that only captures changes, which in turn means you
can use a syncing tool that only bothers itself with new and changed
files.

Substitute whatever you like for bloxsom, such as Leo's own rst export.

[1] http://muli.cc/, http://pyblosxom.bluesock.org/
[2] http://www.httrack.com/

--
-matt

Matt Wilkie

unread,
Feb 13, 2012, 4:28:48 PM2/13/12
to leo-e...@googlegroups.com
> Substitute whatever you like for bloxsom, such as Leo's own rst export.

and substitute pyblosxom for httrack!
http://pyblosxom.bluesock.org/1.5/deploy_staticrendering.html

(So yes, I haven't used it for a very long time. I've always been
enamoured of the ideals it comes from though.)

--
-matt

HansBKK

unread,
Feb 13, 2012, 9:18:12 PM2/13/12
to leo-e...@googlegroups.com
Thanks for the pointer Matt bloxsom looks cool, but one of the (few) parameter's I'm using to limit my search is that the tool should be based on a language I wouldn't mind using as my first entry into "real" programming. I've dabbled in perl, but at this point I think it best to keep my focus on python (or maybe haskell due to my interest in pandoc ATM).

Matt Wilkie

unread,
Feb 14, 2012, 1:42:19 AM2/14/12
to leo-e...@googlegroups.com

the second link is for a python-blosxom spin off. I included the
original as well so as to be faithful to the source. My apologies for
the confusion.

--
-matt

HansBKK

unread,
Feb 14, 2012, 8:35:47 AM2/14/12
to leo-e...@googlegroups.com
On Tuesday, February 14, 2012 1:42:19 PM UTC+7, Matt Wilkie wrote:
> best to keep my focus on python (or maybe haskell due to my interest in pandoc ATM).

the second link is for a python-blosxom spin off. I included the original as well so as to be faithful to the source. My apologies for the confusion.

No my apologies for not being more thorough in my initial browsing.

Just to be clear you meant that I should just use pyblosxom alone, not just replacing a spidering tool in combination with blosxom, right?

Pyblosxom does indeed look very interesting, although it seems to be 99% targeted for blogging, there is a plugin that "allows" for static pages, including the front page.

It apparently supports both reST and markdown as source syntax, just like Pandoc, so that's a good fit there.

Thanks for the pointer. . .

Matt Wilkie

unread,
Feb 15, 2012, 1:34:52 AM2/15/12
to leo-e...@googlegroups.com
> Just to be clear you meant that I should just use pyblosxom alone, not just
> replacing a spidering tool in combination with blosxom, right?

Yes that's correct. If you take it for a spin or two I'm interested in
your thoughts on the experience, regardless of whether it finds a
place in your toolbox or not.

cheers,
--
-matt

Reply all
Reply to author
Forward
0 new messages