Eur Ing Chris Green wrote:
> If I create a 'page description:' in a restindex for a file what does
> rest2web do with it? I.e. where does it (usefully) appear?
>
The idea is that you can use it in indexes for the directory that pages
appear in.
You can access this information via the 'sections' data-structure.
Each directory is divided into sections. 'sections' is a dictioanry
keyed by section. If you don't use sections then all the pages will be
in the default section (keyed by None.)
pages = sections[None]['pages']
for page in pages:
description = page['page-description']
link_title = page['link-title']
Below is some example code I use in an index page to *auto-generate*
indexes. It includes a link to every page, with a description of that
page. (It also uses the link-title.)
<#
indexblock = '''
<a name="%s" id="%s"></a>
<div class="indexblock">
<h2>%s</h2>
%s
<ul>
%s
</ul>
</div>
'''
pageblock = '''
<li><a href="%s">%s</a>
%s
</li>
'''
for section in sectionlist:
thepages = []
for page in sections[section]['pages']:
thispage = pageblock % (page['target'], page['link-title'],
page['page-description'])
if type(thispage) is unicode:
thispage = thispage.encode('utf8')
thepages.append(thispage)
thepages = '\n'.join(thepages)
id = urllib.quote(str(section))
sect_title = sections[section]['title']
desc = sections[section]['description']
this_sect = indexblock % ( id, id, sect_title, desc, thepages)
print this_sect
#>
All the best,
Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
> Similarly, where does 'link title:' end up?
>
> Are there some macros or functions that allow one to use 'page
> description:' and 'link title:'?
>
>
|