This is a simple example that uses Google Apps to provide a code formatting service.
You can access the service via an HTML form at: http://xzfv.appspot.com/s/format.html
You can access the service as a web service by making a POST to:
http://xzfv.appspot.com/doformat
The service takes the following parameters:
language : (REQUIRED) The language of the source code being formatted.
source : (REQUIRED) The source code to be formatted
output : The output format. Either XML or HTML (XML is default)
| as | ActionScript |
| lua | Lua |
| perl | Perl |
| python | Python |
| ruby | Ruby |
| java | Java |
| csharp | C# |
| bash | Bash |
| sql | SQL |
| css | CSS |
| html | HTML |
| javascript | JavaScript |
| php | PHP |
| xml | XML |
| xslt | XSLT |
<?xml version="1.0"?>
<response>
<code language="javascript">
<![CDATA[
<div class="highlight"><pre><span style="color: #008000; font-weight: bold">var</span> foo <span style="color: #666666">=</span> <span style="color: #BA2121">"bar"</span><span style="color: #666666">;</span>
</pre></div>
]]>
</code>
</response>
<?xml version="1.0"?>
<response>
<error>source must be specified</error>
</response>
You can download the source under an MIT license from here.
Created by Mike Chambers
Uses the Python Pygments library