| 1 |
= headinganchors.module =
|
| 2 |
|
| 3 |
This module takes <h2> and <h3> headings and adds id attributes to them to allow them to be linked to in a URL. The following rules are used to create an attribute:
|
| 4 |
* All non alphanumerics are removed
|
| 5 |
* Case is preserved to allow for some measure of readability
|
| 6 |
* HTML tags are stripped from in the middle of heading tags for the anchors
|
| 7 |
|
| 8 |
Example: <h2>I Link To <a href="http://www.csaonline.ca/">csaonline.ca</a></h2>
|
| 9 |
|
| 10 |
becomes:
|
| 11 |
<h2 id="ILinkTocsaonlineca">I Link To <a href="http://www.csaonline.ca/">csaonline.ca</a></h2>
|
| 12 |
and can be referenced with /<url>#ILinkTocsaonlineca
|
| 13 |
|
| 14 |
Multiple headings with the same text will be assigned id's with -#, increasing for each identical id.
|
| 15 |
|
| 16 |
This module was built from the filter example on the Drupal website.
|
| 17 |
|
| 18 |
= tableofcontents.module =
|
| 19 |
This is a module to generate a table of contents section based on <h[2-3]> tags. It currently depends on the headinganchors.module for full functionality, otherwise it will use the id's supplied by the user. For an example, see http://www.csaonline.ca/clublist.
|
| 20 |
|
| 21 |
== Installation ==
|
| 22 |
To install, place the contents of the tableofcontents directory in your modules directory. Enable headinganchors.module, and optionally, tableofcontents.module. Then, go to admin/input formats, and add each of the desired filters to your input types. Note that tableofcontents currently requires headinganchors for full functionality!
|
| 23 |
|
| 24 |
== Use ==
|
| 25 |
Simply use <!--tableofcontents--> to insert a table of contents at any point in the document.
|
| 26 |
|
| 27 |
No database tables are created. To remove the module, just disable the input formats or the module, and remove <!--tableofcontents--> if desired (however, the tag is an HTML comment so it won't show up in your rendered documents).
|
| 28 |
|
| 29 |
== Settings ==
|
| 30 |
There are a few settings which you can use to control the display of the table of contents. To use them, use the following syntax:
|
| 31 |
|
| 32 |
<!--tableofcontents option1: value1; option2: value2;...-->
|
| 33 |
|
| 34 |
Valid settings include:
|
| 35 |
title: Override the default "Table of Contents" title. This setting is piped through t() for translation.
|
| 36 |
list: Choose an ordered list (ol) or an unordered list (ul). Note that Garland doesn't seem to like nested unordered lists, and displays them flat. Defaults to an ordered list.
|
| 37 |
minlevel: The minimum heading level for table of contents entries. Defaults to <h2>
|
| 38 |
maxlevel: The maximum heading level for table of contents entries. Defaults to <h3>
|
| 39 |
|
| 40 |
--
|
| 41 |
Andrew Berry
|
| 42 |
andrewberry@sentex.net
|
| 43 |
Developed for http://www.csaonline.ca/
|
| 44 |
Project Page: http://drupal.org/project/tableofcontents
|