Merge pull request #943 from ayoubdev/master

[PrettyDiff] Fixed Indent Tabs configuration ignored (issue: #910: ht…
This commit is contained in:
Glavin Wiechert 2016-04-23 16:38:36 -03:00
commit 8ce6e5d376
3 changed files with 114 additions and 8 deletions

View File

@ -1968,6 +1968,30 @@ Indentation size/length (Supported by Pretty Diff)
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `js`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"indent_with_tabs": false
}
}
```
##### [Preserve newlines](#preserve-newlines) ##### [Preserve newlines](#preserve-newlines)
**Namespace**: `html` **Namespace**: `html`
@ -4052,11 +4076,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff)
**Type**: `boolean` **Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**: **Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify) Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -4585,11 +4609,11 @@ Indentation size/length (Supported by JS Beautify, Pretty Diff)
**Type**: `boolean` **Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**: **Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify) Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -5010,6 +5034,30 @@ Indentation size/length (Supported by Pretty Diff)
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `js`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"indent_with_tabs": false
}
}
```
##### [Preserve newlines](#preserve-newlines) ##### [Preserve newlines](#preserve-newlines)
**Namespace**: `js` **Namespace**: `js`
@ -9643,6 +9691,30 @@ Indentation size/length (Supported by Pretty Diff)
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `js`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"indent_with_tabs": false
}
}
```
##### [Preserve newlines](#preserve-newlines) ##### [Preserve newlines](#preserve-newlines)
**Namespace**: `html` **Namespace**: `html`
@ -12252,11 +12324,11 @@ Initial indentation level (Supported by JS Beautify)
**Type**: `boolean` **Type**: `boolean`
**Supported Beautifiers**: [`JS Beautify`](#js-beautify) **Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff)
**Description**: **Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify) Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify, Pretty Diff)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -13128,6 +13200,30 @@ If in CSS values leading 0s immediately preceeding a decimal should be removed o
} }
``` ```
##### [Indent with tabs](#indent-with-tabs)
**Namespace**: `js`
**Key**: `indent_with_tabs`
**Type**: `boolean`
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
**Description**:
Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by Pretty Diff)
**Example `.jsbeautifyrc` Configuration**
```json
{
"js": {
"indent_with_tabs": false
}
}
```
##### [Space after anon function](#space-after-anon-function) ##### [Space after anon function](#space-after-anon-function)
**Namespace**: `js` **Namespace**: `js`

View File

@ -74,6 +74,10 @@
{ {
"name": "Dheepak Krishnamurthy", "name": "Dheepak Krishnamurthy",
"url": "https://github.com/kdheepak89" "url": "https://github.com/kdheepak89"
},
{
"name": "Ayoub Adib",
"url": "https://github.com/ayoubdev"
} }
], ],
"engines": { "engines": {

View File

@ -6,8 +6,14 @@ module.exports = class PrettyDiff extends Beautifier
options: { options: {
# Apply these options first / globally, for all languages # Apply these options first / globally, for all languages
_: _:
inchar: "indent_char" inchar: ["indent_with_tabs", "indent_char", (indent_with_tabs, indent_char) ->
insize: "indent_size" if (indent_with_tabs is true) then \
"\t" else indent_char
]
insize: ["indent_with_tabs", "indent_size", (indent_with_tabs, indent_size) ->
if (indent_with_tabs is true) then \
1 else indent_size
]
objsort: (objsort) -> objsort: (objsort) ->
objsort or false objsort or false
preserve: ['preserve_newlines', (preserve_newlines) -> preserve: ['preserve_newlines', (preserve_newlines) ->