[pmwiki-users] Re: Dictionary index (was: Fix for: behaviour when teaser anchor not found)

John Rankin john.rankin at affinity.co.nz
Wed Aug 31 19:25:45 CDT 2005


On Wednesday, 24 August 2005 9:35 AM, chr at home.se wrote:
>Hi
>
>I've attached a version of titleindex.php that I just modified to use
>MarkupToHTML(). Not sure if I need to apply Keep() to the
>result though...

Hello Christian,
I encountered a problem with this. First, let me recap.

You enhanced Patrick's titledictindex script to insert a teaser
paragraph for each page in the index. This uses the teaser
function from the markup extensions to get either a [[#teaser]]
paragraph or the first paragraph of each page in the list.

It calls MarkupToHTML on each piece of teaser text. The pagelist
function FmtPageList applies a Keep() to the result.

The link below shows a nice example. Here is my main problem.
The html view is largely fine (there is a minor problem to
which I may return if we can sort out the major one).

When I repurpose the page for typesetting, I encounter a
'gotcha!' as follows:

- MarkupToHTML processes the markup to the new dtd,
  including the step to strip out the namespace qualifier
  that allows us to distinguish between xhtml and wikibook,
  and remove any left-over xhtml

- so now our page contains wikibook tags without their
  namespace qualifier, because MarkupToHTML applies all
  Markup rules

- and now the rest of the pmwiki processing takes place,
  restores the Keep() text, removes any left-over xhtml,
  *and strips out the wikibook tags* from the teaser text

What we need to do is have FmtPageList apply PRR()
instead of Keep(), but not try to process the output
tags that control the list itself. Then pmwiki's normal
markup processing will apply to the teaser text, and all
will be well.

I redefine all the $FPLDictIndex variables to their
wikibook equivalents, and the basic framework comes
out correctly; it's the teaser text that gets abused.

Any bright ideas?? This is a general problem for code 
which applies MarkupToHTML as part of its processing, 
so it would be nice to find a solution.

>
>The relevant part in the config file is as follows:
>
>// Define additiona formats for (:pagelist:) and (:search...:)
>if(true) {
>  $FPLDictIndexStartFmt = 
>    "<a name='dictindexheader'></a><dl class='fpldictindex'>" . 
>    "<p class='vspace'></p>";
>  $FPLDictIndexEndFmt = '</dl>';
>  $FPLDictIndexLFmt=''; 
>  $FPLDictIndexIFmt ="<dd><a href='\$PageUrl'>\$Namespaced</a>: \$Teaser</dd>";
>  $FPLDictIndexHeaderLink = '<a href="#$IndexLetter">$IndexLetter</a>';
>  include_once("$FarmD/cookbook/titledictindex.php");
>}
>
>If you use this you should be able to get something like the
>result here:
>
>
>http://wiki.lyx.org/test/wiki/devel/pmwiki.php/Test/PagelistsUsingDictindex
>


-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list