martin f krafft wrote:
> also sprach Michael Foord <fuz...@vo...> [2006.07.30.2239 +0100]:
>
>> You use it by putting the following in your templates :
>>
>> <% include('filename.txt') %>
>>
>> or :
>>
>> <# print include('filename.txt') #>
>>
>> You *can* pass absolute or relative paths, but if you just pass a
>> filename it will go up the directory tree of your site looking for the file.
>>
>> Seems to work... It should be possible to nest them, but filenames will
>> be resolved from the start directory (lowest point)...
>>
>
> Just tried this now and it works like a charm, except...
>
> filename.txt is included verbatim. I guess that makes sense, but it
> would also be great if I could just include an RST file and have it
> processed before inclusion.
>
> I realise RST has an include directive itself, but what if I want to
> include an RST file from template.txt?
>
Then you need to use templating tags for rest documents :
<$ include('filename.txt') $>
See 'templating.txt' about the two different sorts of templating tags. :-)
You will only be able to use this inside *pages* though, not inside
'template.txt', which is never processed for ReST. (You want to include
ReST in your HTML template !?!?).
*However*, I can easily expose an equivalent of html_parts -so you could
do :
<% include_rest('filename.txt', encoding) %>
Do you need this ?
Michael
http://www.voidspace.org.uk/python/index.shtml
|