This question about Developing extensions (plugins skins etc.): Task filed

Recursive topics and their headers layout

Hi,

I'm using GenPDFAddOn for generation of recursive topics with pdfheadershift=auto setting.

The problem that I have is that

a) consequtive children with several H1 headings produce continuous list of headings in ToC, while I would like to see them grouped by child.

b) Child topic name is not listed in ToC, only headers from it. This is not a problem by itself, but with first problem it makes things bad.

Example of the structure that I use:
  1. Main topic
    1. Child topic 1
      1. First H1 Heading
      2. Second H1 Heading
    2. Child topic 2
      1. First H1 Heading
      2. Second H1 Heading.
What I currently receive is :
  1. Main topic
    1. First H1 Heading
    2. Second H1 Heading
    3. First H1 Heading
    4. Second H1 Heading
What I expect:
  1. Main topic
    1. Child topic 1 name
      1. First H1 Heading
      2. Second H1 Heading
    2. Child topic 2 name
      1. First H1 Heading
      2. Second H1 Heading
Is there a way to get what I need?


Unfortunately nothing automatic. The HTML is built recursively with the headings auto-shifted by the "depth" of the recursion. So root level is shifted 0, first descendant shifted 1, and so on. If you require a new heading per topic name, then the shifting has to be by "2" - one to accommodate the new inserted heading level, and one more for the internal headings in the topic.

The shifting is accomplished in lib/Foswiki/Contrib/GenPDFAddOn.pm starting around line 700. You might try something like setting $shift to 2 x $depth, and $hn to ( 2 * $depth ) - 1 And then round line 722, where a heading is conditionally inserted, make that unconditional - comment out the if ( $html !~ /<h$hn/is ) { and _writeDebug statements, and also the closing brace. $shift is the number of levels that the headings are shifted. $hn is the heading number that will be inserted into the topic.

If these changes work for you, let me know and I can look into adding a "force per-child heading" option or something like that.

-- GeorgeClark - 25 Jun 2010

I've been trying to get something working. The problem is the tree of parent/child topics (and their depths) is built separately from the html processing. So far my changes may fix the one topic with multiple H1 headings, but break things in deeper topics.

-- GeorgeClark - 25 Jun 2010

See Tasks:Item9251

-- GeorgeClark - 02 Jul 2010

QuestionForm edit

Subject Developing extensions (plugins skins etc.)
Extension GenPDFAddOn
Version Foswiki 1.0.8
Status Task filed
Topic revision: r4 - 02 Jul 2010, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy