Additional numbered styles

Skip to first unread message

Jean Vittor

Jun 1, 2021, 3:48:06 PM6/1/21
to Trac Users

I'm looking for a way, in wiki, to use some numbered custom types.

What I'm dreaming of is:
  • a way to define a custom style (say Requirement, for example),
  • see an automatic numbering each time this new style is used (e.g. [Rn], where n is automatically incremented),
  • a kind of index macro showing the list of items using this style on a page; something like:
[[CustomStyleIndex(Requirement [, PathToThePage/IfNotTheCurrentOne])]]
  • hyperlinks working like for Header styles (or anchors).
The idea behind this is to help in writing some traceability matrix, that is to ensure that all items of a page are covered.

Is anybody aware of such a feature (or something similar) in existing extensions?
I've had a look on the plug-in / macro list on track-hacks but I haven't found.


Jean Vittor

Jun 2, 2021, 5:27:00 AM6/2/21
to Trac Users
After a short thought (and trying to make it with existing stuffs), I think this feature should not concern styles but anchors.
The reasons are:
  • I guess adding custom styles is not expected.
  • Custom anchors may appear under existing styles / formats (e.g. a header, or a bullet in a list).
  • The custom anchor insertion would look more like current anchors.
If I try to rephrase the spec, this would give (for an anchor tag named "Requirement"):
  • Define an anchor tag, in config file:
# Tag ID: "Requirement", numbering template: "[Rn]" where "n" is the automatical count.
anchor.tag = Requirement, [(?.)R#]
  • Insert an anchor, in a wiki page (say My/Wiki/Page):
[=#Requirement(MyAnchorId)] The product should be able to blah blah blah.
This would display as:
[R1] The product should be able to blah blah blah.
  • Insert the custom anchor table:
[[CustomAnchorIndex(Requirement [, My/Wiki/Page])]]
This would display a hyperlink list:
[R1] The product should be able to blah blah blah.
[R2] Another one blah blah blah.
  • Referencing an anchor, from a (possibly different) wiki page or a ticket comment:
see [#Requirement(My/Wiki/Page:MyAnchorId)].
This would display a hyperlink as:
see [My/Wiki/Page.R1].



Sep 28, 2021, 4:23:02 PM9/28/21
to Trac Users
The plugin most similar to what you describe is TracBackLinkPlugin:

It parses the page on save and maintains a database table of backlinks for populating an index at the end of the page. What you describe is effectively the same, parse the page to extract the requirements that are identified by a custom syntax and display those in a macro by pulling from a database table.


Jean Vittor

Oct 4, 2021, 4:52:18 PM10/4/21

I'll give a try...

Thanks Ryan,


Le 28/09/2021 à 22:23, RjOllos a écrit :

Reply all
Reply to author
0 new messages