You are here

function _tableofcontents_prepare in Table of Contents 6.3

Same name and namespace in other branches
  1. 7 tableofcontents.pages.inc \_tableofcontents_prepare()

Prepare the text for the table of content.

This function simply replaces the comment into a tag with square backets.

@param[in] $delta The filter number @param[in] $format The format number @param[in] $text The text to filter

1 call to _tableofcontents_prepare()
tableofcontents_filter in ./tableofcontents.module
Implementation of hook_filter().

File

./tableofcontents.pages.inc, line 869
Applies the filter functions.

Code

function _tableofcontents_prepare($delta, $format, $text) {

  // support for PEAR wiki (http://drupal.org/node/150067#comment-937519)
  $text = str_replace('[[TOC]]', '[toc]', $text);
  return preg_replace_callback(array(
    '%<!--\\s*tableofcontents([^>]*?)-->%',
    '%\\[\\[TOC(.*?)\\]\\]%',
  ), '_tableofcontents_replace_comments', $text);
}