995 Commits

Author SHA1 Message Date
Daniel Stockman
0e18f39a1b Merge branch 'master' into python-cssbeautifier
Conflicts:
	js/test/beautify-tests.js
2013-10-17 11:49:59 -07:00
Daniel Stockman
c1b7f1a388 Pass css_beautify to run_beautifier_tests in node_beautifier_tests. Fixes #337 2013-10-17 11:37:22 -07:00
Thorben Bochenek
119202c0ec correct options comment 2013-10-16 10:37:36 +02:00
Thorben Bochenek
ba9ca2fc41 change option selector_separator to selector_separator_newline 2013-10-16 09:41:04 +02:00
Thorben Bochenek
caaa29f772 revert accidentally checked in change to run-tests 2013-10-15 11:59:56 +02:00
Thorben Bochenek
7ae048953c fix header newline bug 2013-10-15 11:50:52 +02:00
Thorben Bochenek
07f0dca665 provide tests for beautify-css.js 2013-10-15 11:49:47 +02:00
Thorben Bochenek
51ac378392 remove "remove trailing zeros"
add new option "selector_separator" which determines which string should separate selectors, e.g. setting it to '\n' results in 'a,\nbr', setting it to ' ' in 'a, br'
2013-10-15 10:57:01 +02:00
Liam Newman
da0323d551 Merge pull request #334 from dertseha/win_home
Making .jsbeautifyrc resolve work (in general and for Windows re home dir)
2013-10-14 10:00:28 -07:00
Thorben Bochenek
93604b1b31 Initial version of a python port of the existing css-beautify. Tried to keep options and functionality and even code-flow as close as possible to the original version to make future updates easier.
Included unit tests suggest that the formatting works okay, best would be if these unit tests will be ported to the js-version also
2013-10-14 17:06:09 +02:00
Thorben Bochenek
7a45f93194 add option "remove_trailing_zero"
the option is disabled by default and will remove trailing zeros from floating point values (e.g. 0.9 to .9)
2013-10-14 16:57:53 +02:00
Thorben Bochenek
b63dc533e7 don't add a newline between "{" and "}" when there is nothing in-between
before ".tabs {}" resulted in ".tabs {\n}". The rule is of course useless but a popular starting point
2013-10-14 16:36:56 +02:00
Thorben Bochenek
210dd48ae7 introduce new option "end_with_newline".
The default value is "false" and this will make sure that the output ends with a newline ("\n")
2013-10-14 16:31:42 +02:00
Thorben Bochenek
35c34d8450 add a newline after header-comments 2013-10-14 16:16:25 +02:00
Thorben Bochenek
27b65a5189 make sure there is exactly one whitespace after a colon (making a rule look like "color: red", not like "color:red") 2013-10-14 16:10:26 +02:00
Thorben Bochenek
769ab43e71 rename 'coma' to 'endChar' to represent more closely what it actually means 2013-10-14 15:42:24 +02:00
Thorben Bochenek
9c4c91751d put "whiteRe.test(output[output.length - 1]);" (used twice) in function 2013-10-14 15:41:38 +02:00
Thorben Bochenek
0e5225d539 beautify with js-beautify 2013-10-14 15:40:54 +02:00
Christian Haas
5653b56d45 Added tests for .jsbeautifyrc resolve algorithm of cli.js 2013-10-12 07:08:15 +02:00
Liam Newman
f4a814303a 1.4.1 v1.4.1 2013-10-11 16:30:30 -07:00
Liam Newman
ce48689a2a Python 1.4.1 2013-10-11 16:29:17 -07:00
Liam Newman
132fc95e90 Line wrapping disabling in html_beautify fixed for web
Fixes #306
2013-10-11 16:03:06 -07:00
Liam Newman
d0d79c9154 Add Block_comments to skipped token types 2013-10-11 15:19:23 -07:00
Liam Newman
f1648d3c2a Add node-static for easier local web testing 2013-10-11 15:17:43 -07:00
Christian Haas
75ea3aae75 #300 Making .jsbeautifyrc resolve work
* not using cc.find() anymore:
** using dedicated find based on cwd (cc uses __dirname, resolving to install dir of node_modules)
** not using recursive lookup when resolving file from user home
* user directory is either HOME or USERPROFILE (for windows)
2013-10-11 20:41:41 +02:00
Liam Newman
226622afcd Add html_beautify to runtests call
unbork web runtests

Fixes #332
2013-10-11 00:35:34 -07:00
Einar Lielmanis
d953b6751b Implement flags.had_comment, fix #329, fix #291
We deliberately lose token_type = TK_COMMENT and TK_INLINE_COMMENT to
allow their transparent handling. To counteract this, flags.had_comment
counter-spell is implemented, so that we had a possibility to know that
there was, in fact, a comment somewhere.

Thus, we can fix some corner-cases where an unexpected comment might
break the structure.
2013-10-11 06:36:35 +03:00
Liam Newman
33082bda27 Allow wrapping of tokens inside an object literal property
When a token is not the first one in a object literal property, we should allow wrapping of those tokens.

Fixes #331
2013-10-10 18:15:44 -07:00
Einar Lielmanis
7693fc8c81 CLI: do not breed duplicate eof newlines #325 2013-09-10 08:02:41 +03:00
Einar Lielmanis
790f07a2bb Empty parens will never contain space, ref #320
space-in-paren setting up until now formatted empty parens with space in
them:

    function ( ) {
        foo( ).bar( a + 1)
    }

Now it skips this space for greater readability and prettier code.

    function () {
        foo().bar( a + 1 )
    }

If you have a good use case for the old behavior, open the issue, I
couldn't find any reason for that.
2013-08-27 23:49:37 +03:00
Einar Lielmanis
d40f246254 indent_handlebars instead of options.indent_handlebars
If we decide to make indent_handlebars true by default,
this would be a source of subtle bugs.
2013-08-27 20:21:20 +03:00
Einar Lielmanis
a045c45000 Merge pull request #321 from quisquous/handlebars
indent_handlebars support, HTML tests
2013-08-27 10:19:12 -07:00
Liam Newman
c3cca8dad1 Merge pull request #319 from mokkabonna/fix-tab-indent
The indent_with_tabs option did not work when required in node, only CLI.
2013-08-27 09:52:12 -07:00
Martin Hansen
ddb3fb64b5 Added python tests for indent_with_tabs 2013-08-27 18:10:32 +02:00
Adrienne Walker
2e1b94a3b0 Support quotes inside of Handlebars expressions in strings 2013-08-26 22:36:10 -07:00
Adrienne Walker
499f9b6309 Add handlebars support
This adds a new 'indent_handlebars' option to the beautify-html
formatter.  When not turned on, anything inside handlebars {{ }} will be
treated as normal content as before.

When turned on, Handlebars block expressions (e.g. {{#anything}},
{{/anything}}, and special case {{else}}) are treated identically to
formatted HTML tags and indented properly.

Handlebars expressions inside of HTML tags get spaces on either side.

Handlebars expression in quotes are left unformatted.
2013-08-26 22:36:06 -07:00
Adrienne Walker
710def6d00 Add basic beautify-html js tests 2013-08-26 22:35:49 -07:00
Martin Hansen
71cf7187b6 removed the tab indent check from the cli, duplication of code and could confuse 2013-08-16 23:22:29 +02:00
Martin Hansen
bfcf66fe05 now checks for tag indent in beautify.js itself, also updated tests 2013-08-16 23:21:42 +02:00
Einar Lielmanis
3504226988 Fix the brokenness, I shouldn't be touching the code today 2013-08-16 14:30:55 +03:00
Einar Lielmanis
ff68685fff Learning to comment code properly /facepalm 2013-08-16 13:37:31 +03:00
Einar Lielmanis
6f18af8366 Disable MyObfuscate unpacker: out-of-date 2013-08-16 13:30:19 +03:00
Liam Newman
7a33968b41 Merge pull request #312 from jonschlinkert/master
add option to indent "inner HTML"...
2013-08-15 14:11:16 -07:00
Jon Schlinkert
163ed6b388 CLI option 2013-07-27 21:33:26 -04:00
Jon Schlinkert
c85dcf0eba add option to indent "inner HTML", since <head> and <body> tags are no longer indented by default. 2013-07-27 21:11:09 -04:00
Einar Lielmanis
579760fa25 Merge pull request #304 from fprijate/master
Fix issue under windows when HOME env is not available
2013-07-06 00:47:19 -07:00
Franček Prijatelj
901180475e Update cli.js
HOME environment variable usually not defined in windows.
2013-07-06 09:20:22 +02:00
Einar Lielmanis
9dc77a785f Merge pull request #303 from eleith/master
beautify-html: tweak require.js export declaration
2013-07-03 11:36:31 -07:00
eleith
1096681920 export the same variable as the other methods 2013-07-03 11:21:52 -07:00
Einar Lielmanis
513dfdb5f7 @eleith: make require.js optimizable
@eleith:
when you passin the require module through the define function, i'm
unable to get r.js (require's node module for optimizing scripts) to
properly optimize beautify-html. my guess is that it does not read that
beautify-html has two dependencies.

however, when using define's first parameter option which is to pass an
array of dependency, r.js properly picks up the dependencies and bundles
them in the optimization process.
2013-07-03 20:52:46 +03:00