See #58. Add automatic documentation generation for Options

npm run docs
This commit is contained in:
Glavin Wiechert 2015-06-01 15:52:33 -03:00
parent d18ef3ee50
commit 9e90708a55
11 changed files with 1532 additions and 153 deletions

26
docs/index.coffee Executable file
View File

@ -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.')

23
docs/options-template.md Normal file
View File

@ -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}}

1337
docs/options.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,139 +1,140 @@
{
"name": "atom-beautify",
"main": "./src/beautify",
"version": "0.27.9",
"private": true,
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, and SQL in Atom",
"repository": {
"type": "git",
"url": "https://github.com/Glavin001/atom-beautify"
},
"bugs": {
"url": "https://github.com/Glavin001/atom-beautify/issues"
},
"license": "MIT",
"author": {
"name": "Glavin Wiechert",
"email": "glavin.wiechert@gmail.com",
"url": "https://github.com/Glavin001"
},
"contributors": [
{
"name": "Donald Pipowitch",
"email": "pipo@senaeh.de",
"url": "https://github.com/donaldpipowitch"
"name": "atom-beautify",
"main": "./src/beautify",
"version": "0.27.9",
"private": true,
"description": "Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, and SQL in Atom",
"repository": {
"type": "git",
"url": "https://github.com/Glavin001/atom-beautify"
},
{
"name": "László Károlyi",
"url": "https://github.com/karolyi"
"bugs": {
"url": "https://github.com/Glavin001/atom-beautify/issues"
},
{
"name": "Marco Tanzi",
"url": "https://github.com/mtanzi"
"license": "MIT",
"author": {
"name": "Glavin Wiechert",
"email": "glavin.wiechert@gmail.com",
"url": "https://github.com/Glavin001"
},
{
"name": "gvn lazar suntop",
"url": "https://github.com/gvn"
"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"
},
{
"name": "Vadim K.",
"url": "https://github.com/vadirn"
"dependencies": {
"analytics-node": "^1.2.2",
"async": "^1.0.0",
"atom-message-panel": "^1.2.4",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.26",
"coffee-fmt": "0.10.2",
"coffee-formatter": "^0.1.2",
"csscomb": "^3.1.5",
"diff": "^1.4.0",
"editorconfig": "^0.12.2",
"emissary": "^1.3.3",
"event-kit": "^1.2.0",
"expand-home-dir": "0.0.2",
"extend": "^2.0.1",
"js-beautify": "^1.5.6",
"lodash": "3.9.3",
"loophole": "^1.0.0",
"node-dir": "^0.1.8",
"node-uuid": "^1.4.3",
"prettydiff": "^1.11.21",
"space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2",
"temp": "^0.8.1",
"tidy-markdown": "^0.3.2",
"typescript-formatter": "~0.3.2",
"underscore-plus": "^1.6.6",
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
},
{
"name": "Filipe Silva",
"url": "https://github.com/filipesilva"
"activationCommands": {
"atom-workspace": [
"atom-beautify:help-debug-editor",
"atom-beautify:beautify-editor",
"core:save",
"core:save-as"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
],
".tree-view .directory .name": [
"atom-beautify:beautify-directory"
]
},
"keywords": [
"atom",
"beautify",
"beautifier",
"js-beautify",
"format",
"pretty",
"html",
"handlebars",
"mustache",
"xml",
"css",
"javascript",
"json",
"css",
"sass",
"scss",
"less",
"sql",
"markdown",
"php",
"python",
"ruby",
"coffeescript",
"typescript",
"c",
"c++",
"cpp",
"objective-c",
"c-sharp",
"c#",
"uncrustify",
"java",
"pawn",
"vala",
"d",
"erb",
"editorconfig",
"yaml",
"front matter",
"jekyll",
"marko",
"go",
"golang"
],
"devDependencies": {
"coffee-script": "^1.9.3",
"handlebars": "^3.0.3"
},
"scripts": {
"prepublish": "npm run docs",
"docs": "coffee docs/"
}
],
"engines": {
"atom": ">=0.174.0 <2.0.0"
},
"dependencies": {
"analytics-node": "^1.2.2",
"async": "^1.0.0",
"atom-message-panel": "^1.2.4",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.26",
"coffee-fmt": "0.10.2",
"coffee-formatter": "^0.1.2",
"csscomb": "^3.1.5",
"diff": "^1.4.0",
"editorconfig": "^0.12.2",
"emissary": "^1.3.3",
"event-kit": "^1.2.0",
"expand-home-dir": "0.0.2",
"extend": "^2.0.1",
"js-beautify": "^1.5.6",
"lodash": "3.9.3",
"loophole": "^1.0.0",
"node-dir": "^0.1.8",
"node-uuid": "^1.4.3",
"prettydiff": "^1.11.21",
"space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2",
"temp": "^0.8.1",
"tidy-markdown": "^0.3.2",
"typescript-formatter": "~0.3.2",
"underscore-plus": "^1.6.6",
"winston": "^1.0.0",
"yaml-front-matter": "^3.2.3"
},
"activationCommands": {
"atom-workspace": [
"atom-beautify:help-debug-editor",
"atom-beautify:beautify-editor",
"core:save",
"core:save-as"
],
".tree-view .file .name": [
"atom-beautify:beautify-file"
],
".tree-view .directory .name": [
"atom-beautify:beautify-directory"
]
},
"keywords": [
"atom",
"beautify",
"beautifier",
"js-beautify",
"format",
"pretty",
"html",
"handlebars",
"mustache",
"xml",
"css",
"javascript",
"json",
"css",
"sass",
"scss",
"less",
"sql",
"markdown",
"php",
"python",
"ruby",
"coffeescript",
"typescript",
"c",
"c++",
"cpp",
"objective-c",
"c-sharp",
"c#",
"uncrustify",
"java",
"pawn",
"vala",
"d",
"erb",
"editorconfig",
"yaml",
"front matter",
"jekyll",
"marko",
"go",
"golang"
]
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]