Diff: Help/CreateTocPlugin

Note: You are viewing an old revision of this page. View the current version.

Differences between version 4 and previous revision of Help/CreateTocPlugin.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 4 Last edited on 22 May 2014 3:01 by harold Revert
Older page: version 3 Last edited on 9 September 2007 0:16 by harold Revert
@@ -1,34 +1,141 @@
-<?plugin CreateToc jshide ||=1 ?>  
+The **~ CreateToc** [[Help:WikiPlugin |plugin]] allows to create a dynamical **Table of Contents** of all headers. It also allows to number the headers in the page.  
  
-Help:WikiPlugin to create a dynamical *Table Of Contents* of all headers. Since v1.3.8  
+The headers might be in classic Phpwiki syntax or in Wikicreole/Mediawiki syntax (see below)
  
-!! Usage  
-<verbatim>  
- <?plugin CreateToc ?>  
- <?plugin CreateToc jshide||=1 with_toclink||=1 ?>  
-</verbatim>  
+The Table of Contents can easily be inserted by clicking on the TOC button in the Edit toolbar.  
  
-!! Plugin Arguments  
-__jshide__: |  
- Boolean if the TOC should be initially hidden and on click expanded. Default: 0  
-__with_toclink__: |  
- Boolean if headers should link back to the TOC. Default: false  
-__with_counter__: |  
- Boolean if hierarchical prefixes should be added. Default: false  
-__headers__: |  
- Which headers to include. Default: !!!,!!,! 1,2,3 also allowed  
-__noheader__: |  
- Boolean if the "Table of Contents" h2 header should be omitted. Default: 0  
-__liststyle__: |  
- dl or ol or ul. Default: dl  
-__indentstr__: |  
- Default: &nbsp;&nbsp;  
-__pagename__: |  
- TOC of which page? Default: current pagename  
+== Usage ==  
+{{{  
+<<CreateToc arguments>>  
+}}}  
  
-!! Examples  
+== Arguments ==  
  
-See for example PhpWikiDemo :en /TextFormattingRules  
--------------  
+{| class="bordered"  
+|-  
+! Argument  
+! Description  
+! Default value  
+|-  
+| **extracollapse**  
+| Provide a button to hide/display the Table of Contents  
+| true  
+|-  
+| **firstlevelstyle**  
+| Style of first level numbering : //number//, //letter// or //roman//.  
+| number  
+| -  
+| **headers**  
+| Which headers to include. See below.  
+| 1,2,3,4,5  
+| -  
+| **indentstr**  
+| Indent string.  
+| &nbsp;&nbsp;  
+| -  
+| **jshide**  
+| Boolean if the Table of Contents should be initially hidden and on click expanded.  
+| false  
+| -  
+| **liststyle**  
+| List style: //dl// or //ol// or //ul//. Using //ol// is equivalent to //with_counter=1//.  
+| dl  
+| -  
+| **noheader**  
+| Boolean if the Table of Contents header should be omitted.  
+| false  
+| -  
+| **notoc**  
+| Boolean if the Table of Contents should no be displayed (headers are numbered).  
+| false  
+| -  
+| **pagename**  
+| Table of Contents of which page?  
+| current pagename  
+| -  
+| **position**  
+| Where to display the Table of Contents: //full//, //left// or //right//.  
+| full  
+| -  
+| **version**  
+| Page version  
+| most recent version  
+| -  
+| **width**  
+| Width of Table of Contents (if position is //left// or //right//)  
+| 200px  
+| -  
+| **with_counter**  
+| Boolean if hierarchical prefixes should be added.  
+| false  
+| -  
+| **with_toclink**  
+| Boolean if headers should link back to the Table of Contents.  
+| false  
+|}  
  
-PhpWikiDocumentation Help:WikiPlugin  
+=== Headers ===  
+  
+Syntax: a comma-separated list of levels. !!!,!!,! also allowed  
+  
+{| class="bordered"  
+|-  
+! Level  
+! Phpwiki syntax  
+! Wikicreole/Mediawiki syntax  
+! HTML rendering  
+|-  
+| 1 || ~!~!~! || ~=~= || h2  
+|-  
+| 2 || ~!~! || ~=~=~= || h3  
+|-  
+| 3 || ~! || ~=~=~=~= || h4  
+|-  
+| 4 || //None// || ~=~=~=~=~= || h5  
+|-  
+| 5 || //None// || ~=~=~=~=~=~= || h6  
+|}  
+  
+== Examples ==  
+  
+=== Default values ===  
+{{{  
+<<CreateToc>>  
+}}}  
+  
+=== Only two levels of headers ===  
+{{{  
+<<CreateToc headers=1,2>>  
+}}}  
+  
+=== Table of Contents with hierarchical numbering ===  
+{{{  
+<<CreateToc with_counter=1>>  
+}}}  
+  
+=== No Table of Contents, but headers are numbered ===  
+{{{  
+<<CreateToc notoc=1>>  
+}}}  
+  
+=== Table of Contents with hierarchical numbering, first level in roman ===  
+{{{  
+<<CreateToc with_counter=1 firstlevelstyle=roman>>  
+}}}  
+  
+== See Also ==  
+* [[PhpWikiDemo:en/TextFormattingRules]]  
+  
+== Known Problems ==  
+  
+* If you include pages via [[ Help:TemplatePlugin|Template]] or [[Help:IncludePagePlugin|IncludePage]] plugins, the Table of Contents will not contain the headers of the included pages.  
+* The Table of Contents will be incorrect if a header contains:  
+** a [[Help:TemplatePlugin|Template]] plugin call via ~{~{ ~}~},  
+** an image,  
+** or a ~~.  
+* If you preview the page, the Table of Contents will not be correct if you modified headers. The Table of Contents will be taken from the last saved revision.  
+  
+<noinclude>  
+----  
+[[PhpWikiDocumentation]] [[CategoryWikiPlugin]]  
+</noinclude>  

version 4

The CreateToc plugin allows to create a dynamical Table of Contents of all headers. It also allows to number the headers in the page.

The headers might be in classic Phpwiki syntax or in Wikicreole/Mediawiki syntax (see below).

The Table of Contents can easily be inserted by clicking on the TOC button in the Edit toolbar.

Usage

<<CreateToc arguments>>

Arguments

Argument

Description

Default value

extracollapse

Provide a button to hide/display the Table of Contents

true

firstlevelstyle

Style of first level numbering: number, letter or roman.

number

headers

Which headers to include. See below.

1,2,3,4,5

indentstr

Indent string.

&nbsp;&nbsp;

jshide

Boolean if the Table of Contents should be initially hidden and on click expanded.

false

liststyle

List style: dl or ol or ul. Using ol is equivalent to with_counter=1.

dl

noheader

Boolean if the Table of Contents header should be omitted.

false

notoc

Boolean if the Table of Contents should no be displayed (headers are numbered).

false

pagename

Table of Contents of which page?

current pagename

position

Where to display the Table of Contents: full, left or right.

full

version

Page version

most recent version

width

Width of Table of Contents (if position is left or right)

200px

with_counter

Boolean if hierarchical prefixes should be added.

false

with_toclink

Boolean if headers should link back to the Table of Contents.

false

Headers

Syntax: a comma-separated list of levels. !!!,!!,! also allowed

Level

Phpwiki syntax

Wikicreole/Mediawiki syntax

HTML rendering

1

!!!

==

h2

2

!!

===

h3

3

!

====

h4

4

None

=====

h5

5

None

======

h6

Examples

Default values

<<CreateToc>>

Only two levels of headers

<<CreateToc headers=1,2>>

Table of Contents with hierarchical numbering

<<CreateToc with_counter=1>>

No Table of Contents, but headers are numbered

<<CreateToc notoc=1>>

Table of Contents with hierarchical numbering, first level in roman

<<CreateToc with_counter=1 firstlevelstyle=roman>>

See Also

Known Problems

  • If you include pages via Template or IncludePage plugins, the Table of Contents will not contain the headers of the included pages.
  • The Table of Contents will be incorrect if a header contains:

    • a Template plugin call via {{ }},
    • an image,
    • or a ~.
  • If you preview the page, the Table of Contents will not be correct if you modified headers. The Table of Contents will be taken from the last saved revision.