Add ability to define custom link for ToC, and add link for spiderable

This commit is contained in:
Sashko Stubailo
2014-12-04 12:16:49 -08:00
parent 8b34d0008a
commit d6ec53b37d
2 changed files with 6 additions and 2 deletions

View File

@@ -12,7 +12,7 @@
{{/if}}
{{#if type "section"}}
{{#nav_section}}
<a href="#/full/{{id}}" class="{{maybe_current}} {{style}}">
<a href="{{link}}" class="{{maybe_current}} {{style}}">
{{#if prefix}}{{prefix}}.{{/if}}{{#if instance}}<i>{{instance}}</i>.{{/if}}{{name}}
</a>
{{/nav_section}}

View File

@@ -317,6 +317,7 @@ var toc = [
"random",
"stylus",
"showdown",
{name: "spiderable", link: "https://atmospherejs.com/meteor/spiderable"},
"stylus",
"underscore",
"webapp"
@@ -364,9 +365,12 @@ Template.nav.helpers({
else {
if (typeof(item) === "string")
item = {name: item};
var id = item.name && name_to_id(item.name) || undefined;
ret.push(_.extend({
type: "section",
id: item.name && name_to_id(item.name) || undefined,
link: "#/full/" + id,
depth: depth,
style: ''
}, item));