Skip to content

Commit

Permalink
edit docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vkiryukhin committed Apr 15, 2012
1 parent c2e0cfa commit f929315
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 65 deletions.
69 changes: 28 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand All @@ -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

4 changes: 2 additions & 2 deletions html/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<td class="functionDoc">
<p>This is a very basic example of a document.</p>
<p>Click on "<b>Pretty Print</b>" button to beatify the text. </p>
<p>Click on "<b>Minify</b>" button to minify the text. </p>
<p>Click on "<b>Minify</b>" button to minify the text. <sup><a href="#note" title="minify() function works only with whitespace pattern">*</a></sup></p>
<p>
Check "<b>Preserve Comments</b>" 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
Expand All @@ -26,7 +26,7 @@
<b>'- - - -'</b><br/>
<b>'&nbsp; &nbsp; &nbsp; &nbsp;'</b>&nbsp; - &nbsp;string of white spaces is also valid.<br/>
</li></ul>
<b>Note:</b> <i>minify() function works only with whitespace pattern.</i>
<b><sup><a name="note">*</a></sup></b> <span style="color:#aa0000;font-size:85%;font-style:italic">minify() function works only with whitespace pattern.</span>
</p>
</td>

Expand Down
6 changes: 3 additions & 3 deletions html/basicsql.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<br/><br/>
Note: <i> "Preserve Comments" is not implemented for SQL part of the application.</i>
Note: <span style="color:#aa0000;font-size:85%;font-style:italic"> "Preserve Comments" is not implemented for SQL part of the application.</span>
</p>
<p>Click on "<b>Pretty Print</b>" button to beatify the text. </p>
<p>Click on "<b>Minify</b>" button to minify the text (not sure if anybody needs it, but I keep it for consistency :)
<p>Click on "<b>Minify</b>" button to minify the text <sup><a href="#note" title="minify() function works only with whitespace pattern">*</a></sup> (not sure if anybody needs it, but I keep it for consistency :)
</p>
<p>
<b>Custom Indent Pattern:</b> <br/>
Expand All @@ -31,7 +31,7 @@
<b>'&nbsp; &nbsp; &nbsp; &nbsp;'</b>&nbsp; - &nbsp;string of white spaces is also valid.<br/>
</li></ul>
Clear input to return to the default indent pattern. <br/><br/>
<b>Note:</b> <i>minify() function works only with whitespace pattern.</i>
<b><sup><a name="note">*</a></sup></b> <span style="color:#aa0000;font-size:85%;font-style:italic">minify() function works only with whitespace pattern.</span>
</p>
<p></p>
</td>
Expand Down
49 changes: 30 additions & 19 deletions vkbeautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
*/

Expand Down

0 comments on commit f929315

Please sign in to comment.