wiki:NumberedHeadlinesPlugin

Add numbering to headings

Description

This plugin provides a new TracWiki syntax for numbered headlines (h1-h6 HTML tags). This manual is for Trac version 0.3 from Oct 2009.

The new wiki syntax for numbered headlines is as follows:

Instead of:
== Unnumbered Headline ==
or
== Unnumbered Headline ==#ownID

write:
## Numbered Headline ##
or
## Numbered Headline ##=ownID

You can mix both unnumbered and numbered headlines on the same wiki page. Headlines from first order (1x# on each side) to sixth order (6x# on each side) are supported. An own ID can be given by adding =idname, of which idname should be a valid XHTML name.

Normal Usage

The following wiki text:

= Introduction =

# Chapter 1 #
## Section 1.1 ##
### Subsection 1.1.1 ###
### Subsection 1.1.2 ###
## Section 1.2 ##
### Subsection 1.2.1 ###

=== Unnumbered ===

### Subsection 1.2.2 ###
# Chapter 2 #
## Section 2.1 ##
### SubSubsection 2.1.1 ###
#### SubSubsection 2.1.1.1 ####
##### Paragraph 2.1.1.1.1 #####
###### Subparagraph 2.1.1.1.1 ######

will be displayed like this:

Introduction

1. Chapter 1

1.1. Section 1.1

1.1.1. Subsection 1.1.1

1.1.2. Subsection 1.1.2

1.2. Section 1.2

1.2.1. Subsection 1.2.1

Unnumbered

1.2.2. Subsection 1.2.2

2. Chapter 2

2.1. Section 2.1

2.1.1. SubSubsection 2.1.1

2.1.1.1. SubSubsection 2.1.1.1

2.1.1.1.1. Paragraph 2.1.1.1.1
2.1.1.1.1.1 Subparagraph 2.1.1.1.1.1

However with the config options numbering_starts_at_level_two = true it will be displayed without the first level numbers:

Introduction

Chapter 1

1. Section 1.1

1.1. Subsection 1.1.1

1.2. Subsection 1.1.2

2. Section 1.2

2.1. Subsection 1.2.1

Unnumbered

2.2. Subsection 1.2.2

Chapter 2

1. Section 2.1

1.1. SubSubsection 2.1.1

1.1.1. SubSubsection 2.1.1.1

1.1.1.1. Paragraph 2.1.1.1.1
1.1.1.1.1 Subparagraph 2.1.1.1.1.1

User Specified Numbers - example 1

Since v0.2.1 leading zeros are ignored, which allows the use of numbered sections under an unnumbered chapter. This feature relates to ticket #4907.

= Title =
## Section ##
## Section ##

is now displayed as:

Title

1. Section

2. Section

User Specified Numbers - example 2

Since v0.3 the numbers can be provided by the user to set or reset the counting. The numbers are simply written before the headline text followed by a space.

Single numbers set the value of the current level, while multiple numbers (1.2.3.) set the values from the current level upwards. Leading numbers as part of the headline text can be protected by using a dot followed by a space (. ) before them, for example ## . 99 Red Balloons ##. This feature relates to ticket #4907.

# First Chapter #
## First Section ##
## 5. Now Section Five  ##
## Next Section ##
## 2.5. Now Section Five in Chapter 2 ##
## Next Section ##

# Next Chapter #
## Section ##

will lead to the following:

1. First Chapter

1.1. First Section

1.5. Now Section Five

1.6. Next Section

2.5. Now Section Five in Chapter 2

2.6. Next Section

3. Next Chapter

3.1. Section

Headlines without text but with a number will not be displayed at all, ie no HTML code generated, but the number is used as normal. This gives the user the possibility to change higher level heading numbers for following lower level headline without inserting empty headlines. Please note that for technical reasons there needs to be a space after the number and another one before the leading #, which makes two leading spaces:

# 1.  #
## Section ##
# 2.  #
## Section ##

will be displayed as:

1.1. Section

2.1. Section

Bugs/Feature Requests

Existing bugs and feature requests for NumberedHeadlinesPlugin are here.

If you have any issues, create a new ticket.

defect

3 / 5

enhancement

2 / 4

task

0 / 1

Download

Download the zipped source from here.

The plugin is also available on PyPI.

Source

You can check out NumberedHeadlinesPlugin from here using Subversion, or browse the source with Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Configuration

To enable this plugin put the following into your trac.ini configuration file:

[components]
tracnumberedheadlines.* = enabled

The following options can be added to select if:

  • headlines in outlines (PageOutline, TocMacro) should be numbered (#4521, #5241)
  • numbering should start at the second level (##/h2) not at the first level (#4907)

Example where default values are shown:

[numberedheadlines]
numbered_outline = true
numbering_starts_at_level_two = false

Recent Changes

17125 by rjollos on 2018-04-14 09:09:35
TracNumberedHeadlinesPlugin 0.5: Conform to PEP8
15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

10976 by rjollos on 2011-12-01 10:26:01
Added plugin revision info to webadmin page.
(more)

Author/Contributors

Author: martin_s
Maintainer: Martin Scharrer
Contributors: JoshuaH (Page Outline support, see #4521)

Last modified 7 years ago Last modified on Apr 14, 2018, 9:59:53 PM