summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@slide.com>2009-04-07 21:24:37 -0700
committerR. Tyler Ballance <tyler@slide.com>2009-04-07 21:24:37 -0700
commit881e25003a68cd92c9e1e0b1dec44e464e220aca (patch)
treef44e21705620d08292ad4a1cb266438d7ec13504
parentf678aafc72c6248eb4f2f8143c0a8a92336872e5 (diff)
downloadpython-cheetah-881e25003a68cd92c9e1e0b1dec44e464e220aca.tar.gz
Syntax-highlight the code example on the home page
This will require anybody that wants to generate the page to install the Pygments module Signed-off-by: R. Tyler Ballance <tyler@slide.com>
-rw-r--r--index.html88
-rw-r--r--index.tmpl32
2 files changed, 95 insertions, 25 deletions
diff --git a/index.html b/index.html
index e21e86d..e6b130d 100644
--- a/index.html
+++ b/index.html
@@ -72,19 +72,85 @@ Fortune 500, as well startups in Silicon Valley (like <a href="http://www.slide.
<h2>Cheetah in a nutshell</h2>
<p>Below is a simple example of some Cheetah code, as you can see it's <em>pretty much</em> just Python. You can import, inherit and
define methods just like in a regular Python module, since that's what your Cheetah templates are compiled to :)</p>
-<pre><code>#from Cheetah.Template import Template
+<style type="text/css"><!--
+ .code_highlighter .hll { background-color: #ffffcc }
+.code_highlighter { background: #f8f8f8; }
+.code_highlighter .c { color: #408080; font-style: italic } /* Comment */
+.code_highlighter .err { border: 1px solid #FF0000 } /* Error */
+.code_highlighter .k { color: #008000; font-weight: bold } /* Keyword */
+.code_highlighter .o { color: #666666 } /* Operator */
+.code_highlighter .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.code_highlighter .cp { color: #BC7A00 } /* Comment.Preproc */
+.code_highlighter .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.code_highlighter .cs { color: #408080; font-style: italic } /* Comment.Special */
+.code_highlighter .gd { color: #A00000 } /* Generic.Deleted */
+.code_highlighter .ge { font-style: italic } /* Generic.Emph */
+.code_highlighter .gr { color: #FF0000 } /* Generic.Error */
+.code_highlighter .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.code_highlighter .gi { color: #00A000 } /* Generic.Inserted */
+.code_highlighter .go { color: #808080 } /* Generic.Output */
+.code_highlighter .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.code_highlighter .gs { font-weight: bold } /* Generic.Strong */
+.code_highlighter .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.code_highlighter .gt { color: #0040D0 } /* Generic.Traceback */
+.code_highlighter .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.code_highlighter .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.code_highlighter .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.code_highlighter .kp { color: #008000 } /* Keyword.Pseudo */
+.code_highlighter .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.code_highlighter .kt { color: #B00040 } /* Keyword.Type */
+.code_highlighter .m { color: #666666 } /* Literal.Number */
+.code_highlighter .s { color: #BA2121 } /* Literal.String */
+.code_highlighter .na { color: #7D9029 } /* Name.Attribute */
+.code_highlighter .nb { color: #008000 } /* Name.Builtin */
+.code_highlighter .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.code_highlighter .no { color: #880000 } /* Name.Constant */
+.code_highlighter .nd { color: #AA22FF } /* Name.Decorator */
+.code_highlighter .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.code_highlighter .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.code_highlighter .nf { color: #0000FF } /* Name.Function */
+.code_highlighter .nl { color: #A0A000 } /* Name.Label */
+.code_highlighter .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.code_highlighter .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.code_highlighter .nv { color: #19177C } /* Name.Variable */
+.code_highlighter .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.code_highlighter .w { color: #bbbbbb } /* Text.Whitespace */
+.code_highlighter .mf { color: #666666 } /* Literal.Number.Float */
+.code_highlighter .mh { color: #666666 } /* Literal.Number.Hex */
+.code_highlighter .mi { color: #666666 } /* Literal.Number.Integer */
+.code_highlighter .mo { color: #666666 } /* Literal.Number.Oct */
+.code_highlighter .sb { color: #BA2121 } /* Literal.String.Backtick */
+.code_highlighter .sc { color: #BA2121 } /* Literal.String.Char */
+.code_highlighter .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.code_highlighter .s2 { color: #BA2121 } /* Literal.String.Double */
+.code_highlighter .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.code_highlighter .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.code_highlighter .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.code_highlighter .sx { color: #008000 } /* Literal.String.Other */
+.code_highlighter .sr { color: #BB6688 } /* Literal.String.Regex */
+.code_highlighter .s1 { color: #BA2121 } /* Literal.String.Single */
+.code_highlighter .ss { color: #19177C } /* Literal.String.Symbol */
+.code_highlighter .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.code_highlighter .vc { color: #19177C } /* Name.Variable.Class */
+.code_highlighter .vg { color: #19177C } /* Name.Variable.Global */
+.code_highlighter .vi { color: #19177C } /* Name.Variable.Instance */
+.code_highlighter .il { color: #666666 } /* Literal.Number.Integer.Long */
+ --></style>
+
+<div class="code_highlighter"><pre>#from Cheetah.Template import Template
#extends Template
-#set $people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick', 'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}]
-&lt;strong&gt;How are you feeling?&lt;/strong&gt;
-&lt;ul&gt;
-#for $person in $people
- &lt;li&gt;
- $person['name'] is $person['mood']
- &lt;/li&gt;
-#end for
-&lt;/ul&gt;
-</code></pre>
+#set $people = [{&#39;name&#39; : &#39;Tom&#39;, &#39;mood&#39; : &#39;Happy&#39;}, {&#39;name&#39; : &#39;Dick&#39;, &#39;mood&#39; : &#39;Sad&#39;}, {&#39;name&#39; : &#39;Harry&#39;, &#39;mood&#39; : &#39;Hairy&#39;}]
+<span class="nt">&lt;strong&gt;</span>How are you feeling?<span class="nt">&lt;/strong&gt;</span>
+<span class="nt">&lt;ul&gt;</span>
+ #for $person in $people
+ <span class="nt">&lt;li&gt;</span>
+ $person[&#39;name&#39;] is $person[&#39;mood&#39;]
+ <span class="nt">&lt;/li&gt;</span>
+ #end for
+<span class="nt">&lt;/ul&gt;</span>
+</pre></div>
+
<h2>Why should I use Cheetah?</h2>
<ul>
<li>Cheetah is supported by every major Python web framework.</li>
diff --git a/index.tmpl b/index.tmpl
index 4bed4d2..2640e5d 100644
--- a/index.tmpl
+++ b/index.tmpl
@@ -1,11 +1,27 @@
#import WikiRoot
-#from Cheetah.Filters import Markdown
+#from Cheetah.Filters import Markdown, CodeHighlighter
#extends WikiRoot.WikiRoot
#def pagename()
#return 'Home'
#end def
+#def nutshell()
+#transform CodeHighlighter
+\#from Cheetah.Template import Template
+\#extends Template
+
+\#set \$people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick', 'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}]
+<strong>How are you feeling?</strong>
+<ul>
+ \#for \$person in \$people
+ <li>
+ \$person['name'] is \$person['mood']
+ </li>
+ \#end for
+</ul>
+#end def
+
#def content()
#transform Markdown
Community Cheetah
@@ -22,19 +38,7 @@ Cheetah in a nutshell
Below is a simple example of some Cheetah code, as you can see it's *pretty much* just Python. You can import, inherit and
define methods just like in a regular Python module, since that's what your Cheetah templates are compiled to :)
- \#from Cheetah.Template import Template
- \#extends Template
-
- \#set \$people = [{'name' : 'Tom', 'mood' : 'Happy'}, {'name' : 'Dick', 'mood' : 'Sad'}, {'name' : 'Harry', 'mood' : 'Hairy'}]
- <strong>How are you feeling?</strong>
- <ul>
- \#for \$person in \$people
- <li>
- \$person['name'] is \$person['mood']
- </li>
- \#end for
- </ul>
-
+$nutshell()
Why should I use Cheetah?
-------------------------