create new tag
, view all tags

Archive of TocPluginDev

Great extension to TWiki!

May I suggest to add the standard sections to the TocPlugin topic, e.g.

  • Syntax Rules
  • Plugin Settings with one line descriptionand debug flag.
  • Plugin Installation Instructions
  • Plugin Info

-- PeterThoeny - 24 Sep 2001

Syntax Rules The syntax and usage is quite complex, and is written in a help document that only works well when the Plugin is actually enabled in that web. I can create a synopsis, but I'm reluctant for the reasons given in ExperiencesSubmittingPlugins - it's duplication of effort, and as every lazy programmer knows, that's bad.

Plugin Settings - there are none. I will add the one-liner (I'd missed that before). There is no debug flag - the plugin is unit tested, and debugging involves adding a unit test that reveals the problem, not hot debugging.

Installation - is already documented.

Plugin Info - not sure what else is required than what's there, but I'll have a look.

-- CrawfordCurrie - 26 Sep 2001

Really impressed by this plugin. I have only one suggestion, I want to have multiple WebOrder's for different pages in the same web. I hacked a really easy check in the code to see if $topicWebOrder exists, if it does use that instead of the standard WebOrder.

The quick check was in the processTopic routine were it creates the WebOrder :

if (!$toc || $web ne $toc->web() || $topic eq "WebOrder") {
   my $mess;
   my $webOrder = "WebOrder";

   if ($wif->topicExists($topic . "WebOrder")) {
      $webOrder = $topic . "WebOrder";

   ($toc, $mess) = TopLevelSection::createTOC($web, $wif, $webOrder);
   return Section::replaceAllTags($text, $mess) unless $toc;

I just needed to read $webOrder into createTOC and replace all the hardcoded locations of the filename. It was a fairly painless modification.

-- ShawnBradford - 12 Jul 2002

Glad it has been of some use. Since my company no longer uses this plugin, I have not been supporting it (too much to do). The code which is attached to the topic is complete (sources, tests, the works) please feel free to make changes. Or you can rely on me and wait for the Christmas holidays, when I may have some time.....

-- CrawfordCurrie - 15 Jul 2002

Unless other people are intrested in the modifications I would prefer to wait until you have time for a proper inclusion into the code.

-- ShawnBradford - 19 Jul 2002

One other thing to look at when you open up the TocPlugin. It uses its own Attrs object, but the object isn't put into the TocPlugin namespace. This causes a conflict with the ActionTrackerPlugin that defines its own Attrs object.

This leads to lots of annoying "warning ... redefined at" messages in my httpd error_log. Chaging it to use its own package namespace solved the problem.

In TocPlugin/Attrs.pm you have:

package Attrs;
This would be great if ActionTrackerPlugin didn't also have its Attrs.pm starting with the same package declaration. What I suggest is making the package declaration look like:
package TocPlugin::Attrs;
and then change the calls:
Ideally, I suppose it should be in the package: Plugins::TocPlugin::Attrs, or even TWiki::Plugins::TocPlugin::Attrs, but that is a lot more to type.

-- JohnRouillard - 27 Aug 2002

moved here from Codev.TocPluginWebPrint by MattWilkie

I have extended TocPlugin to make it useful (to me) in making printed books of online documentation, while still having the documentation be useful online.


  • Allow topics NOT in WebOrder to use TOC tags except %SECTION% and %ANCHOR%
  • Add pseudo-topic WebPrint to creat a single result reflecting all sections in WebOrder, with variables expanded in the proper context.
  • Fixed name clash for Attrs as suggest by ??


  • Attached to this topic. Should they be somewhere else?

  • Performed with help from MattWilkie who suggested seeing PatchGuidelines for a primer on proper diffs. We're still looking for a longer tutorial written by RichardDonkin. Anybody remember where it is? (search is useless because 'diff' is used so much).


  • I use wget to fetch the HTML, and htmldoc to create the PDF.


  • This is now in use on our internal TWiki.

-- CarlMikkelsen - 16 Jan 2003

I've added it to CVS. I'm working on incorporating the changes described, watch this space.

-- CrawfordCurrie - 02 Feb 2003

I'm using the plugin on the 2001-release of Twiki. While forced links (pair of double square brackets) works in WebOrder, specific links (nested square brackets) are rendered 'as is', when the %CONTENTS% is used. E.g.:

WebOrder contains a line

   * [[BankImpressum][Impressum]]
which is rendered as a link named Impressum to topic BankImpressum, when WebOrder is displayed. but it results in

  • 1. [[BankImpressum][Impressum]]

on the page using %CONTENTS%. Indentation, bullet, numbering are correct. Any hints/ideas are welcome...

-- PatrickHansmeier - 17 Jan 2003

Moved question from PatrickHansmeier down in this file so it would not be overlooked.

I've added features and perl scripts to:

  • Script to search through all webs, looking for WebOrder files to process.
  • Extend TocPlugin to support multiple WebOrder topics per web. They are named WebOrder[a-zA-Z0-9]*.
  • Script to process each WebOrder... automatically into a PDF file by using htmldoc and wget. The script:
    • Looks for a matching TitlePage... topic.
    • If found, adds a title page with htmldoc.
    • On the title page, looks for <WATERMARK>Text</WATERMARK>
      • If found, use GhostScript to prepare a jpeg background image to watermark each page of the PDF.

Some of these functions and scripts are not generalized to support configuration from twiki.cfg or appropriate variables.

-- CarlMikkelsen - 10 Feb 2003

Similar to Carl's comment above:

A heading such as

   ---++ Title with embeded woeds in =code= format
renders correctly in the page but appears in the TOC unrendered - the "=" is visible.

-- AntonAylward - 10 May 2003

I really like this Plugin, but am a little bit unhappy about the fact, that I cannot REF to a SECTION0 tag. I am writing a longer document using TWiki and this Plugin. To work efficiently, I have split up the document in many topics, linked of course with WebOrder. In the cours of the work, more and more topics will be split up further, former SECTION1 etc. tags becoming SECTION0. I can now link from any other page listed in WebOrder to SECTION1 tags, but as soon as I split up the target topic and the linked-to SECTION1 tag becomes a new SECTION0 tag, the link becomes invalid.

Has anyone figured out how to simply allow REFs to SECTION0 tags?

-- MartinRehker - 25 May 2003

Sorry for not having responded to requests for changes for so long, but I've been too busy. I've switched the CVS policy over to ContactAuthorFirst and I'm going to start incorporating some of the fixes and ideas here. I'll start by examining Carl's changes, and will publish stable increments here until we are all happy.

-- CrawfordCurrie - 26 May 2003

Last night I merged the diffs and fixed a couple of minor problems reported above. Patrick, your reported problem with BankImpressum is definitely gone.

I stalled when I came to the idea of multiple (or just different) WebOrders per web. Why do you do this? What methodology (of the two alternatives described above) would you prefer?

Anton, your ---++ issue above is an issue with TWiki TOC, not TocPlugin.

Martin, you can't refer to SECTION0s because..... because..... because it doesn't work that way. I'm trying to figure it out.

Carl, do you want your improvements incoporated in the source? If so, I need a diffs, or something like that (even a tarball of the directory tree would work for me).

-- CrawfordCurrie - 28 May 2003

The WebPrint-thing is great, you should mention it in the TocPlugin and TocPluginHelp topics! I just read about it here (see #WebPrint), then went to CVS to get the latest version just to discover at the end, that it is already working in the distributed version smile

-- MartinRehker - 29 May 2003

I'm not actively supporting it. If it doesn't work with Cairo I might fix it if someone points me at the problems. Alternatively I'd be delighted if someone came forward and offered to help support it.

-- CrawfordCurrie - 23 Aug 2004

Was very happy working with TocPlugins for the first time on a real example when I bumped into the Section0 Issue, and found this topic, and read about WepPrint, which is also what I needed. Still , a few things I do not understand :

  • Where is the Cvs which is mentionned before ,
  • I could not find any trace of WebPrint in my code (1.0), or in support, or Goggle, like MartinRehker mentions before.
  • CrawfordCurrie says : ... I merged a couple of diffs... : where to ? was it published ? I could only find the early version of TocPlugins, and no trace of the aforementionned diff
  • I did read in koala.ilog.fr and my understanding is that carl patch is not incoprorated. Yes ?
My impression is that maybe some version may have gone lost ?

Any pointer or hint ?

-- LucAbom - 29 Dec 2004

ok, may got some answers by myself (did my home work smile ) :

-- LucAbom - 30 Dec 2004

seems to work for me. did package 1.2 it and attached it. you decide.

-- LucAbom - 30 Dec 2004

WIBNIF (wouldn't it be nice if.....)

  • The syntax was merged with %TOC% syntax (I always thought %TOC% should be supported in a plugin)
  • It was tested against Cairo
  • It supported I18N topics
    • With SVN DEVELOP branch I have no problems with I18N topics. Nice smile -- SteffenPoulsen - 01 Apr 2005
Topic revision: r1 - 2006-04-20 - SteffenPoulsen
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.