Skip to content

Commit

Permalink
Work on code formatting
Browse files Browse the repository at this point in the history
Pre now preserves whitespace
Pulled out code css
Added python code formatting
  • Loading branch information
boothj5 committed Mar 4, 2012
1 parent 0d96f46 commit 4c79e3d
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 94 deletions.
2 changes: 1 addition & 1 deletion css/boothj5_main.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pre {
/* CSS2 */
white-space: pre-wrap;
/* CSS 2.1 */
white-space: pre-line;
/*white-space: pre-line;*/
/* CSS 3 (and 2.1 as well, actually) */
word-wrap: break-word;
/* IE */
Expand Down
68 changes: 68 additions & 0 deletions css/c-code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.tabcode { margin-left: 40px; border-style: solid; border-width: 1px; padding: 10px;}
.tab { margin-left: 40px;}
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body { background: #fffbfb; }
body .c { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #808080 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0040D0 } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */

66 changes: 66 additions & 0 deletions css/python-code.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
nenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body { background: #f8f8f8; }
body .c { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #808080 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0040D0 } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */

98 changes: 20 additions & 78 deletions head-unit.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,78 +3,8 @@
<head>
<title>Boothj5: Head-Unit</title>
<meta http-equiv="content-type" content="text/html; charset=latin1">
<style type="text/css">
<!--
.tabcode { margin-left: 40px; border-style: solid; border-width: 1px; padding: 10px;}
.tab { margin-left: 40px;}
-->
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
body .hll { background-color: #ffffcc }
body { background: #fffbfb; }
body .c { color: #408080; font-style: italic } /* Comment */
body .err { border: 1px solid #FF0000 } /* Error */
body .k { color: #008000; font-weight: bold } /* Keyword */
body .o { color: #666666 } /* Operator */
body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
body .cp { color: #BC7A00 } /* Comment.Preproc */
body .c1 { color: #408080; font-style: italic } /* Comment.Single */
body .cs { color: #408080; font-style: italic } /* Comment.Special */
body .gd { color: #A00000 } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #FF0000 } /* Generic.Error */
body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
body .gi { color: #00A000 } /* Generic.Inserted */
body .go { color: #808080 } /* Generic.Output */
body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
body .gt { color: #0040D0 } /* Generic.Traceback */
body .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
body .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
body .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
body .kp { color: #008000 } /* Keyword.Pseudo */
body .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
body .kt { color: #B00040 } /* Keyword.Type */
body .m { color: #666666 } /* Literal.Number */
body .s { color: #BA2121 } /* Literal.String */
body .na { color: #7D9029 } /* Name.Attribute */
body .nb { color: #008000 } /* Name.Builtin */
body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
body .no { color: #880000 } /* Name.Constant */
body .nd { color: #AA22FF } /* Name.Decorator */
body .ni { color: #999999; font-weight: bold } /* Name.Entity */
body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
body .nf { color: #0000FF } /* Name.Function */
body .nl { color: #A0A000 } /* Name.Label */
body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
body .nt { color: #008000; font-weight: bold } /* Name.Tag */
body .nv { color: #19177C } /* Name.Variable */
body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #666666 } /* Literal.Number.Float */
body .mh { color: #666666 } /* Literal.Number.Hex */
body .mi { color: #666666 } /* Literal.Number.Integer */
body .mo { color: #666666 } /* Literal.Number.Oct */
body .sb { color: #BA2121 } /* Literal.String.Backtick */
body .sc { color: #BA2121 } /* Literal.String.Char */
body .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
body .s2 { color: #BA2121 } /* Literal.String.Double */
body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
body .sh { color: #BA2121 } /* Literal.String.Heredoc */
body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
body .sx { color: #008000 } /* Literal.String.Other */
body .sr { color: #BB6688 } /* Literal.String.Regex */
body .s1 { color: #BA2121 } /* Literal.String.Single */
body .ss { color: #19177C } /* Literal.String.Symbol */
body .bp { color: #008000 } /* Name.Builtin.Pseudo */
body .vc { color: #19177C } /* Name.Variable.Class */
body .vg { color: #19177C } /* Name.Variable.Global */
body .vi { color: #19177C } /* Name.Variable.Instance */
body .il { color: #666666 } /* Literal.Number.Integer.Long */
</style>
<link href="css/boothj5_main.css" type="text/css" rel="stylesheet"/>
<link href="css/c-code.css" type="text/css" rel="stylesheet"/>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700' rel='stylesheet' type='text/css'>


Expand Down Expand Up @@ -200,7 +130,7 @@ testsuite.c:
<br><br>
<div class="tabcode">
<div class="highlight"><pre><span class="cp">#include &lt;head-unit.h&gt;</span>
<span class="cp">#include &lt;&quot;testsuite.h&quot;&gt;</span>
<span class="cp">#include &quot;testsuite.h&quot;</span>

<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
Expand All @@ -217,37 +147,49 @@ testsuite.c:

C compiler flags:

<pre class="tab">
<div class="tabcode">
<pre>
-lstdc++ -I ~/include -L ~/lib -l headunit
</pre>
</div>

<p>
C++ compiler flags:
</p>

<pre class="tab">
<div class="tabcode">
<pre>
-Wno-write-strings -I ~/include -L ~/lib -l headunit
</pre>
</div>

<p>
Example C make targets:
</p>

<pre class="tab">
<div class="tabcode">
<pre>
compile-tests: testsuite.o some_tests.o something.o
$(CC) -lstdc++ testsuite.o some_tests.o something.o -I ~/include -L ~/lib -o testsuite -l headunit

test: compile-tests
./testsuite
</pre>
</div>


<p>
Example C++ make targets:
</p>

<pre class="tab">
<div class="tabcode">
<pre>
compile-tests: testsuite.o some_tests.o something.o
$(CC) -Wno-write-strings testsuite.o some_tests.o something.o -I ~/include -L ~/lib -o testsuite -l headunit

test: compile-tests
./testsuite
</pre>

</div>

<h4>Source</h4>
The source can be found on <a href="http://github.com/boothj5/head-unit">Github</a>
Expand Down
38 changes: 23 additions & 15 deletions pyloc.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-->
</style>
<link href="css/boothj5_main.css" type="text/css" rel="stylesheet"/>
<link href="css/python-code.css" type="text/css" rel="stylesheet"/>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700' rel='stylesheet' type='text/css'>

</head>
Expand All @@ -34,43 +35,50 @@ Requires Python 2.6+ and <a href="http://www.wxpython.org/">WxPython</a> to run
<h4>Adding new languages</h4>

To add support for a new language, edit languages.py. Add a string value representing the
language:
language and the definition to the language dictionary:

<pre class="tab">
LUA = "Lua"
</pre>
<div class="tabcode">
<div class="highlight"><pre><span class="n">LUA</span> <span class="o">=</span> <span class="s">&quot;Lua&quot;</span>

Add the definition:

<pre class="tab">
LUA :
{ EXTENSIONS: [ ".lua" ] ,
LINECOMMENTS: "--" ,
BLOCKCOMMENTS: [ ( "--[[" , "]]" ) ] }
<span class="n">LUA</span> <span class="p">:</span>
<span class="p">{</span> <span class="n">EXTENSIONS</span><span class="p">:</span> <span class="p">[</span> <span class="s">&quot;.lua&quot;</span> <span class="p">]</span> <span class="p">,</span>
<span class="n">LINECOMMENTS</span><span class="p">:</span> <span class="s">&quot;--&quot;</span> <span class="p">,</span>
<span class="n">BLOCKCOMMENTS</span><span class="p">:</span> <span class="p">[</span> <span class="p">(</span> <span class="s">&quot;--[[&quot;</span> <span class="p">,</span> <span class="s">&quot;]]&quot;</span> <span class="p">)</span> <span class="p">]</span> <span class="p">}</span> <span class="p">}</span>
</pre>
</div>
</div>

Where:
<p>
Where the string represnets the name of the language, and the dictionary entries represent:
</p>

<p>
<ol>
<li>EXTENSIONS is a comma seperated list of file extensions.</li>
<li>LINECOMMENTS (optional) is a string representing characters used for line comments.</li>
<li>BLOCKCOMMENTS (optional) is a comma seperated list of pairs of begin and end block comment strings.</li>
</ol>

</p>

<h4>Running</h4>

Pyloc can either be run as a desktop GUI:

<pre class="tab">
<div class="tabcode">
<pre>
./pyloc.py
</pre>
</div>

<p>
Or as a terminal application by calling pylocstats.py directly:
</p>

<pre class="tab">
<div class="tabcode">
<pre>
Usage: pylocstats.py directory [-v]
</pre>
</div>

Where 'directory' is the directory to scan and -v will cause verbose output.

Expand Down

0 comments on commit 4c79e3d

Please sign in to comment.