Skip to content

Commit

Permalink
Changed name to aligned-multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Jun 30, 2018
1 parent b894ba3 commit 82039ac
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ as well as deobfuscate scripts processed by
# Contributors Needed
I'm putting this front and center above because existing owners have very limited time to work on this project currently.
This is a popular project and widely used but it desperately needs contributors who have time to commit to fixing both
customer facing bugs and underlying problems with the internal design and implementation.
customer facing bugs and underlying problems with the internal design and implementation.

If you are interested, please take a look at the [CONTRIBUTING.md](https://github.com/beautify-web/js-beautify/blob/master/CONTRIBUTING.md) then fix an issue marked with the ["Good first issue"](https://github.com/beautify-web/js-beautify/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label and submit a PR. Repeat as often as possible. Thanks!

Expand Down Expand Up @@ -94,7 +94,7 @@ You can also use `js-beautify` as a `node` library (install locally, the `npm` d
$ npm install js-beautify
```

Import and call the appropriate beautifier method for javascript (js), css, or html. All three method signatures are `beautify(code, options)`. `code` is the string of code to be beautified. options is an object with the settings you would like used to beautify the code.
Import and call the appropriate beautifier method for javascript (js), css, or html. All three method signatures are `beautify(code, options)`. `code` is the string of code to be beautified. options is an object with the settings you would like used to beautify the code.

The configuration option names are the same as the CLI names but with underscores instead of dashes. For example, `--indent-size 2 --space-in-empty-paren` would be `{ indent_size: 2, space_in_empty_paren: true }`.

Expand Down Expand Up @@ -210,7 +210,7 @@ Configuration sources provided earlier in this stack will override later ones.

The settings are a shallow tree whose values are inherited for all languages, but
can be overridden. This works for settings passed directly to the API in either implementation.
In the Javascript implementation, settings loaded from a config file, such as .jsbeautifyrc, can also use inheritance/overriding.
In the Javascript implementation, settings loaded from a config file, such as .jsbeautifyrc, can also use inheritance/overriding.

Below is an example configuration tree showing all the supported locations
for language override nodes. We'll use `indent_size` to discuss how this configuration would behave, but any number of settings can be inherited or overridden:
Expand Down Expand Up @@ -239,7 +239,7 @@ for language override nodes. We'll use `indent_size` to discuss how this config
Using the above example would have the following result:

* HTML files
* Inherit `indent_size` of 4 spaces from the top-level setting.
* Inherit `indent_size` of 4 spaces from the top-level setting.
* The files would also end with a newline.
* JavaScript and CSS inside HTML
* Inherit the HTML `end_with_newline` setting.
Expand Down Expand Up @@ -289,8 +289,8 @@ HTML Beautifier Options:
-b, --brace-style [collapse-preserve-inline|collapse|expand|end-expand|none] ["collapse"]
-S, --indent-scripts [keep|separate|normal] ["normal"]
-w, --wrap-line-length Maximum characters per line (0 disables) [250]
-A, --wrap-attributes Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline] ["auto"]
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size] (ignored if wrap-attributes is "force-aligned")
-A, --wrap-attributes Wrap attributes to new lines [auto|force|force-aligned|force-expand-multiline|aligned-multiple] ["auto"]
-i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size] (ignored if wrap-attributes is "aligned")
-d, --inline List of tags to be considered inline tags
-U, --unformatted List of tags (defaults to inline) that should not be reformatted
-T, --content_unformatted List of tags (defaults to pre) whose content should not be reformatted
Expand Down
6 changes: 3 additions & 3 deletions js/lib/beautify-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
is_wrap_attributes_force,
is_wrap_attributes_force_expand_multiline,
is_wrap_attributes_force_aligned,
is_wrap_attributes_aligned,
is_wrap_attributes_aligned_multiple,
end_with_newline,
extra_liners,
eol;
Expand Down Expand Up @@ -324,7 +324,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
is_wrap_attributes_force = wrap_attributes.substr(0, 'force'.length) === 'force';
is_wrap_attributes_force_expand_multiline = (wrap_attributes === 'force-expand-multiline');
is_wrap_attributes_force_aligned = (wrap_attributes === 'force-aligned');
is_wrap_attributes_aligned = (wrap_attributes === 'aligned');
is_wrap_attributes_aligned_multiple = (wrap_attributes === 'aligned-multiple');
end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
extra_liners = (typeof options.extra_liners === 'object') && options.extra_liners ?
options.extra_liners.concat() : (typeof options.extra_liners === 'string') ?
Expand Down Expand Up @@ -663,7 +663,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {

//indent attributes an auto, forced, aligned or forced-align line-wrap
var alignment_size = wrap_attributes_indent_size;
if (is_wrap_attributes_force_aligned || is_wrap_attributes_aligned) {
if (is_wrap_attributes_force_aligned || is_wrap_attributes_aligned_multiple) {
alignment_size = content.indexOf(' ') + 1;
}

Expand Down
6 changes: 3 additions & 3 deletions js/src/html/beautifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
is_wrap_attributes_force,
is_wrap_attributes_force_expand_multiline,
is_wrap_attributes_force_aligned,
is_wrap_attributes_aligned,
is_wrap_attributes_aligned_multiple,
end_with_newline,
extra_liners,
eol;
Expand Down Expand Up @@ -116,7 +116,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
is_wrap_attributes_force = wrap_attributes.substr(0, 'force'.length) === 'force';
is_wrap_attributes_force_expand_multiline = (wrap_attributes === 'force-expand-multiline');
is_wrap_attributes_force_aligned = (wrap_attributes === 'force-aligned');
is_wrap_attributes_aligned = (wrap_attributes === 'aligned');
is_wrap_attributes_aligned_multiple = (wrap_attributes === 'aligned-multiple');
end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
extra_liners = (typeof options.extra_liners === 'object') && options.extra_liners ?
options.extra_liners.concat() : (typeof options.extra_liners === 'string') ?
Expand Down Expand Up @@ -455,7 +455,7 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {

//indent attributes an auto, forced, aligned or forced-align line-wrap
var alignment_size = wrap_attributes_indent_size;
if (is_wrap_attributes_force_aligned || is_wrap_attributes_aligned) {
if (is_wrap_attributes_force_aligned || is_wrap_attributes_aligned_multiple) {
alignment_size = content.indexOf(' ') + 1;
}

Expand Down
4 changes: 2 additions & 2 deletions js/test/generated/beautify-html-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be

// Attribute Wrap - (indent_attr = " ", indent_attr_first = " ", indent_end = "", indent_attr_aligned = " ", indent_end_selfclosing = " ", indent_over80 = "\n ")
reset_options();
opts.wrap_attributes = 'aligned';
opts.wrap_attributes = 'aligned-multiple';
opts.wrap_line_length = 80;
test_fragment('<div >This is some text</div>', '<div>This is some text</div>');
test_fragment('<div attr="123" >This is some text</div>', '<div attr="123">This is some text</div>');
Expand All @@ -693,7 +693,7 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be

// Attribute Wrap - (indent_attr = " ", indent_attr_first = " ", indent_end = "", indent_end_selfclosing = " ", indent_over80 = " ")
reset_options();
opts.wrap_attributes = 'aligned';
opts.wrap_attributes = 'aligned-multiple';
test_fragment('<div >This is some text</div>', '<div>This is some text</div>');
test_fragment('<div attr="123" >This is some text</div>', '<div attr="123">This is some text</div>');
test_fragment('<div attr0 attr1="123" data-attr2="hello t here">This is some text</div>');
Expand Down
4 changes: 2 additions & 2 deletions test/data/html/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ exports.test_data = {
indent_over80: '\n '
}, {
options: [
{ name: "wrap_attributes", value: "'aligned'" },
{ name: "wrap_attributes", value: "'aligned-multiple'" },
{ name: "wrap_line_length", value: "80" }
],
indent_attr: ' ',
Expand All @@ -417,7 +417,7 @@ exports.test_data = {
indent_over80: '\n '
}, {
options: [
{ name: "wrap_attributes", value: "'aligned'" },
{ name: "wrap_attributes", value: "'aligned-multiple'" },
],
indent_attr: ' ',
indent_attr_first: ' ',
Expand Down

0 comments on commit 82039ac

Please sign in to comment.