Generate documentation for available options for each beautifier

This commit is contained in:
Glavin Wiechert 2015-06-08 19:05:03 -03:00
parent b41daabaa6
commit c6492bf100
4 changed files with 1266 additions and 185 deletions

View File

@ -9,6 +9,13 @@ console.log('Generating options...')
beautifier = new Beautifiers() beautifier = new Beautifiers()
languageOptions = beautifier.options languageOptions = beautifier.options
packageOptions = require('../src/config.coffee') packageOptions = require('../src/config.coffee')
# Build options by Beautifier
beautifierOptions = {}
for optionName, optionDef of languageOptions
beautifiers = optionDef.beautifiers ? []
for beautifierName in beautifiers
beautifierOptions[beautifierName] ?= {}
beautifierOptions[beautifierName][optionName] = optionDef
console.log('Loading options template...') console.log('Loading options template...')
optionsTemplatePath = __dirname + '/options-template.md' optionsTemplatePath = __dirname + '/options-template.md'
@ -23,6 +30,7 @@ template = Handlebars.compile(optionsTemplate)
context = { context = {
packageOptions: packageOptions packageOptions: packageOptions
languageOptions: languageOptions languageOptions: languageOptions
beautifierOptions: beautifierOptions
} }
result = template(context) result = template(context)

View File

@ -1,4 +1,4 @@
### {{#if title}} {{title}} {{else}} `{{@key}}` {{/if}} #### {{#if title}} {{title}} {{else}} `{{@key}}` {{/if}}
**Key**: `{{@key}}` **Key**: `{{@key}}`
{{#if default}} {{#if default}}
@ -11,6 +11,10 @@
**Enum**: {{#each enum}} `{{this}}` {{/each}} **Enum**: {{#each enum}} `{{this}}` {{/each}}
{{/if}} {{/if}}
{{#if beautifiers}}
**Supported Beautifiers**: {{#each beautifiers}} `{{this}}` {{/each}}
{{/if}}
**Description**: **Description**:

View File

@ -21,3 +21,18 @@ Supported options for each language.
{{#each languageOptions}} {{#each languageOptions}}
{{> option}} {{> option}}
{{/each}} {{/each}}
## Beautifier Options
Supported options for each beautifier.
---
{{#each beautifierOptions}}
### {{@key}}
{{#each this}}
{{> option}}
{{/each}}
{{/each}}

File diff suppressed because it is too large Load Diff