Defect #5445 » formatter.rb.diff
| lib/redmine/wiki_formatting/textile/formatter.rb (working copy) | ||
|---|---|---|
|
|
||
|
# Patch to add 'table of content' support to RedCloth
|
||
|
def textile_p_withtoc(tag, atts, cite, content)
|
||
|
# removes wiki links from the item
|
||
|
toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 }
|
||
|
# removes wiki links and textile links from the item
|
||
|
toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 }.gsub(LINK_RE) { $4 }
|
||
|
# removes styles
|
||
|
# eg. %{color:red}Triggers% => Triggers
|
||
|
toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1'
|
||