Merge pull request #343 from kristi/toc

Table of contents feature
This commit is contained in:
Kristi
2012-05-22 13:14:25 -07:00
37 changed files with 293 additions and 40 deletions
+17
View File
@@ -289,6 +289,22 @@ wiki page, simply preface the link with a single quote (like in LISP):
This is useful for writing about the link syntax in your wiki pages.
## TABLE OF CONTENTS
Gollum has a special tag to insert a table of contents (new in v2.1)
'[[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted
into the `_Header`, `_Footer` or `_Sidebar` files too.
There is also a wiki option `:universal_toc` which will display a
table of contents at the top of all your wiki pages if it is enabled.
The `:universal_toc` is not enabled by default. To set the option,
add the option to the `:wiki_options` hash before starting the
frontend app:
Precious::App.set(:wiki_options, {:universal_toc => true})
## SYNTAX HIGHLIGHTING
@@ -471,6 +487,7 @@ like Rack::Auth, OmniAuth, etc.
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:universal_toc => false})
run Precious::App
## Windows Filename Validation
+19 -5
View File
@@ -8,6 +8,17 @@ require 'gollum/frontend/views/editable'
require File.expand_path '../uri_encode_component', __FILE__
# Run the frontend, based on Sinatra
#
# There are a number of wiki options that can be set for the frontend
#
# Example
# require 'gollum/frontend/app'
# Precious::App.set(:wiki_options, {
# :universal_toc => false,
# }
#
# See the wiki.rb file for more details on wiki options
module Precious
class App < Sinatra::Base
register Mustache::Sinatra
@@ -122,10 +133,11 @@ module Precious
end
post '/preview' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
@name = "Preview"
@page = wiki.preview_page(@name, params[:content], params[:format])
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@editable = false
mustache :page
end
@@ -220,8 +232,10 @@ module Precious
if page = wiki.page(name)
@page = page
@name = name
@content = page.formatted_data
@editable = true
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
mustache :page
elsif file = wiki.file(name)
content_type file.mime_type
@@ -75,6 +75,7 @@ a:hover, a:visited {
#wiki-body {
display: block;
float: left;
clear: left;
margin-right: 3%;
margin-bottom: 40px;
width: 100%;
@@ -84,6 +85,24 @@ a:hover, a:visited {
width: 68%;
}
/* @section toc */
#wiki-toc-main {
background-color: #F7F7F7;
border: 1px solid #DDD;
font-size: 13px;
padding: 0px 5px;
float:left;
margin-bottom: 20px;
min-width: 33%;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
}
#wiki-toc-main > div {
border: none;
}
/* @section rightbar */
#wiki-rightbar {
background-color: #f7f7f7;
@@ -145,6 +164,7 @@ a:hover, a:visited {
#wiki-header #header-content {
margin-bottom: 1.5em;
}
#wiki-footer #footer-content {
margin-top: 1.5em;
}
@@ -30,6 +30,11 @@ a.absent {
color: #c00;
}
.markdown-body a[id].wiki-toc-anchor {
color: inherit;
text-decoration: none;
}
.markdown-body {
font-size: 14px;
line-height: 1.6;
@@ -72,7 +77,7 @@ a.absent {
.markdown-body h4:hover a.anchor,
.markdown-body h5:hover a.anchor,
.markdown-body h6:hover a.anchor {
background: url('/images/para.png') no-repeat 10px center;
background: url('/images/pin-20.png') no-repeat left center;
text-decoration: none;
}
.markdown-body h1 tt,
@@ -362,6 +367,43 @@ a.absent {
margin: 0;
padding: 0;
}
.toc {
background-color: #F7F7F7;
border: 1px solid #ddd;
padding: 5px 10px;
margin: 0;
border-radius: 3px;
}
.toc-title {
color: #888;
font-size: 14px;
line-height: 1.6;
padding: 2px;
border-bottom: 1px solid #ddd;
margin-bottom: 3px;
}
.toc ul {
padding-left: 10px;
margin: 0;
}
.toc>ul {
margin-left: 10px;
font-size: 17px;
}
.toc ul ul {
font-size: 15px;
}
.toc ul ul ul {
font-size: 14px;
}
.toc ul li{
margin: 0;
}
#header-content .toc,
#footer-content .toc,
#sidebar-content .toc {
border: none;
}
.highlight {
background: #fff;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+13 -8
View File
@@ -20,7 +20,19 @@
</ul>
</div>
<div id="wiki-content">
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
<div class="{{#has_header}}has-header{{/has_header}}{{#has_footer}} has-footer{{/has_footer}}{{#has_sidebar}} has-rightbar{{/has_sidebar}}{{#has_toc}} has-toc{{/has_toc}}">
{{#has_toc}}
<div id="wiki-toc-main">
{{{toc_content}}}
</div>
{{/has_toc}}
{{#has_sidebar}}
<div id="wiki-rightbar" class="gollum-{{sidebar_format}}-content">
<div id="sidebar-content" class="markdown-body">
{{{sidebar_content}}}
</div>
</div>
{{/has_sidebar}}
<div id="wiki-body" class="gollum-{{format}}-content">
{{#has_header}}
<div id="wiki-header" class="gollum-{{header_format}}-content">
@@ -33,13 +45,6 @@
{{{content}}}
</div>
</div>
{{#has_sidebar}}
<div id="wiki-rightbar" class="gollum-{{sidebar_format}}-content">
<div id="sidebar-content" class="markdown-body">
{{{sidebar_content}}}
</div>
</div>
{{/has_sidebar}}
{{#has_footer}}
<div id="wiki-footer" class="gollum-{{footer_format}}-content">
<div id="footer-content" class="markdown-body">
+6
View File
@@ -65,6 +65,12 @@ module Precious
def sidebar_format
has_sidebar && @sidebar.format.to_s
end
def has_toc
!@toc_content.nil?
end
def toc_content
@toc_content
end
end
end
end
+66 -7
View File
@@ -6,6 +6,7 @@ require 'base64'
module Gollum
class Markup
attr_accessor :toc
# Initialize a new Markup object.
#
# page - The Gollum::Page.
@@ -17,12 +18,15 @@ module Gollum
@data = page.text_data
@version = page.version.id if page.version
@format = page.format
@sub_page = page.sub_page
@parent_page = page.parent_page
@dir = ::File.dirname(page.path)
@tagmap = {}
@codemap = {}
@texmap = {}
@wsdmap = {}
@premap = {}
@toc = nil
end
# Render the content with Gollum wiki syntax on top of the file's own
@@ -54,18 +58,60 @@ module Gollum
data = process_tags(data)
data = process_code(data, encoding)
if sanitize || block_given?
doc = Nokogiri::HTML::DocumentFragment.parse(data)
doc = sanitize.clean_node!(doc) if sanitize
yield doc if block_given?
data = doc.to_html
end
doc = Nokogiri::HTML::DocumentFragment.parse(data)
doc = sanitize.clean_node!(doc) if sanitize
doc,toc = process_headers(doc)
@toc = @sub_page ? ( @parent_page ? @parent_page.toc_data : "[[_TOC_]]" ) : toc
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><\/p>/, '')
data
end
# Inserts header anchors and creates TOC
#
# doc - Nokogiri parsed document
#
# Returns doc Document and toc String
def process_headers(doc)
toc = nil
doc.css('h1,h2,h3,h4,h5,h6').each do |h|
id = CGI::escape(h.content.gsub(' ','-'))
level = h.name.gsub(/[hH]/,'').to_i
# Add anchors
anchor = Nokogiri::XML::Node.new('a', doc)
anchor['class'] = 'anchor'
anchor['id'] = id
anchor['href'] = '#' + id
h.add_child(anchor)
# Build TOC
toc ||= Nokogiri::XML::DocumentFragment.parse('<div class="toc"><div class="toc-title">Table of Contents</div></div>')
tail ||= toc.child
tail_level ||= 0
while tail_level < level
node = Nokogiri::XML::Node.new('ul', doc)
tail = tail.add_child(node)
tail_level += 1
end
while tail_level > level
tail = tail.parent
tail_level -= 1
end
node = Nokogiri::XML::Node.new('li', doc)
node.add_child("<a href='##{id}'>#{h.content}</a>")
tail.add_child(node)
end
toc = toc.to_xhtml if toc != nil
[doc, toc]
end
#########################################################################
#
# TeX
@@ -184,7 +230,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
@@ -341,6 +389,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)
data
end
# Find the given file in the repo.
#
# name - The String absolute or relative path of the file.
+35 -2
View File
@@ -20,6 +20,11 @@ module Gollum
# Returns nothing.
attr_writer :historical
# Parent page if this is a sub page
#
# Returns a Page
attr_accessor :parent_page
# Checks if a filename has a valid extension understood by GitHub::Markup.
#
# filename - String filename, like "Home.md".
@@ -100,6 +105,8 @@ module Gollum
def initialize(wiki)
@wiki = wiki
@blob = @header = @footer = @sidebar = nil
@doc = nil
@parent_page = nil
end
# Public: The on-disk filename of the page including extension.
@@ -133,6 +140,14 @@ module Gollum
Sanitize.clean(name).strip
end
# Public: Determines if this is a sub-page
# Sub-pages have filenames beginning with an underscore
#
# Returns true or false.
def sub_page
filename =~ /^_/
end
# Public: The path of the page within the repo.
#
# Returns the String path.
@@ -164,7 +179,21 @@ module Gollum
#
# Returns the String data.
def formatted_data(encoding = nil, &block)
@blob && markup_class.render(historical?, encoding, &block)
@blob && markup_class.render(historical?, encoding) do |doc|
@doc = doc
yield doc if block_given?
end
end
# Public: The table of contents of the page.
#
# formatted_data - page already marked up in html.
#
# Returns the String data.
def toc_data()
return @parent_page.toc_data if @parent_page and @sub_page
formatted_data if markup_class.toc == nil
markup_class.toc
end
# Public: The format of the page.
@@ -400,12 +429,16 @@ module Gollum
map = @wiki.tree_map_for(@wiki.ref)
while !dirs.empty?
if page = find_page_in_tree(map, name, dirs.join('/'))
page.parent_page = self
return page
end
dirs.pop
end
find_page_in_tree(map, name, '')
if page = find_page_in_tree(map, name, '')
page.parent_page = self
end
page
end
def inspect
+11
View File
@@ -32,6 +32,10 @@ module Gollum
# sanitization altogether.
attr_writer :history_sanitization
# Hash for setting different default wiki options
# These defaults can be overridden by options passed directly to initialize()
attr_accessor :default_options
# Gets the page class used by all instances of this Wiki.
# Default: Gollum::Page.
def page_class
@@ -107,6 +111,7 @@ module Gollum
self.default_committer_email = 'anon@anon.com'
self.default_ws_subs = ['_','-']
self.default_options = {}
# The String base path to prefix to internal links. For example, when set
# to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
@@ -133,6 +138,7 @@ module Gollum
# path - The String path to the Git repository that holds the Gollum
# site.
# options - Optional Hash:
# :universal_toc - Table of contents on all pages. Default: false
# :base_path - String base path for all Wiki links.
# Default: "/"
# :page_class - The page Class. Default: Gollum::Page
@@ -146,6 +152,7 @@ module Gollum
#
# Returns a fresh Gollum::Repo.
def initialize(path, options = {})
options = self.class.default_options.merge(options)
if path.is_a?(GitAccess)
options[:access] = path
path = path.path
@@ -165,6 +172,7 @@ module Gollum
self.class.default_ws_subs
@history_sanitization = options[:history_sanitization] ||
self.class.history_sanitization
@universal_toc = options.fetch(:universal_toc, false)
end
# Public: check whether the wiki's git repo exists on the filesystem.
@@ -528,6 +536,9 @@ module Gollum
# Gets the markup class used by all instances of this Wiki.
attr_reader :markup_classes
# Toggles display of universal table of contents
attr_reader :universal_toc
# Normalize the data.
#
# data - The String data to be normalized.
+1 -1
View File
@@ -1,7 +1,7 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
bare = true
logallrefupdates = true
ignorecase = true
[remote "origin"]
+2
View File
@@ -1,3 +1,5 @@
0000000000000000000000000000000000000000 60f12f4254f58801b9ee7db7bca5fa8aeefaa56b rick <technoweenie@gmail.com> 1291341857 -0800 clone: from /Users/rick/p/gollum/test/examples/lotr.git
60f12f4254f58801b9ee7db7bca5fa8aeefaa56b a8ad3c09dd842a3517085bfadd37718856dee813 rick <technoweenie@gmail.com> 1291341922 -0800 commit: add sidebars
a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 Arran Cudbard-Bell <a.cudbardb@freeradius.org> 1309107565 +0200 commit: Test out whitespace with Sam
1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 b16b3d9fad9d78e5a669e7f33d94c96da374eccd kristi <kristi.dev@gmail.com> 1336983525 -0700 push
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
@@ -1,3 +1,5 @@
0000000000000000000000000000000000000000 60f12f4254f58801b9ee7db7bca5fa8aeefaa56b rick <technoweenie@gmail.com> 1291341857 -0800 clone: from /Users/rick/p/gollum/test/examples/lotr.git
60f12f4254f58801b9ee7db7bca5fa8aeefaa56b a8ad3c09dd842a3517085bfadd37718856dee813 rick <technoweenie@gmail.com> 1291341922 -0800 commit: add sidebars
a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 Arran Cudbard-Bell <a.cudbardb@freeradius.org> 1309107565 +0200 commit: Test out whitespace with Sam
1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 b16b3d9fad9d78e5a669e7f33d94c96da374eccd kristi <kristi.dev@gmail.com> 1336983525 -0700 push
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
@@ -0,0 +1,2 @@
x•ŽQ
Â0ýÎ)öJ’m7 ˆx±Ín´Ø‰Ñóð~=楲mKîUU3Ù4²·<ZÇÁf.d¶š¡:õI½šÍ“«>ÌŽf”˜Y¢„IG&Š2v6¤HÂMI ¿Û­T¸×åÕ8þö ú9_7^ÖC*Û "Å iˆ°·ÁZÓi¿×ôoѰÜ”¥«­À¥Téõ\ÖÌçéKº
+1 -1
View File
@@ -1 +1 @@
1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3
b0de6e794dfdc7ef3400e894225bfe23308aae5c
+1 -1
View File
@@ -50,7 +50,7 @@ context "Wiki" do
end
test "parents with default master ref" do
ref = '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
ref = 'b0de6e794dfdc7ef3400e894225bfe23308aae5c'
committer = Gollum::Committer.new(@wiki)
assert_equal ref, committer.parents.first.sha
end
+3 -2
View File
@@ -18,8 +18,9 @@ context "GitAccess" do
assert @access.ref_map.empty?
assert @access.tree_map.empty?
@access.tree 'master'
assert_equal({"master"=>"1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3"}, @access.ref_map)
assert_equal({"master"=>"b0de6e794dfdc7ef3400e894225bfe23308aae5c"}, @access.ref_map)
@access.tree '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
map = @access.tree_map['1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3']
assert_equal 'Bilbo-Baggins.md', map[0].path
assert_equal '', map[0].dir
@@ -49,4 +50,4 @@ context "GitAccess" do
test "cannot access tree from invalid ref" do
assert_equal [], @access.tree('foo')
end
end
end
+10 -8
View File
@@ -6,6 +6,7 @@ context "Markup" do
@path = testpath("examples/test.git")
FileUtils.rm_rf(@path)
Grit::Repo.init_bare(@path)
Gollum::Wiki.default_options = {:universal_toc => false}
@wiki = Gollum::Wiki.new(@path)
end
@@ -573,14 +574,15 @@ np.array([[2,2],[1,3]],np.float)
test "id with prefix ok" do
content = "h2(example#wiki-foo). xxxx"
output = %(<h2 class="example" id="wiki-foo">xxxx</h2>)
compare(content, output, :textile)
end
output = %(<h2 class="example" id="wiki-foo">xxxx<a class=\"anchor\" id=\"xxxx\" href=\"#xxxx\"></a></h2>)
compare(content, output, :textile)
end
test "id prefix added" do
content = "h2(#foo). xxxx[1]\n\nfn1.footnote"
output = "<h2 id=\"wiki-foo\">xxxx" +
"<sup class=\"footnote\" id=\"wiki-fnr1\"><a href=\"#wiki-fn1\">1</a></sup></h2>" +
"<sup class=\"footnote\" id=\"wiki-fnr1\"><a href=\"#wiki-fn1\">1</a></sup>" +
"<a class=\"anchor\" id=\"xxxx1\" href=\"#xxxx1\"></a></h2>" +
"\n<p class=\"footnote\" id=\"wiki-fn1\"><a href=\"#wiki-fnr1\"><sup>1</sup></a> footnote</p>"
compare(content, output, :textile)
end
@@ -617,12 +619,12 @@ np.array([[2,2],[1,3]],np.float)
# Asciidoc
#########################################################################
test "asciidoc header" do
compare("= Book Title\n\n== Heading", '<div class="sect1"><h2 id="wiki-_heading">Heading</h2><div class="sectionbody"></div></div>', 'asciidoc')
test "asciidoc header" do
compare("= Book Title\n\n== Heading", '<div class="sect1"><h2 id="wiki-_heading">Heading<a class="anchor" id="Heading" href="#Heading"></a></h2><div class="sectionbody"></div></div>', 'asciidoc')
end
test "internal links with asciidoc" do
compare("= Book Title\n\n[[anid]]\n== Heading", '<div class="sect1"><h2 id="wiki-anid">Heading</h2><div class="sectionbody"></div></div>', 'asciidoc')
test "internal links with asciidoc" do
compare("= Book Title\n\n[[anid]]\n== Heading", '<div class="sect1"><h2 id="wiki-anid">Heading<a class="anchor" id="Heading" href="#Heading"></a></h2><div class="sectionbody"></div></div>', 'asciidoc')
end
#########################################################################
+22 -1
View File
@@ -16,7 +16,7 @@ context "Page" do
page = @wiki.page('Bilbo Baggins')
assert_equal Gollum::Page, page.class
assert page.raw_data =~ /^# Bilbo Baggins\n\nBilbo Baggins/
assert page.formatted_data =~ /<h1>Bilbo Baggins<\/h1>\n\n<p>Bilbo Baggins/
assert page.formatted_data =~ %r{<h1>Bilbo Baggins<a class="anchor" id="Bilbo-Baggins" href="#Bilbo-Baggins"></a>\n</h1>\n\n<p>Bilbo Baggins}
assert_equal 'Bilbo-Baggins.md', page.path
assert_equal :markdown, page.format
assert_equal @wiki.repo.commits.first.id, page.version.id
@@ -114,6 +114,25 @@ context "Page" do
assert_equal "Eye Of Sauron", page.title
end
test "top level header" do
header = @wiki.page('Home').header
assert_equal "Hobbits\n", header.raw_data
assert_equal "_Header.md", header.path
end
test "nested header" do
header = @wiki.page('Eye Of Sauron').header
assert_equal "Sauron\n", header.raw_data
assert_equal "Mordor/_Header.md", header.path
end
test "header itself" do
header = @wiki.page("_Header")
assert_nil header.header
assert_nil header.footer
assert_nil header.sidebar
end
test "top level footer" do
footer = @wiki.page('Home').footer
assert_equal 'Lord of the Rings wiki', footer.raw_data
@@ -128,6 +147,7 @@ context "Page" do
test "footer itself" do
footer = @wiki.page("_Footer")
assert_nil footer.header
assert_nil footer.footer
assert_nil footer.sidebar
end
@@ -146,6 +166,7 @@ context "Page" do
test "sidebar itself" do
sidebar = @wiki.page("_Sidebar")
assert_nil sidebar.header
assert_nil sidebar.footer
assert_nil sidebar.sidebar
end
+19 -3
View File
@@ -54,12 +54,12 @@ context "Wiki" do
test "list pages" do
pages = @wiki.pages
assert_equal \
['Bilbo-Baggins.md', 'Eye-Of-Sauron.md', 'Home.textile', 'My-Precious.md', 'Samwise Gamgee.mediawiki'],
['Bilbo-Baggins.md', 'Boromir.md', 'Eye-Of-Sauron.md', 'Home.textile', 'My-Precious.md', 'Samwise Gamgee.mediawiki'],
pages.map { |p| p.filename }.sort
end
test "counts pages" do
assert_equal 5, @wiki.size
assert_equal 6, @wiki.size
end
test "text_data" do
@@ -92,18 +92,34 @@ end
context "Wiki page previewing" do
setup do
@path = testpath("examples/lotr.git")
Gollum::Wiki.default_options = {:universal_toc => false}
@wiki = Gollum::Wiki.new(@path)
end
test "preview_page" do
page = @wiki.preview_page("Test", "# Bilbo", :markdown)
assert_equal "# Bilbo", page.raw_data
assert_equal "<h1>Bilbo</h1>", page.formatted_data
assert_equal %Q{<h1>Bilbo<a class="anchor" id="Bilbo" href="#Bilbo"></a>\n</h1>}, page.formatted_data
assert_equal "Test.md", page.filename
assert_equal "Test", page.name
end
end
context "Wiki TOC" do
setup do
@path = testpath("examples/lotr.git")
options = {:universal_toc => true}
@wiki = Gollum::Wiki.new(@path, options)
end
test "toc_generation" do
page = @wiki.preview_page("Test", "# Bilbo", :markdown)
assert_equal "# Bilbo", page.raw_data
assert_equal '<h1>Bilbo<a class="anchor" id="Bilbo" href="#Bilbo"></a></h1>', page.formatted_data.gsub(/\n/,"")
assert_equal %{<div class="toc"><div class="toc-title">Table of Contents</div><ul><li><a href="#Bilbo">Bilbo</a></li></ul></div>}, page.toc_data.gsub(/\n */,"")
end
end
context "Wiki page writing" do
setup do
@path = testpath("examples/test.git")