See #58. Add automatic documentation generation for Options
npm run docs
This commit is contained in:
parent
d18ef3ee50
commit
9e90708a55
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env coffee
|
||||
|
||||
# Dependencies
|
||||
Handlebars = require('handlebars')
|
||||
Beautifiers = require("../src/beautifiers")
|
||||
fs = require('fs')
|
||||
|
||||
console.log('Generating options...')
|
||||
beautifier = new Beautifiers()
|
||||
defaultLanguageOptions = beautifier.options
|
||||
|
||||
console.log('Loading options template...')
|
||||
templatePath = __dirname + '/options-template.md'
|
||||
optionsPath = __dirname + '/options.md'
|
||||
source = fs.readFileSync(templatePath).toString()
|
||||
console.log('Building documentation from template and options...')
|
||||
template = Handlebars.compile(source)
|
||||
context = {
|
||||
options: defaultLanguageOptions
|
||||
}
|
||||
result = template(context)
|
||||
|
||||
console.log('Writing documentation to file...')
|
||||
fs.writeFileSync(optionsPath, result)
|
||||
|
||||
console.log('Done.')
|
|
@ -0,0 +1,23 @@
|
|||
# Options
|
||||
|
||||
Automatically generated documentation for language and beautifier options.
|
||||
|
||||
## Supported Options
|
||||
|
||||
{{#each options}}
|
||||
### {{title}} (`{{@key}}`)
|
||||
{{#if default}}
|
||||
|
||||
**Default**: `{{default}}`
|
||||
{{/if}}
|
||||
|
||||
**Type**: `{{type}}`
|
||||
{{#if enum}}
|
||||
|
||||
**Enum**: {{#each enum}} `{{this}}` {{/each}}
|
||||
{{/if}}
|
||||
|
||||
#### Description
|
||||
{{description}}
|
||||
|
||||
{{/each}}
|
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
|
@ -17,33 +17,26 @@
|
|||
"email": "glavin.wiechert@gmail.com",
|
||||
"url": "https://github.com/Glavin001"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"contributors": [{
|
||||
"name": "Donald Pipowitch",
|
||||
"email": "pipo@senaeh.de",
|
||||
"url": "https://github.com/donaldpipowitch"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"name": "László Károlyi",
|
||||
"url": "https://github.com/karolyi"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"name": "Marco Tanzi",
|
||||
"url": "https://github.com/mtanzi"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"name": "gvn lazar suntop",
|
||||
"url": "https://github.com/gvn"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"name": "Vadim K.",
|
||||
"url": "https://github.com/vadirn"
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"name": "Filipe Silva",
|
||||
"url": "https://github.com/filipesilva"
|
||||
}
|
||||
],
|
||||
}],
|
||||
"engines": {
|
||||
"atom": ">=0.174.0 <2.0.0"
|
||||
},
|
||||
|
@ -135,5 +128,13 @@
|
|||
"marko",
|
||||
"go",
|
||||
"golang"
|
||||
]
|
||||
],
|
||||
"devDependencies": {
|
||||
"coffee-script": "^1.9.3",
|
||||
"handlebars": "^3.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm run docs",
|
||||
"docs": "coffee docs/"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -6,13 +6,6 @@ Language Support and default options.
|
|||
_ = require('lodash')
|
||||
extend = null
|
||||
|
||||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
||||
#
|
||||
module.exports = class Languages
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Get Atom defaults
|
||||
tabLength = atom.config.get('editor.tabLength')
|
||||
softTabs = atom.config.get('editor.softTabs')
|
||||
tabLength = atom?.config.get('editor.tabLength') ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs') ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
|
|
@ -9,13 +9,12 @@ module.exports = do ->
|
|||
# See http://stackoverflow.com/a/21583831/2578205
|
||||
winston = require('winston')
|
||||
stream = require('stream')
|
||||
writable = new stream.Writable({
|
||||
write: (chunk, encoding, next) ->
|
||||
writable = new stream.Writable()
|
||||
writable._write = (chunk, encoding, next) ->
|
||||
msg = chunk.toString()
|
||||
# console.log(msg)
|
||||
emitter.emit('logging', msg)
|
||||
next()
|
||||
})
|
||||
|
||||
levels = {
|
||||
silly: 0,
|
||||
|
@ -48,7 +47,7 @@ module.exports = do ->
|
|||
]
|
||||
})
|
||||
wlogger.on('logging', (transport, level, msg, meta)->
|
||||
loggerLevel = atom.config.get('atom-beautify._loggerLevel')
|
||||
loggerLevel = atom?.config.get('atom-beautify._loggerLevel') ? "warn"
|
||||
# console.log('logging', loggerLevel, arguments)
|
||||
loggerLevelNum = levels[loggerLevel]
|
||||
levelNum = levels[level]
|
||||
|
|
Loading…
Reference in New Issue