ExplicitNumberingPlugin
Use the
##.,
##..
etc. notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text. Also support numbered headings.
Use the
##.
,
##..
etc. notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text.
Use
---#
,
---##
,
etc., to generate numbered headings.
Use
##5.
,
##.
,
##.
to start a numbering sequence at 5
Syntax Rules
Numbered sequences
- The default outline numbering sequence uses the notation
##...
(with 1-6 dots). The notation is replaced anywhere in the topic. The level number corresponding to the number of dots increases with each use. Each time a level is used, all higher levels are reset to 0.
- Named numbering sequences can be used with the notation
##name#...
for sequence name
. Named sequences have independent numbering.
- The numbering of a sequence can be initialized or re-initialized by adding a number
n
into the tag. For example, ##name#2...
resets numbering sequence name
to 2
. The sequence is initialized from the indicated level on.
- As a concession to backwards compatibility,
0
re-initializes the sequence at all levels. This comes in handy when using a sequence within headers that are also used in a %TOC%. In that case, start the first heading using something like ---+ Chapter ##0. Introduction
. You can then safely use the number notation in headings.
- The rendering of the numbering sequence can be turned into an letter-labeled list by appending a lowercase letter to the notation:
##...a
Numbered headings
- When the
+
character in headings is replaced by #
, the headings are numbered. Heading numbers are derived from the unnamed sequence and can, therefore, be affected by the syntax above.
- Tip: Avoid unnamed sequences when using numbered headings.
- Numbering count is maintained throughout a single topic. Included topics are considered part of the topic and are numbered in sequence with the including topic.
- The maximum number of levels is 6, and using levels higher than maximum implies the last level.
- Non-consecutive increasing levels generate
0
for the skipped levels.
- Sequence numbering always starts at level 1. A missing first level will result in a
0
to indicate the skipped level.
- Non-numbered headers do not affect the numbering of numbered headings.
- The "alpha" sequence can be changed by plugin setttings.
Examples
If you have the plugin installed, the
Rendered and
Expected columns should be identical. If you do not have the plugin installed, the
Rendered column will be the same as the
Source column.
Source |
Rendered |
Expected |
##. |
##. |
1 |
##.. |
##.. |
1.1 |
##... |
##... |
1.1.1 |
##.... |
##.... |
1.1.1.1 |
##..... |
##..... |
1.1.1.1.1 |
##...... |
##...... |
1.1.1.1.1.1 |
##....... |
##....... |
1.1.1.1.1.2 |
Chapter ##a#. |
Chapter ##a#. |
Chapter 1 |
Section ##a#.. |
Section ##a#.. |
Section 1.1 |
Subsection ##a#... |
Subsection ##a#... |
Subsection 1.1.1 |
Req ##a#....: |
Req ##a#....: |
Req 1.1.1.1: |
Req ##a#....: |
Req ##a#....: |
Req 1.1.1.2: |
Subsection ##a#... |
Subsection ##a#... |
Subsection 1.1.2 |
Req ##a#....: |
Req ##a#....: |
Req 1.1.2.1: |
Req ##a#....: |
Req ##a#....: |
Req 1.1.2.2: |
##a#....a) |
##a#....a) |
a) |
##a#....a) |
##a#....a) |
b) |
##a#....a) |
##a#....a) |
c) |
##A#....A) |
##A#....A) |
A) |
##A#....A) |
##A#....A) |
B) |
##A#....A) |
##A#....A) |
C) |
Req ##a#....: |
Req ##a#....: |
Req 1.1.2.3: |
Section ##a#.. |
Section ##a#.. |
Section 1.2 |
Chapter ##a#. |
Chapter ##a#. |
Chapter 2 |
Section ##a#.. |
Section ##a#.. |
Section 2.1 |
Section ##a#.. |
Section ##a#.. |
Section 2.2 |
Numbered heading examples
Reset anonymous numbering to ##0. using =##0.
Write | If Installed | You should see |
---# Heading level 1 |
Heading
|
1 Heading
|
---## Next level |
Next level
|
1.1 Next level
|
---### And another |
And another
|
1.1.1 And another
|
---++# Single numbered |
Single numbered
|
2 Single numbered
|
ExplicitNumberingPlugin Global Settings
Plugin settings are stored as preferences settings. To retrieve a preference setting write it as a Foswiki Macro:
%<plugin>_ <setting>%
, i.e.
%EXPLICITNUMBERINGPLUGIN_SHORTDESCRIPTION%
Note: This plugin does not obtain preference settings from this topic. Settings should be entered in the
SitePreferences or Web Preferences topic. The following settings can be used.
- Bold font the numbering sequence. If this setting is enabled, the numbers are rendered in a bold font.
* #Set EXPLICITNUMBERINGPLUGIN_BOLD = 1
- Alternate collating sequence for letter headings. This is a commma-separated list of "letters" used in alpha headings. They should be entered as lower-case letters. The plugin will convert to upper-case as needed. The example below shows the default sequence, a reversed sequence, and a Greek letter sequence. The plugin will "wrap" back to the beginning of the sequence if it is exceeded.
* #Set EXPLICITNUMBERINGPLUGIN_ALPHASEQ = a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
* #Set EXPLICITNUMBERINGPLUGIN_ALPHASEQ = z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c,b,a
* #Set EXPLICITNUMBERINGPLUGIN_ALPHASEQ = α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ
- Debug plugin: (See output in
data/debug.txt
) This plugin provides minimal debugging information
* #Set EXPLICITNUMBERINGPLUGIN_DEBUG = 1
See also
The
Foswiki:Extensions.TocPlugin provides a more complete table of contents and cross-reference management.
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button.
Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will
not show up in the
search results.
You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Change History
Related Topics: DefaultPreferences,
SitePreferences,
Plugins