Closes #297, #265. Add missing Pretty Diff options for CSS/SCSS/Sass/LESS

This commit is contained in:
Glavin Wiechert 2015-06-08 18:34:56 -03:00
parent 6eb0319e7e
commit b41daabaa6
7 changed files with 149 additions and 8 deletions

View File

@ -143,7 +143,7 @@ Add a newline between multiple selectors (Supported by JS Beautify)
**Description**:
Add a newline between CSS rules (Supported by JS Beautify)
Add a newline between CSS rules (Supported by JS Beautify, Pretty Diff)
### CSS - Preserve newlines
**Key**: `css_preserve_newlines`
@ -153,6 +153,57 @@ Add a newline between CSS rules (Supported by JS Beautify)
**Description**:
Retain empty lines. Consecutive empty lines will be converted to a single empty line. (Supported by JS Beautify, Pretty Diff)
### CSS - Wrap line length
**Key**: `css_wrap_line_length`
**Type**: `integer`
**Description**:
Maximum amount of characters per line (0 = disable) (Supported by JS Beautify, Pretty Diff)
### CSS - Indent comments
**Key**: `css_indent_comments`
**Default**: `true`
**Type**: `boolean`
**Description**:
Determines whether comments should be indented. (Supported by Pretty Diff)
### CSS - Force indentation
**Key**: `css_force_indentation`
**Type**: `boolean`
**Description**:
if indentation should be forcefully applied tomarkup even if it disruptively adds unintended whitespace to the documents rendered output (Supported by Pretty Diff)
### CSS - Convert quotes
**Key**: `css_convert_quotes`
**Default**: `none`
**Type**: `string`
**Enum**: `none` `double` `single`
**Description**:
Convert the quote characters delimiting strings from either double or single quotes to the other. (Supported by Pretty Diff)
### CSS - Align assignments
**Key**: `css_align_assignments`
**Type**: `boolean`
**Description**:
If lists of assignments or properties should be vertically aligned for faster and easier reading. (Supported by Pretty Diff)
### D - Config Path
**Key**: `d_configPath`
@ -247,7 +298,7 @@ Indentation character (Supported by JS Beautify, Pretty Diff)
**Description**:
Maximum characters per line (0 disables) (Supported by JS Beautify)
Maximum characters per line (0 disables) (Supported by JS Beautify, Pretty Diff)
### HTML - Wrap attributes
**Key**: `html_wrap_attributes`
@ -489,7 +540,7 @@ Decode printable characters encoded in xNN notation (Supported by JS Beautify)
**Description**:
Wrap lines at next opportunity after N characters (Supported by JS Beautify)
Wrap lines at next opportunity after N characters (Supported by JS Beautify, Pretty Diff)
### JavaScript - End with newline
**Key**: `js_end_with_newline`
@ -1695,6 +1746,37 @@ Default Beautifier to be used for TSS
**Description**:
Automatically beautify TSS files on save
### Language Config - Twig - Disable Beautifying Language
**Key**: `language_twig_disabled`
**Type**: `boolean`
**Description**:
Disable Twig Beautification
### Language Config - Twig - Default Beautifier
**Key**: `language_twig_default_beautifier`
**Default**: `Pretty Diff`
**Type**: `string`
**Enum**: `Pretty Diff`
**Description**:
Default Beautifier to be used for Twig
### Language Config - Twig - Beautify On Save
**Key**: `language_twig_beautify_on_save`
**Type**: `boolean`
**Description**:
Automatically beautify Twig files on save
### Language Config - TypeScript - Disable Beautifying Language
**Key**: `language_typescript_disabled`

View File

@ -0,0 +1,7 @@
body {
background: red;
}
h1 {
font-size: 16px;
}

View File

@ -0,0 +1,6 @@
body {
background: red;
}
h1 {
font-size: 16px;
}

View File

@ -11,7 +11,13 @@ module.exports = class JSBeautify extends Beautifier
Marko: true
JavaScript: true
JSON: true
CSS: true
CSS:
indent_size: true
indent_char: true
selector_separator_newline: true
newline_between_rules: true
preserve_newlines: true
wrap_line_length: true
}
beautify: (text, language, options) ->

View File

@ -8,12 +8,24 @@ module.exports = class PrettyDiff extends Beautifier
_:
inchar: "indent_char"
insize: "indent_size"
alphasort: (alphasort) ->
alphasort or false
objsort: (objsort) ->
objsort or false
preserve: ['preserve_newlines', (preserve_newlines) ->
if (preserve_newlines is true ) then \
"all" else "none"
]
cssinsertlines: "newline_between_rules"
comments: ["indent_comments", (indent_comments) ->
if (indent_comments is true) then \
"indent" else "noindent"
]
force: "force_indentation"
quoteConvert: "convert_quotes"
vertical: ['align_assignments', (align_assignments) ->
if (align_assignments is true ) then \
"all" else "none"
]
wrap: "wrap_line_length"
# Apply language-specific options
CSV: true
ERB: true

View File

@ -50,6 +50,32 @@ module.exports = {
type: 'boolean'
default: false
description: "Retain empty lines. "+
"Consecutive empty lines will be converted to a single empty line."
"Consecutive empty lines will be converted to \
a single empty line."
wrap_line_length:
type: 'integer'
default: 0
description: "Maximum amount of characters per line (0 = disable)"
indent_comments:
type: 'boolean'
default: true
description: "Determines whether comments should be indented."
force_indentation:
type: 'boolean'
default: false
description: "if indentation should be forcefully applied to\
markup even if it disruptively adds unintended whitespace \
to the documents rendered output"
convert_quotes:
type: 'string'
default: "none"
description: "Convert the quote characters delimiting strings \
from either double or single quotes to the other."
enum: ["none", "double", "single"]
align_assignments:
type: 'boolean'
default: false
description: "If lists of assignments or properties should be \
vertically aligned for faster and easier reading."
}

View File

@ -24,6 +24,8 @@ module.exports = {
"js"
]
defaultBeautifier: "JS Beautify"
###
###