Preserving HTML header attributes is causing side-effects.

stacysimpson - August 7, 2009 - 13:27
Project:Table of Contents
Version:6.x-3.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I have some header tags that incorporate href tag to link to the detailed version of the content. When the new TOC stuff runs, the HTML attributes are being preserved, so the TOC links do not appropriate index within the current URL.

The TOC is pointing to the inner most href:

  • Title
  • Shouldn't all href attributes be filtered out.?.? If not, can you give me some insight for where to incorporate this type of filtering locally.

    #1

    stacysimpson - August 7, 2009 - 13:29

    Whoops, here is the HTML again:

    <li class="toc-level-1"><a href="#HelloTitle"><a href="/drupal6/content/hellotitle" title="HelloTitle">HelloTitle</a></a></li>

    #2

    stacysimpson - August 7, 2009 - 16:59
    Status:active» needs review

    OK, I integrated PHP's 'strip_tags()' function in two places in the attached patch. I'm not sure if anyone would want this filtering to be configurable or not.

    AttachmentSize
    tableofcontents.pages_.inc_.diff 965 bytes

    #3

    AlexisWilke - August 8, 2009 - 00:41

    Stacy,

    I'm thinking that a strip_tags() by itself may be a bit too drastic. Should we allow all tags except <a> tags?

    That means if you have elements such as <em> and <strong> they would stay. We could also allow the user to enter the list of tags he/she wants to keep.

    Thank you for the patch!
    Alexis Wilke

    #5

    AlexisWilke - August 11, 2009 - 18:00

    Stacy,

    You have to be careful no Drupal and write &lt; when you want to include a < character. 8-)

    No time this week, but since you already have working solution for your site I suppose you can wait some time to get an official version.

    Thank you.
    Alexis

     
     

    Drupal is a registered trademark of Dries Buytaert.