diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index 6c1714ad..25e7b685 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -61,6 +61,7 @@ module Gollum yield doc if block_given? data = doc.to_html + data = process_toc_tags(data) data = process_tex(data) data = process_wsd(data) data.gsub!(/
<\/p>/, '') @@ -201,7 +202,9 @@ module Gollum # # Returns the String HTML version of the tag. def process_tag(tag) - if html = process_image_tag(tag) + if tag =~ /^_TOC_$/ + %{[[#{tag}]]} + elsif html = process_image_tag(tag) html elsif html = process_file_link_tag(tag) html @@ -358,6 +361,17 @@ module Gollum end end + + # Process the special table of contents tag [[_TOC_]] + # + # data - The String data (with placeholders). + # + # Returns the marked up String data. + def process_toc_tags(data) + data.gsub!("[[_TOC_]]", @toc.nil? ? '' : @toc.to_html) + data + end + # Find the given file in the repo. # # name - The String absolute or relative path of the file.