From f92931589f3a60ed23bcf9d3c19aecf341415ba9 Mon Sep 17 00:00:00 2001 From: Vadim Kiryukhin Date: Sun, 15 Apr 2012 16:47:52 -0700 Subject: [PATCH] edit docs --- README.md | 69 +++++++++++++++++++--------------------------- html/basic.html | 4 +-- html/basicsql.html | 6 ++-- vkbeautify.js | 49 +++++++++++++++++++------------- 4 files changed, 63 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index e459b03..50e5a3b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ javascript plugin to **pretty-print** or **minify** text in **XML**, **JSON**, **CSS** and **SQL** formats. -**Version** - 0.96.02.beta +**Version** - 0.97.00.beta **Copyright** (c) 2012 Vadim Kiryukhin ( vkiryukhin @ gmail.com ) @@ -16,51 +16,38 @@ the MIT and GPL licenses: [http://www.gnu.org/licenses/gpl.html](http://www.gnu.org/licenses/gpl.html) -##Description -* `vkbeautify.xml(text )` - pretty print XMLtext; + **Pretty print** -* `vkbeautify.json(text)` - pretty print JSON text; + vkbeautify.xml(text [,indent_pattern]); + vkbeautify.json(text [,indent_pattern]); + vkbeautify.css(text [,indent_pattern]); + vkbeautify.sql(text [,indent_pattern]); -* `vkbeautify.css(text )` - pretty print CSS text; + @text - String; text to beatufy; + @indent_pattern - Integer | String; + Integer: number of white spaces; + String: character string to visualize indentation ( can also be a set of white spaces ) + **Minify** -* `vkbeautify.sql(text )` - pretty print SQL text; + vkbeautify.xmlmin(text [,preserve_comments]); + vkbeautify.jsonmin(text); + vkbeautify.cssmin(text [,preserve_comments]); + vkbeautify.sqlmin(text); -* `vkbeautify.xmlmin(text [, preserveComments] ` - minify XML -text; + @text - String; text to minify; + @preserve_comments - Bool; [optional]; + Set this flag to true to prevent removing comments from @text ( minxml and mincss functions only. ) -* `vkbeautify.jsonmin(text)` - minify JSON text; + **Examples** + + vkbeautify.xml(text); // pretty print XML + vkbeautify.json(text, 4 ); // pretty print JSON + vkbeautify.css(text, '. . . .'); // pretty print CSS + vkbeautify.sql(text, '----'); // pretty print SQL -* `vkbeautify.cssmin(text [, preserveComments] )` - minify CSS text; - -* `vkbeautify.sqlmin(text)` - minify SQL text; - -**PARAMETERS:** - -`@text` - String; XML, JSON or CSS text to beautify; - -`@preserveComments` - -Bool (optional, used in vkbeautify.minxml and vkbeautify.mincss only); Set this flag -to true to prevent removing comments from @text; - -`@Return` - String; - - -**USAGE:** - -`var xml_pp = vkbeautify.xml(xml_text); ` - -`var xml_min = vkbeautify.xmlmin(xml_text [,true]);` - -`var json_pp = vkbeautify.json(json_text);` - -`var json_min = vkbeautify.jsonmin(json_text);` - -`var css_pp = vkbeautify.css(css_text); ` - -`var css_min = vkbeautify.cssmin(css\text [, true]);` - -`var sql_pp = vkbeautify.sql(sql_text);` - -`var sql_min = vkbeautify.sqlmin(sql_text);` + vkbeautify.xmlmin(text, true);// minify XML, preserve comments + vkbeautify.jsonmin(text);// minify JSON + vkbeautify.cssmin(text);// minify CSS, remove comments ( default ) + vkbeautify.sqlmin(text);// minify SQL diff --git a/html/basic.html b/html/basic.html index 1e22141..86f8bc7 100644 --- a/html/basic.html +++ b/html/basic.html @@ -6,7 +6,7 @@

This is a very basic example of a document.

Click on "Pretty Print" button to beatify the text.

-

Click on "Minify" button to minify the text.

+

Click on "Minify" button to minify the text. *

Check "Preserve Comments" box if you want to keep comments. Or uncheck it if you want do delete comments from minified XML or CSS. As JSON doesn't have @@ -26,7 +26,7 @@ '- - - -'
'       '  -  string of white spaces is also valid.
-Note: minify() function works only with whitespace pattern. +* minify() function works only with whitespace pattern.

diff --git a/html/basicsql.html b/html/basicsql.html index 605d922..fb89551 100644 --- a/html/basicsql.html +++ b/html/basicsql.html @@ -11,10 +11,10 @@ As SELECT syntax itself is very large and flexible, some complex nested statements can be formatted not as perfect as you'd make it manually. But anyway, it helps you to save time on reading unformatted SQL statement.

-Note: "Preserve Comments" is not implemented for SQL part of the application. +Note: "Preserve Comments" is not implemented for SQL part of the application.

Click on "Pretty Print" button to beatify the text.

-

Click on "Minify" button to minify the text (not sure if anybody needs it, but I keep it for consistency :) +

Click on "Minify" button to minify the text * (not sure if anybody needs it, but I keep it for consistency :)

Custom Indent Pattern:
@@ -31,7 +31,7 @@ '       '  -  string of white spaces is also valid.
Clear input to return to the default indent pattern.

-Note: minify() function works only with whitespace pattern. +* minify() function works only with whitespace pattern.

diff --git a/vkbeautify.js b/vkbeautify.js index a899721..ab69bb0 100644 --- a/vkbeautify.js +++ b/vkbeautify.js @@ -10,27 +10,38 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * -* vkbeautify.xml|json|css|sql(text ) - pretty print XML, JSON, CSS or SQL text; -* vkbeautify.xmlmin|jsonmin|cssmin|sqlmin(text, preserveComments ) - minify XML, JSON, CSS or SQL text; +* Pretty print * -* PARAMETERS: +* vkbeautify.xml(text [,indent_pattern]); +* vkbeautify.json(text [,indent_pattern]); +* vkbeautify.css(text [,indent_pattern]); +* vkbeautify.sql(text [,indent_pattern]); * -* @text - String; text to beautify; -* @step - Integer; indent size unit (default is 4 spaces) ; -* @preserveComments - Bool (optional, used in minxml and mincss only); -* Set this flag to true to prevent removing comments from @text; -* @Return - String; -* -* USAGE: -* -* var foo = vkbeautify.xml(text); -* var foo = vkbeautify.json(text [,4]); -* var foo = vkbeautify.css(text [,8]); -* var foo = vkbeautify.sql(text [,2]); -* var foo = vkbeautify.xmlmin( text [, true]); -* var foo = vkbeautify.jsonmin(text); -* var foo = vkbeautify.cssmin( text [, true]); -* var foo = vkbeautify.sqlmin(text); +* @text - String; text to beatufy; +* @indent_pattern - Integer | String; +* Integer: number of white spaces; +* String: character string to visualize indentation ( can also be a set of white spaces ) +* Minify +* +* vkbeautify.xmlmin(text [,preserve_comments]); +* vkbeautify.jsonmin(text); +* vkbeautify.cssmin(text [,preserve_comments]); +* vkbeautify.sqlmin(text); +* +* @text - String; text to minify; +* @preserve_comments - Bool; [optional]; +* Set this flag to true to prevent removing comments from @text ( minxml and mincss functions only. ) +* +* Examples: +* vkbeautify.xml(text); // pretty print XML +* vkbeautify.json(text, 4 ); // pretty print JSON +* vkbeautify.css(text, '. . . .'); // pretty print CSS +* vkbeautify.sql(text, '----'); // pretty print SQL +* +* vkbeautify.xmlmin(text, true);// minify XML, preserve comments +* vkbeautify.jsonmin(text);// minify JSON +* vkbeautify.cssmin(text);// minify CSS, remove comments ( default ) +* vkbeautify.sqlmin(text);// minify SQL * */