Add in-page links to documentation, to beautifiers, etc

This commit is contained in:
Glavin Wiechert 2015-06-09 12:02:52 -03:00
parent cf348cb7fa
commit 7b5fbf73ce
3 changed files with 669 additions and 396 deletions

View File

@ -27,6 +27,20 @@ optionTemplate = fs.readFileSync(optionTemplatePath).toString()
console.log('Building documentation from template and options...')
Handlebars.registerPartial('option', optionTemplate)
template = Handlebars.compile(optionsTemplate)
linkifyTitle = (title) ->
title = title.toLowerCase()
p = title.split(/[\s,+#;,\/?:@&=+$]+/) # split into parts
sep = "-"
p.join(sep)
Handlebars.registerHelper('linkify', (title, options) ->
return new Handlebars.SafeString(
"[#{options.fn(this)}](\##{linkifyTitle(title)})"
)
)
context = {
packageOptions: packageOptions
languageOptions: languageOptions

View File

@ -1,4 +1,4 @@
#### {{#if title}} {{title}} {{else}} `{{@key}}` {{/if}}
#### {{#if title}} {{#linkify title}}{{title}}{{/linkify}} {{else}} {{#linkify @key}}`{{@key}}`{{/linkify}} {{/if}}
**Key**: `{{@key}}`
{{#if default}}
@ -13,9 +13,10 @@
{{/if}}
{{#if beautifiers}}
**Supported Beautifiers**: {{#each beautifiers}} `{{this}}` {{/each}}
**Supported Beautifiers**: {{#each beautifiers}} {{#linkify this}}`{{this}}`{{/linkify}} {{/each}}
{{/if}}
**Description**:
{{description}}

File diff suppressed because it is too large Load Diff