Loading...
 

BIR_B_4235_MAKETOC_breaks_ANAME

MakeTOC plugin breaks ANAME plugin - v6.7


TW Ticket

See http://dev.tiki.org/item4235

Issue Description (from TW Ticket 4235)

Although Tiki generates anchors for all headings automatically, I find using ANAME is a great way of creating manageable and easily memorable Anchors for otherwise unwieldy headings
If a heading within a tiki page is coded as follows
1. Tiki Source Code snippet
!! Fourth and Even More Forgetful Heading{ANAME()}Quick4{ANAME}
then Tiki generates the following HMTL code
2. Generated HTML snippet
<h3 class="showhide_heading" id="Fourth_and_Even_More_Forgetful_Heading">  Fourth and Even More Forgetful Heading<a id="Quick4"></a></h3>
which can be exploited by
3. Tiki Source Code snippet
{ALINK(aname=Quick4)}Link to Fourth Heading by its Quick4 Anchor{ALINK}
All the above works flawlessly.

However, add MAKETOC to the page above the source line where ANAME is last used and it breaks the ANAME anchor(s). For this example, the maketoc is restricted to level 2 headings only as {maketoc levels="2"} which makes the generated HTML a little more compact.
Tiki generates the following HTML in response to the inclusion of maketoc
Generated HTML for maketoc snippet 3
<ul><li><a href='#First_Level_Two_Heading' class='link'> First Level Two Heading</a>
</li><li><a href='#Second_Long_and_Equally_Unmemorable_Heading' class='link'> Second Long and Equally Unmemorable Heading</a>
</li><li><a href='#Third_Painfully_Difficult_Heading' class='link'> Third Painfully Difficult Heading</a>
</li><li><a href='#Fourth_and_Even_More_Forgetful_Heading' class='link'> Fourth and Even More Forgetful Heading<a id="Quick4"></a></a>
</li><li><a href='#Fifth_Long_and_Not_Very_Memorable_Heading' class='link'> Fifth Long and Not Very Memorable Heading</a>
</li></ul></li></ul><!--toc--></div><br />
Note how the entry for the Fourth Paragraph has the anchor "Quick4" associated with it. The HTML code generated for the Fourth Paragraph heading remains identical.

The effect of this is that the tiki anchor Quick4 is now incorrectly linked to the TOC entry, being the first instance of HTML ANCHOR within the HTML file.

If the MAKETOC plugin is included below the ANAME, then the ANAME works as intended, since that is the first occurrence of the generated HTML ANCHOR statement.

I have a couple of test pages which illustrate this issue, if they are of any use in your testing.

Martin


Issue History

Initial 29May2012 - Demonstrated by pages
ZZZ-MRB-Test034 shows ANAME working without issue
ZZZ-MRB-Test035 by adding MAKETOC above the ANAME, ANAME is broken
ZZZ-MRB-Test036 but adding MAKETOC below ANAME does not break the ANAME

Update xxmmmyyy -





Contributors to this page: MartinB. .
Page last modified on Tuesday 29 of May, 2012 12:51:55 CDT by MartinB..