Defect #8194

{{toc}} uses identical anchors for subsections with the same name

Added by Philippe De Ryck over 6 years ago. Updated over 5 years ago.

Status:ClosedStart date:2011-04-20
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Wiki
Target version:1.3.2
Resolution:Fixed Affected version:

Description

If you have a wiki page with the following structure:
1. Section A
1.1 overview
...
2. Section B
2.1 overview
...

the {{toc}} macro cannot distinguish between 1.1 and 2.1, since it uses #overview# for both, thus ending up in 1.1

Redmine version: 1.1.2

Associated revisions

Revision 8871
Added by Jean-Philippe Lang almost 6 years ago

Fixed: {{toc}} uses identical anchors for subsections with the same name (#8194).

History

#1 Updated by Etienne Massip over 6 years ago

  • Category set to Wiki
  • Target version set to Candidate for next major release

Anchor name could be preppend with parent title anchor.

#2 Updated by Adam Pullen almost 6 years ago

Etienne Massip wrote:

Anchor name could be preppend with parent title anchor.

I would like to +1 this.

And maybe extend the requirement by allowing custom anchor names. Would be most useful in wiki when trying to write a use guide that would produce a "pretty and informative url"

i.e.

!h1. Transaction

..blah blah blah...

!h2. Expense

..blah blah blah...

!h3. Bank

..blah blah blah...

h4[[transaction-expense-bank-bank-fees|Bank Fees]].

To enter a bank fee click...

#3 Updated by Jean-Philippe Lang almost 6 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next major release to 1.3.2
  • Resolution set to Fixed

Etienne Massip wrote:

Anchor name could be preppend with parent title anchor.

This is not bullet-proof as it wouldn't make unique anchors with the following:
1. Section A
1.1 overview
1.1.1 subsection
...
2. Section B
2.1 overview
2.1.1 subsection

I fixed it in r8871 by using -2, -3... at the end of anchors (similar to what mediawiki does).

#4 Updated by Jean-Philippe Lang almost 6 years ago

Adam Pullen wrote:

And maybe extend the requirement by allowing custom anchor names. Would be most useful in wiki when trying to write a use guide that would produce a "pretty and informative url"

This is out of the scope of this fix but you can use h1(#anchor). to have custom anchors. This is part of the textile syntax.

#5 Updated by Adam Pullen almost 6 years ago

Thank you very much.

This will do just fine.

#6 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF