You are here

constant TABLEOFCONTENTS_REMOVE_PATTERN in Table of Contents 7

Same name and namespace in other branches
  1. 6.3 tableofcontents.module \TABLEOFCONTENTS_REMOVE_PATTERN
  2. 7.2 tableofcontents.module \TABLEOFCONTENTS_REMOVE_PATTERN

@file This is a filter module to generate a collapsible jquery enabled mediawiki style table of contents based on <h[1-6]> tags. Transforms header tags into named anchors.

It is a complete rewrite of the original non-jquery enabled tableofcontents filter module as follows: +added jquery to make ToC collapsible +preserves attributes on the header tags +checks for existing ID on headers and uses that if found (if none, creates one) +extends the minimum header level to 1 +header conversion is case insensitive +made the regex match for options on the <!--tableofcontents--> marker tolerant of spaces +replaced the comment with [tag ...] +added a more explanatory error message for invalid options & concatenated it into one string to prevent duplicates from being displayed +added several divs to make ToC themable via CSS +provided basic CSS

2 uses of TABLEOFCONTENTS_REMOVE_PATTERN
tableofcontents_node_view in ./tableofcontents.module
Implementation of hook_node_view
_tableofcontents_replace_toc in ./tableofcontents.pages.inc
This function replaces the table of contents.

File

./tableofcontents.module, line 25
This is a filter module to generate a collapsible jquery enabled mediawiki style table of contents based on <h[1-6]> tags. Transforms header tags into named anchors.

Code

define('TABLEOFCONTENTS_REMOVE_PATTERN', '/(?:<p(?:\\s[^>]*)?' . '>)?\\[toc(?:\\s[^]]*?)?\\](?:<\\/p\\s*>)?/');