You are here

constant TABLEOFCONTENTS_REMOVE_PATTERN in Table of Contents 7.2

Same name and namespace in other branches
  1. 6.3 tableofcontents.module \TABLEOFCONTENTS_REMOVE_PATTERN
  2. 7 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

3 uses of TABLEOFCONTENTS_REMOVE_PATTERN
tableofcontents_field_attach_view_alter in ./tableofcontents.module
Implementation of hook_field_attach_view_alter(&$output, $context)
_tableofcontents_filter_process in ./tableofcontents.filters.inc
Process the text for the table of content.
_tableofcontents_process_text in ./tableofcontents.module
Developer function to apply TOC to any text $body has two assumptions for this function to work 1. It must have [toc] located somewhere in the text 2. It has already been processed by an input filter with toc enabled

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*>)?/');