/redmine_wiki_toc

forked from git://git.academ.org/redmine_wiki_toc.git

Primary LanguageRuby

Redmine Table-Of-Contents plug-in

This plug-in allows to order Wiki pages and adds a macro to display the table of contents of Wiki pages in the specified order. Also it changes the way links to Wiki pages displayed by adding a number like “1.1.2.” to the title of the page.

Compatibility

This plug-in is compatible with Redmine 1.4.x, 2.0.x, 2.1.x

Installation And Configuration

From a ZIP file:

  • Download the latest version of the plugin

  • Unzip to /plugins (Redmine 2.x) or /vendor/plugins (Redmine 1.x) folder of Redmine

From a GIT repository:

  • Clone repository with git clone git://git.academ.org/redmine_wiki_toc.git plugins/redmine_wiki_toc command

Patch Redmine (optional):

  • Use wiki_links_with_pretty_title.patch to force Redmine to use formatted title for Wiki links (so the [[Wiki TOC plug-in]] transforms to “1.1.2. Wiki TOC plug-in”). This is a tiny patch, it should not break anything.

After download:

  1. Run rake redmine:plugins:migrate (Redmine 2.x) or rake db:migrate:plugins (Redmine 1.x).

  2. Restart Redmine.

  3. Enable “Table of contents of Wiki” module for projects you need.

  4. Setup permissions for roles

Available permissions:

  • Reorder wiki pages

  • View table of contents of Wiki – enable it if you have “View wiki pages” permission enabled

Macro {{wiki_toc}} usage

Displays a table of contents of Wiki pages. It works like {{child_pages}} macro, but shows pages in the order specified by the user. With no argument, it displays the child pages of the current wiki page. Examples:

  • {{wiki_toc}} – can be used from a wiki page only

  • {{wiki_toc(Foo)}} – lists all children of page Foo

  • {{wiki_toc(Foo, parent=1)}} – shows a higher level of the page hierarchy including Foo and all Foo’s children

  • {{wiki_toc(Foo, depth=1)}} – lists all children of page Foo down to specified depth

  • {{wiki_toc(reorder=1)}} – shows reorder links

  • {{wiki_toc(highlight=1)}} – highlight current or specified page

  • {{wiki_toc(header=Table of contents)}} – shows header with a link to the table of contents

  • {{wiki_toc(root=1)}} – shows entire page hierarchy from root

This macro has a special behavior when added to the sidebar. It follows Wiki pages you are currently viewing. There is simple recipe for adding table of contents to sidebar: # Create a Wiki page with the name Sidebar, if it is not created yet. # Clear the default page content. # Copy & paste: {{wiki_toc(header=Table of contents, highlight=1, parent=1, depth=1)

A header (<h3>) generated by the macro is +a link+ to the table of contents.

It displays a link to the table of contents with the title specified in the argument. Example: {{toc_link(Go to the table of contents)}}

Macro {{title}} usage

It adds a formatted (i.e. prefixed with a number like “4.3.”) Wiki title to the page.

Ordering Wiki pages

Click a link, generated by {{wiki_toc}} or {{toc_link}} macros, and you will end up with the page where you can order pages (if you have appropriate permissions). Click the arrows to move the page higher, lower, to the top or to the bottom of the section (among the children of the parent page). If you need to move the page to another section (change the parent), open it and then click Rename button.

Changelog

0.0.4

Added option to disable numeric prefix for specific pages

0.0.3

Fixed bugs, added Chinese translation

0.0.2

Compatibility with Redmine 1.4.x, 2.0.x

0.0.1

Initial commit