Project

General

Profile

Actions

Defect #8194

closed

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

Added by Philippe De Ryck almost 13 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Category:
Wiki
Target version:
Start date:
2011-04-20
Due date:
% Done:

0%

Estimated time:
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

Actions #1

Updated by Etienne Massip almost 13 years ago

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

Anchor name could be preppend with parent title anchor.

Actions #2

Updated by Adam Pullen about 12 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...

Actions #3

Updated by Jean-Philippe Lang about 12 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).

Actions #4

Updated by Jean-Philippe Lang about 12 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.

Actions #5

Updated by Adam Pullen about 12 years ago

Thank you very much.

This will do just fine.

Actions #6

Updated by Jean-Philippe Lang about 12 years ago

  • Status changed from Resolved to Closed

Merged.

Actions

Also available in: Atom PDF