[Pmwiki-users] Publishing a WikiTrail (or a WikiBook)

John Rankin john.rankin
Sun Aug 3 16:30:24 CDT 2003

I have developed a prototype that lets visitors to a trail page "publish" all the pages on the trail with one click.

What you get
The author puts the [[$Publish]] markup somewhere on a trail page.

PmWiki renders this as a Publish button.

Pressing Publish causes PmWiki to display the content of all the pages on the trail, formatted for printing, as a single page. It also uses the trail sequence and indentation to assign numbers to each page title.

The author can set up GroupPrintHeader and GroupPrintFooter pages to add custom header and footer text.

Some issues
I foound a couple of places where PmWiki could use a tweak. Advice and suggestions would be appreciated.

The script uses an array of
  wiki:page1 page2 ...
constructs to generate the set of pages to be displayed. The "page1" becomes the stopname.

1. It would be nice to tell PmWiki that "if this page doesn't exist, output the default text". Right now, if the page doesn't exist, it outputs nothing, so I have to do a check for page existence and either output "wiki:stoppage" or "Describe <a ... /a> here."

The best idea I could come up with is 
  wiki:page1 page2 ... ?
The optional question mark at the end says "if you get to me without finding a page to display, display the default text, substituting the last page name in the list".

2. The <<|trail|>> and <|trail|> markup interpretation gets led astray. Because $pagename is the name of the trail page, the trail markup returns "<<|trail|>>" or "trail", unless the trail page is itself in the list. I couldn't decide what was the best solution, so I made 2 adjustments to the trails script.

In <<|trail|>> markup,
  if ("$prev$next"=="") return $link;

In <|trail|> markup,
  if ("$prev$next"=="") return '';

These lines go in just before the existing return statements.

3. This is very, very minor. I found myself wanting to adjust the <hr> size attribute in the GroupPrintHeader. To be consistent with other PmWiki conventions:
and so on woould produce lines of size 1, 2 3, 4 and so on. But that loses backward compatibility. Instead, how about:
<hr size='n' noshade='on' />

4. Just how big can an HTML page get? I haven't quite dared to try Publishing the PmWiki.DocumentationIndex page...

Last words
A big thank you to Patrick for the architecture in 0.5 that made this possible. Once I got my head around how to make it work, it turned out to be less difficult than I had expected.

John Rankin

More information about the pmwiki-users mailing list