Closes #199. Add Jade/Pug beautify support
This commit is contained in:
parent
50ad73d324
commit
d48768e503
|
@ -55,3 +55,7 @@
|
|||
indent_size: 4
|
||||
markdown:
|
||||
listItemIndent: 1
|
||||
jade:
|
||||
indent_size: 4
|
||||
indent_char: " "
|
||||
omit_div: true
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
extends ../layout/basiclayout
|
||||
|
||||
block append stylesheets
|
||||
link(rel='stylesheet', href='/bower_components/bootstrap-table/dist/bootstrap-table.css')
|
||||
style.
|
||||
.sample_id {
|
||||
color: #337AB7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
block content
|
||||
.container
|
||||
.col-lg-10
|
||||
// Comment
|
||||
.page-header
|
||||
h1 Sample Anaysis
|
||||
small Find a sample
|
||||
div
|
||||
#toolbar
|
||||
table#table
|
||||
|
||||
//- div.well
|
||||
//- | Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut. Eum impetus offendit disputationi eu, at vim aliquip lucilius praesent. Alia laudem antiopam te ius, sed ad munere integre, ubique facete sapientem nam ut.
|
||||
//- br
|
||||
//- br
|
||||
//- ul
|
||||
//- li Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut.
|
||||
//- li Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut.
|
||||
block append scripts
|
||||
script(src='/bower_components/bootstrap-table/dist/bootstrap-table.js')
|
|
@ -0,0 +1,30 @@
|
|||
extends ../layout/basiclayout
|
||||
|
||||
block append stylesheets
|
||||
link(rel='stylesheet', href='/bower_components/bootstrap-table/dist/bootstrap-table.css')
|
||||
style.
|
||||
.sample_id {
|
||||
color: #337AB7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
block content
|
||||
div.container
|
||||
div.col-lg-10
|
||||
// Comment
|
||||
div.page-header
|
||||
h1 Sample Anaysis
|
||||
small Find a sample
|
||||
div
|
||||
div#toolbar
|
||||
table#table
|
||||
|
||||
//- div.well
|
||||
//- | Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut. Eum impetus offendit disputationi eu, at vim aliquip lucilius praesent. Alia laudem antiopam te ius, sed ad munere integre, ubique facete sapientem nam ut.
|
||||
//- br
|
||||
//- br
|
||||
//- ul
|
||||
//- li Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut.
|
||||
//- li Lorem ipsum dolor sit amet, natum bonorum expetendis usu ut.
|
||||
block append scripts
|
||||
script(src='/bower_components/bootstrap-table/dist/bootstrap-table.js')
|
|
@ -103,6 +103,7 @@
|
|||
"node-dir": "^0.1.8",
|
||||
"node-uuid": "^1.4.3",
|
||||
"prettydiff": "^1.16.27",
|
||||
"pug-beautify": "^0.1.1",
|
||||
"remark": "^3.2.2",
|
||||
"season": "^5.3.0",
|
||||
"space-pen": "^5.1.1",
|
||||
|
|
|
@ -52,6 +52,7 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
'php-cs-fixer'
|
||||
'phpcbf'
|
||||
'prettydiff'
|
||||
'pug-beautify'
|
||||
'puppet-fix'
|
||||
'remark'
|
||||
'rubocop'
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
"use strict"
|
||||
Beautifier = require('./beautifier')
|
||||
|
||||
module.exports = class PugBeautify extends Beautifier
|
||||
name: "Pug Beautify"
|
||||
options: {
|
||||
# Apply these options first / globally, for all languages
|
||||
Jade:
|
||||
fill_tab: ['indent_char', (indent_char) ->
|
||||
# Should use tabs?
|
||||
return (indent_char is "\t")
|
||||
]
|
||||
omit_div: true
|
||||
tab_size: "indent_size"
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
|
||||
return new @Promise((resolve, reject) ->
|
||||
pugBeautify = require("pug-beautify")
|
||||
try
|
||||
resolve(pugBeautify(text, options))
|
||||
catch error
|
||||
# Error occurred
|
||||
reject(error)
|
||||
)
|
|
@ -38,7 +38,6 @@ module.exports = {
|
|||
indent_char:
|
||||
type: 'string'
|
||||
default: defaultIndentChar
|
||||
minimum: 0
|
||||
description: "Indentation character"
|
||||
brace_style:
|
||||
type: 'string'
|
||||
|
|
|
@ -32,6 +32,7 @@ module.exports = class Languages
|
|||
"handlebars"
|
||||
"haskell"
|
||||
"html"
|
||||
"jade"
|
||||
"java"
|
||||
"javascript"
|
||||
"json"
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Get Atom defaults
|
||||
scope = ['text.jade']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 4
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
defaultIndentChar = (if softTabs then " " else "\t")
|
||||
defaultIndentWithTabs = not softTabs
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: "Jade"
|
||||
namespace: "jade"
|
||||
fallback: ['html']
|
||||
|
||||
###
|
||||
Supported Grammars
|
||||
###
|
||||
grammars: [
|
||||
"Jade"
|
||||
]
|
||||
|
||||
###
|
||||
Supported extensions
|
||||
###
|
||||
extensions: [
|
||||
"jade"
|
||||
]
|
||||
|
||||
options: [
|
||||
indent_size:
|
||||
type: 'integer'
|
||||
default: defaultIndentSize
|
||||
minimum: 0
|
||||
description: "Indentation size/length"
|
||||
indent_char:
|
||||
type: 'string'
|
||||
default: defaultIndentChar
|
||||
description: "Indentation character"
|
||||
omit_div:
|
||||
type: 'boolean'
|
||||
default: false
|
||||
description: "Whether to omit/remove the 'div' tags."
|
||||
]
|
||||
|
||||
defaultBeautifier: "Pug Beautify"
|
||||
|
||||
}
|
Loading…
Reference in New Issue