Modify

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#2423 closed enhancement (wontfix)

Decrease headline level for included pages

Reported by: birne@… Owned by: Noah Kantrowitz
Priority: normal Component: IncludeMacro
Severity: normal Keywords: headline smart hierarchy
Cc: lei@… Trac Release: 0.11

Description

First I would like to say, that I love this macro as I can now use meta wiki pages constructing a kind of "book" of selected content in my wiki.

There are only two things I am missing:

  • Incomplete TOC as already described in Ticket #2306
  • Decreasing the level of all headlines in included wiki pages

Example: MainArticle goes like

= User Guide =
[[Include(wiki:Installation, text/x-trac-wiki)]]
.. more Include follow here ..

and Installation contains:

= Prerequisites =
In order to install .. bla
== Database ==
bla bla

The the resulting should be

= User Guide =
== Prerequisites ==
In order to install .. bla
=== Database ===
bla bla

For best result, a decrease level counter should be passed down on each include. That would allow this feature to work properly even when an included page itself includes other pages (wich itself might again include other pages, ..). Of course a headline can not be below level 7 as this would break the HTML standards. I have no idea how to handle this in a smart way..

Thank you for your attention so far!

Attachments (2)

macros.py (5.5 KB) - added by lei@… 17 years ago.
Headlines hierarchy patch
macros.diff (3.1 KB) - added by lei@… 17 years ago.
Headlines hierachy PATCH - I accidently added the macros.py file before

Download all attachments as: .zip

Change History (5)

comment:1 Changed 17 years ago by lei@…

Cc: lei@… added; anonymous removed
Keywords: hierarchy added
Trac Release: 0.100.11

I created a patch for the decreasing of headlines, which is attached. The patch is based on [3615] of the IncludeMacro and works with Trac 0.11.

Feel free to provide feedback.

Changed 17 years ago by lei@…

Attachment: macros.py added

Headlines hierarchy patch

Changed 17 years ago by lei@…

Attachment: macros.diff added

Headlines hierachy PATCH - I accidently added the macros.py file before

comment:2 Changed 17 years ago by Noah Kantrowitz

Resolution: wontfix
Status: newclosed

Because this macro uses the already modular mimeview API, I would recommend making this into a formatter of some form, so you can package it independently. As this is not generalized, it won't be included in the macro directly.

comment:3 Changed 17 years ago by lei@…

Hi Coderanger, I am a newbee in python and Trac plugin programming. Thats why I don't get you :) However, it works for me and I am glad if somebody could use it, too.

PS: Just wanted to add something on the use. The new parameter order is as follows:

[[Include(<WikiPage>,<HeadlineLevelDecrease>,<Format>)]]

HeadlineLevelDecrease defaults to 1. Examples:

[[Include(CamelCase)]]
[[Include(CamelCase,1)]]

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Noah Kantrowitz.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.