Namespace: Code

Code

Code operations.

Author:
  • <p>n1474335 [n1474335@gmail.com]</p>
License:
  • Apache-2.0
Source:

Members


<static, constant> LANGUAGES

Default Value:
  • ["default-code","default-markup","bash","bsh","c","cc","coffee","cpp","cs","csh","cv","cxx","cyc","htm","html","in.tag","java","javascript","js","json","m","mxml","perl","pl","pm","py","python","rb","rc","rs","ruby","rust","sh","uq.val","xhtml","xml","xsl"]
Source:

<static, constant> LINE_NUMS

Source:

<static, constant> BEAUTIFY_INDENT

Default Value:
  • \t
Source:

<static, constant> PRESERVE_COMMENTS

Source:

Methods


<static> run_syntax_highlight(input, args)

Syntax highlighter operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
html

<static> run_xml_beautify(input, args)

XML Beautify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_json_beautify(input, args)

JSON Beautify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_css_beautify(input, args)

CSS Beautify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_sql_beautify(input, args)

SQL Beautify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_xml_minify(input, args)

XML Minify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_json_minify(input, args)

JSON Minify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_css_minify(input, args)

CSS Minify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_sql_minify(input, args)

SQL Minify operation.

Parameters:
Name Type Description
input string
args Array.<Object>
Source:
Returns:
Type
string

<static> run_generic_beautify(input, args)

Generic Code Beautify operation.

Yeeeaaah...

I'm not proud of this code, but seriously, try writing a generic lexer and parser that
correctly generates an AST for multiple different languages. I have tried, and I can tell
you it's pretty much impossible.

This basically works. That'll have to be good enough. It's not meant to produce working code,
just slightly more readable code.

Things that don't work:

  • For loop formatting
  • Do-While loop formatting
  • Switch/Case indentation
  • Bit shift operators
Parameters:
Name Type Description
input string
args Array.<Object>
Author:
  • <p>n1474335 [n1474335@gmail.com]</p>
Source:
Returns:
Type
string