<commit_before>MATLAB syntax highlighting for google code prettify
===================================================

This script provides MATLAB syntax highlighting for the
[google-code-prettify][1] project. Intended to be used on [Stack Overflow][2]
and other Stack Exchange sites.

Currently the code recognizes the following constructs:

 - single line as well as block comments (`% this is a comment`)
 - quoted string (`'hello world'`)
 - number literals (`1`, `-2.5`, `1i`, `2.9E-5`, etc...)
 - system commands (`!touch filename`)
 - line continuation characters (`...`)
 - transpose operator (single quote) vs. strings
 - command prompt/command output (`>> now`)
 - error/warning messages (`??? Error in ...` and `Warning: ...`)
 - parentheses, brackets, braces (`()`, `[]`, `{}`)
 - other operators (`<>=~@&;,:!-+*^.|\/`)
 - MATLAB language keywords (`if`, `else`, `end`, etc...)
 - some special variables and constants (`inf`, `nan`, `varargin`, etc..)
 - over 1300 builtin functions from core MATLAB (`cos`, `plot`, etc...)
 - additional functions from popular toolboxes ([Statistics][6], [IPT][7], and [Optimization][8])
 - user-defined indentifiers (function and variable names not matched in previous steps)

See the wiki for sample screenshots.


BUILDING
--------

If the files don't already exist, run `rake SO:build` to create the output
javascript files in the `js` directory using the templates sources from `src`.
(This step requires Rake, a Make-like build tool for Ruby, used here to provide
basic template processing).


Stack Overflow
--------------

To obtain MATLAB syntax highlighting on Stack Overflow, install the
`js/prettify-matlab.user.js` userscript with your preferred browser (see [this
page][3] for some instructions).

The script is only activated on questions tagged [`matlab`][4].

In addition, a separate userscript is included to allow switching the language
used by the prettifier. It adds a small button to the top-right corner of each
code block, with an attached drop-down menu to allow language selection.
To add this functionality, install the `js/switch-lang.user.js` userscript.


MATLAB Answers / File Exchange
------------------------------

Similarly, you can apply the syntax hightighting on both [MATLAB Answers][5] 
and [File Exchange][9] websites from MathWorks. Simply install the userscripts
`js/prettify-mathworks-answers.user.js` or `js/prettify-mathworks-fileexchange.user.js`
respectively.


google-code-prettify extension
------------------------------

To apply the MALTAB syntax highlighting on code snippets in your own web pages,
first include the prettify scripts and stylesheets in your document (as explained
in the [prettify][1] project documentation). To use the MATLAB language extension,
include the `js/lang-matlab.js` script, and place your source code inside a
preformatted HTML tag as follows:

    <pre class="prettyprint lang-matlab">
        <code>
       	% example code
       	x = [1,2,3];
       	sum(x.^2)
        </code>
    </pre>

Upon calling `prettyPrint()`, this will automatically be pretty printed, and the
default styles will be applied. You can customize them with your own, or use the
provided CSS file in `css/lang-matlab.css` which resembles the color scheme of
the MATLAB IDE (with some additions of my own).

Check the `demo/index.html` file for a demonstration.


[1]: http://code.google.com/p/google-code-prettify/
[2]: http://stackoverflow.com/
[3]: http://stackapps.com/tags/script/info
[4]: http://stackoverflow.com/questions/tagged/matlab
[5]: http://www.mathworks.com/matlabcentral/answers/
[6]: http://www.mathworks.com/products/statistics/
[7]: http://www.mathworks.com/products/image/
[8]: http://www.mathworks.com/products/optimization/
[9]: http://www.mathworks.com/matlabcentral/fileexchange/

LICENSE
-------

Copyright (c) 2012 by Amro &lt;<EMAIL>&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<commit_msg>edit README file and use relative links in markdown<commit_after>MATLAB syntax highlighting for Google Code prettify
===================================================

This script provides MATLAB syntax highlighting for the
[google-code-prettify][1] project. Intended to be used on [Stack Overflow][2]
and other Stack Exchange sites.

The project was inspired by the similar [Mathematica.SE][10] syntax highlighter.

Currently the following constructs are recognized:

 - single line as well as block comments (`% this is a comment`)
 - quoted string (`'hello world'`)
 - number literals (`1`, `-2.5`, `1i`, `2.9E-5`, etc...)
 - system commands (`!touch filename`)
 - line continuation characters (`...`)
 - transpose operator (single quote) vs. strings
 - command prompt/command output (`>> now`)
 - error/warning messages (`??? Error in ...` and `Warning: ...`)
 - parentheses, brackets, braces (`()`, `[]`, `{}`)
 - other operators (`<>=~@&;,:!-+*^.|\/`)
 - MATLAB language keywords (`if`, `else`, `end`, etc...)
 - some special variables and constants (`inf`, `nan`, `varargin`, etc..)
 - over 1300 builtin functions from core MATLAB (`cos`, `plot`, etc...)
 - additional functions from popular toolboxes ([Statistics][6], [IPT][7], and [Optimization][8])
 - user-defined indentifiers (function and variable names not matched in previous steps)

See the wiki for sample screenshots.


BUILDING
--------

You can rebuild the project by running `rake SO:build`. This will create the output
javascript files in the `js` directory using the templates sources from `src`.
(This step requires Rake, a Make-like build tool for Ruby, used here to provide
basic template processing).


Stack Overflow
--------------

To obtain MATLAB syntax highlighting on Stack Overflow, install the
[userscript](js/prettify-matlab.user.js) with your preferred browser
(see [this page][3] for some instructions).

The script is only activated on questions tagged [`matlab`][4].

In addition, a separate [userscript](js/switch-lang.user.js) is included to
allow switching the language used by the prettifier. It adds a small button
to the top-right corner of each code block, with an attached drop-down menu
to allow language selection.


MathWorks (MATLAB Answers / File Exchange)
------------------------------------------

Similarly, you can apply the syntax hightighting on both [MATLAB Answers][5]
and [File Exchange][9] websites from MathWorks. Simply install the corresponding
userscript for [Answers](js/prettify-mathworks-answers.user.js) or
[File Exchange](js/prettify-mathworks-fileexchange.user.js) websittes.


google-code-prettify extension
------------------------------

To apply the MALTAB syntax highlighting on code snippets in your own web pages,
first include the prettify scripts and stylesheets in your document (as explained
in the [prettify][1] project documentation). To use the MATLAB language extension,
include the [MATLAB](js/lang-matlab.js) script, and place your source code inside a
preformatted HTML tag as follows:

    <pre class="prettyprint lang-matlab">
        <code>
       	% example code
       	x = [1,2,3];
       	sum(x.^2)
        </code>
    </pre>

Upon calling `prettyPrint()`, marked sections will be pretty-printed, and the
default styles will be applied. You can customize them with your own, or use the
provided [CSS file](css/lang-matlab.css) which resembles the color scheme of
the MATLAB IDE (with some additions of my own).

Check the [demo](demo/index.html) page for a demonstration.


[1]: http://code.google.com/p/google-code-prettify/
[2]: http://stackoverflow.com/
[3]: http://stackapps.com/tags/script/info
[4]: http://stackoverflow.com/questions/tagged/matlab
[5]: http://www.mathworks.com/matlabcentral/answers/
[6]: http://www.mathworks.com/products/statistics/
[7]: http://www.mathworks.com/products/image/
[8]: http://www.mathworks.com/products/optimization/
[9]: http://www.mathworks.com/matlabcentral/fileexchange/
[10]: https://github.com/halirutan/Mathematica-Source-Highlighting

MIT LICENSE
-----------

Copyright (c) 2013 by Amro &lt;<EMAIL>&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
{'fraction_non_alphanumeric': 0.13123711340206184, 'fraction_numerical': 0.008247422680412371, 'mean_word_length': 4.031639004149378, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '455430', 'n_tokens_mistral': 2770, 'n_tokens_neox': 2577, 'n_words': 1144}