Version 43 (modified by osimons, 13 years ago) (diff)

It's 0.12 compatible.

Table of Contents

  1. The Trac User and Administration Guide
    1. Introduction
    2. User Guide
    3. Administrator Guide
    4. Support and Other Sources of Information
  2. Trac Installation Guide for 1.2
    1. Dependencies
      1. Mandatory Dependencies
        1. For the SQLite database
        2. For the PostgreSQL database
        3. For the MySQL database
      2. Optional Dependencies
        1. Subversion
        2. Git
        3. Other Version Control Systems
        4. Web Server
        5. Other Python Packages
    2. Installing Trac
      1. Using easy_install
      2. Using pip
      3. From source
      4. Using installer
      5. Using package manager
      6. Advanced easy_install Options
    3. Creating a Project Environment
    4. Deploying Trac
      1. Running the Standalone Server
      2. Running Trac on a Web Server
        1. Generating the Trac cgi-bin directory
        2. Mapping Static Resources
          1. Example: Apache and ScriptAlias
        3. Setting up the Plugin Cache
    5. Configuring Authentication
    6. Granting admin rights to the admin user
    7. Configuring Trac
    8. Using Trac
  3. Upgrade Instructions
    1. Instructions
      1. 1. Bring your server off-line
      2. 2. Update the Trac Code
      3. 3. Upgrade the Trac Environment
      4. 4. Update the Trac Documentation
      5. 5. Refresh static resources
      6. 6. Steps specific to a given Trac version
        1. Upgrading from Trac 1.0 to 1.2
          1. Python 2.5 no longer supported
          2. Obsolete Plugins
          3. New workflow actions
          4. New permissions policy for read-only wiki pages
          5. Navigation Ordering Moved
        2. Upgrading from Trac 0.12 to Trac 1.0
          1. Python 2.4 no longer supported
          2. Obsolete Plugins
          3. Subversion components not enabled by default for new installations
          4. Attachments migrated to new location
          5. Behavior of [ticket] default_owner changed
        3. Upgrading from Trac 0.11 to Trac 0.12
          1. Python 2.3 no longer supported
          2. SQLite v3.x required
          3. PySqlite 2 required
          4. Obsolete Plugins
          5. Multiple Repository Support
          6. Resynchronize the Trac Environment Against the Source Code Repository
          7. Improved repository synchronization
          8. Authz permission checking
          9. Microsecond timestamps
        4. Upgrading from Trac 0.10 to Trac 0.11
          1. Site Templates and Styles
          2. Trac Macros, Plugins
          3. For FCGI/WSGI/CGI users
          4. Web Admin plugin integrated
          5. New Default Configurable Workflow
      7. 7. Restart the Web Server
    2. Known Issues
      1. Customized Templates
      2. ZipImportError
      3. Wiki Upgrade
      4. Trac database upgrade
      5. Parent dir
    3. Related topics
      1. Upgrading Python
        1. Windows and Python 2.6
      2. Changing Database Backend
      3. Upgrading from older versions of Trac
  4. The Trac Configuration File
    1. Global Configuration
    2. Reference for settings
    3. Configure Error Reporting
  5. TracAdmin
    1. Usage
      1. trac-admin <targetdir> initenv
    2. Interactive Mode
    3. Full Command Reference
  6. Trac Backup
    1. Creating a Backup
    2. Restoring a Backup
  7. Trac Logging
    1. Supported Logging Methods
    2. Log Levels
    3. Log Format
  8. Trac Permissions
    1. Graphical Admin Tab
    2. Available Privileges
      1. Repository Browser
      2. Ticket System
      3. Roadmap
      4. Reports
      5. Wiki System
      6. Permissions
      7. Others
    3. Granting Privileges
    4. Permission Groups
    5. Adding a New Group and Permissions
    6. Removing Permissions
    7. Creating New Privileges
    8. Default Permissions
  9. The Trac Wiki System
  10. WikiFormatting
    1. Common wiki markup
    2. Font Styles
    3. Headings
    4. Paragraphs
    5. Lists
    6. Definition Lists
    7. Preformatted Text
    8. Blockquotes
    9. Discussion Citations
    10. Tables
      1. Simple Tables
      2. Complex Tables
    11. Links
    12. Trac Links
    13. Setting Anchors
    14. Escaping Links, WikiPageNames and other Markup
    15. Images
    16. Macros
    17. Processors
    19. Miscellaneous
  11. The Trac Repository Browser
  12. The Trac Roadmap
    1. The Roadmap View
    2. The Milestone View
    3. Roadmap Administration
    4. iCalendar Support
  13. Trac Changeset Module
    1. Changeset Header
    2. Diff Views
    3. The Different Ways to Get a Diff
      1. Examining a Changeset
      2. Downloading a Changeset
      3. Examining Differences Between Revisions
      4. Examining Differences Between Branches
      5. Checking the Last Change
  14. The Trac Ticket System
    1. Ticket Fields
    2. Changing and Commenting Tickets
    3. Default Values for Drop-Down Fields
    4. Hiding Fields and Adding Custom Fields
    5. Assign-to as Drop-Down List
    6. Preset Values for New Tickets
    7. Deleting Tickets
  15. Trac Reports
    1. Changing Sort Order
    2. Navigating Tickets
    3. Alternate Download Formats
      1. Comma-delimited - CSV (Comma Separated Values)
      2. Tab-delimited
      3. RSS - XML Content Syndication
    4. Creating Custom Reports
    5. Ticket columns
    6. Advanced Reports: Dynamic Variables
      1. Using Variables in a Query
      2. Special/Constant Variables
    7. Advanced Reports: Custom Formatting
      1. Special Columns
      2. Automatically formatted columns
      3. Custom formatting columns
      4. Changing layout of report rows
      5. Reporting on custom fields
      6. A note about SQL rewriting
    8. Changing Report Numbering
  16. Trac Ticket Queries
    1. Filters
    2. Navigating Tickets
    3. Saving Queries
    4. TracLinks to Queries
    5. Query Language
  17. The Trac Timeline
    1. RSS Support
  18. Using RSS with Trac
    1. How to access RSS data
    2. Links
  19. Email Notification of Ticket Changes
    1. Receiving Notification Mails
      1. How to use your username to receive notification mails
      2. Ticket attachment notifications
    2. Configuring SMTP Notification
      1. Configuration Options
      2. Example Configuration (SMTP)
      3. Example Configuration (sendmail)
      4. Subscriber Configuration
      5. Example Configuration (default subscriptions)
      6. Customizing the email subject
      7. Customizing the email content
    3. Sample Email
    4. Using GMail as the SMTP relay host
    5. Troubleshooting
      1. Permission denied error
      2. Suspected spam error

Table of Contents Macro

Notice: This plugin is unmaintained and available for adoption.


The TocMacro generates a table of contents for the current page or a set of pages.

If no arguments are given, a table of contents is generated for the current page, with the top-level title stripped:


To generate a table of contents for a set of pages, simply pass them as comma separated arguments to the TOC macro. This is the macro call for the table of contents visible on the right side of this page:

[[TOC(TracGuide, TracInstall, TracUpgrade, TracIni, TracAdmin, TracBackup, TracLogging,
TracPermissions, TracWiki, WikiFormatting, TracBrowser, TracRoadmap, TracChangeset,
TracTickets, TracReports, TracQuery, TracTimeline, TracRss, TracNotification)]]

A wildcard '*' can be used to fetch a sorted list of all pages starting with the preceding pagename stub (Since [2801]):

[[TOC(Trac*, WikiFormatting, WikiMacros)]]

For 'titleindex' argument, an empty pagelist will evaluate to all pages (Since [2801]):

[[TOC(titleindex, notitle, heading=All pages)]]

'sectionindex' allows to generate a title index for all pages in a given section of the wiki. A section is defined by wiki page name, using '/' as a section level delimiter (like directories in a file system). Giving '/' or '*' as the page name produces the same result as 'titleindex' (title of all pages). If a page name ends with a '/', only children of this page will be processed. Else the page given in the argument is also included, if it exists. For 'sectionindex' argument, an empty pagelist will evaluate to all page below the same parent as the current page:

[[TOC(sectionindex, notitle, heading=This section pages)]]

The following control arguments change the default behaviour of the TOC macro (Since [22]):

Argument Meaning
heading=<x> Override the default heading of "Table of Contents" or "Page Index" for titleindex.
noheading Suppress display of the heading.
depth=<n> Display headings of subsequent pages to a maximum depth of <n>.
inline Display TOC inline rather than as a side-bar.
sectionindex Only display the page name and title of each page for all pages in a given section. (Since [3417]).
titleindex Only display the page name and title of each page, similar to TitleIndex. (Since [37]).
notitle Supress display of page title (Since [2801]).

Bugs/Feature Requests

Existing bugs and feature requests are here. If you have any issues, create a new ticket.


Both 0.10 and 0.11/0.12 entries at Python Package Index (pypi) are not up-to-date with latest versions and dependencies. To install the most recent versions, use direct installation from source:

easy_install   # 0.10
easy_install   # 0.11 and 0.12

...or download / check out the source from repository (see below) and install it in usual manner.

Do not forget to enable the macro in trac.ini:

tractoc.* = enabled


Download the zipped source from [download:tocmacro here].

TocMacro requires that AnchorPatch be applied to 0.8? Trac. Trac 0.9? already includes this patch.


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


[[TOC(inline, heading=Trac Table of Contents, TracGuide, TracInstall, depth=2,
 TracLogging, depth=99, TracPermissions)]]

On the right you can see the TOC macro version of the default TracGuideToc macro.


Trac 0.12 (maybe earlier?) has the PageOutline macro built-in which can produce output identical to the simpler use cases for the TOC macro. For example, this is equivalent to the no-argument form of TOC:

[[PageOutline(2-5, Table of Contents, floated)]]

Change Log

18149 by Cinc-th on 2021-04-04 17:40:01
TocMacro: Python3 fixes: replaced unicode() with to_unicode(). Removed obsolete sorted() compatibility import which is gone in Trac 1.5.

Testing indicates this macro works at least with 1.2/1.4/1.6.

16590 by rjollos on 2017-05-16 02:51:58
TocMacro Add option to disable numbering for inline TOC

Fixes #6907.

16416 by rjollos on 2017-03-27 23:36:23 Add from parameter for reading page list from another page

Based on patch by Adriaan de Groot.

Refs #12197.



Authors: athomas, jouvin, coderanger, cboos, osimons
Maintainer: osimons