about summary refs log tree commit homepage
path: root/lib/oldweb/_sidebar_table_of_contents.rhtml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oldweb/_sidebar_table_of_contents.rhtml')
-rw-r--r--lib/oldweb/_sidebar_table_of_contents.rhtml15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/oldweb/_sidebar_table_of_contents.rhtml b/lib/oldweb/_sidebar_table_of_contents.rhtml
new file mode 100644
index 0000000..890b0cc
--- /dev/null
+++ b/lib/oldweb/_sidebar_table_of_contents.rhtml
@@ -0,0 +1,15 @@
+<%
+comment = current.respond_to?(:comment_location) ? current.comment_location :
+          current.comment
+table = current.parse(comment).table_of_contents
+if table.length > 1
+%><%
+  table.each_with_index do |heading, i|
+    next if heading.level > @old_cfg['toc_max']
+%><a
+href="#<%= heading.label(current) %>"><%=
+    i == 0 ? "top" : heading.plain_html %></a>
+<%
+  end %><br /><%
+end
+%>