You are here

function _tableofcontents_prepare in Table of Contents 7

Same name and namespace in other branches
  1. 6.3 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.

Parameters

$delta The filter number:

$format The format number:

$text The text to filter:

1 string reference to '_tableofcontents_prepare'
tableofcontents_filter_info in ./tableofcontents.module
Implementation of hook_filter_info().

File

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

Code

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

  // 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);
}