5dec1cfcdb6b

Added syntax highlighting support for blog entries.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 16 Jan 2009 00:22:26 -0500
parents b3bddbff0eed
children 532be74eed8f
branches/tags (none)
files site-media/style/blog.css site-media/style/code.css site-media/style/stevelosh.css templates/blog/base.html templates/blog/entry.html

Changes

--- a/site-media/style/blog.css	Thu Jan 15 22:18:32 2009 -0500
+++ b/site-media/style/blog.css	Fri Jan 16 00:22:26 2009 -0500
@@ -45,6 +45,10 @@
     margin-bottom: 1.5em;
 }
 
+div#blog-entry-comments h2{
+    font-weight: normal;
+}
+
 div#blog-entry-new-comment {
     margin-top: 1.5em;
 }
@@ -53,6 +57,10 @@
     margin-left: 2em;
 }
 
+div.blog-entry-comment-body code {
+    font-size: 1.0em;
+}
+
 div.wmd-preview {
     margin-left: 2em;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/site-media/style/code.css	Fri Jan 16 00:22:26 2009 -0500
@@ -0,0 +1,107 @@
+table.codehilitetable { 
+	margin-left: 2em;
+}
+
+div.codehilite { 
+	margin-left: 2em; 
+}
+
+.codehilitetable div.codehilite { 
+	margin-left: 0em;
+    margin-right: 1.5em;
+}
+
+.codehilitetable pre, .codehilitetable blockquote {
+    margin: 0em;
+    padding-top: 1em;
+    padding-bottom: 1em;
+    background-color: #f9f9f9;
+    border: 1px solid #eee;
+}
+
+.codehilitetable td.linenos  { 
+	padding: 0em;
+}
+
+div.codehilite pre { 
+	margin-left: 0em;
+	padding-left: 1em; 
+	padding-right: 1em;
+	padding-bottom: 1em;
+}
+
+.codehilitetable td.linenos pre { 
+	padding-right: 0.75em;
+	padding-left: 1em;
+}
+
+.codehilite .hll { background-color: #ffffcc }
+.codehilite  { background: #f9f9f9; }
+.codehilite .c { color: #8f5902; font-style: italic } /* Comment */
+.codehilite .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
+.codehilite .g { color: #000000 } /* Generic */
+.codehilite .k { color: #204a87; font-weight: bold } /* Keyword */
+.codehilite .l { color: #000000 } /* Literal */
+.codehilite .n { color: #000000 } /* Name */
+.codehilite .o { color: #ce5c00; font-weight: bold } /* Operator */
+.codehilite .x { color: #000000 } /* Other */
+.codehilite .p { color: #000000; font-weight: bold } /* Punctuation */
+.codehilite .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
+.codehilite .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
+.codehilite .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
+.codehilite .cs { color: #8f5902; font-style: italic } /* Comment.Special */
+.codehilite .gd { color: #a40000 } /* Generic.Deleted */
+.codehilite .ge { color: #000000; font-style: italic } /* Generic.Emph */
+.codehilite .gr { color: #ef2929 } /* Generic.Error */
+.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.codehilite .gi { color: #00A000 } /* Generic.Inserted */
+.codehilite .go { color: #000000; font-style: italic } /* Generic.Output */
+.codehilite .gp { color: #8f5902 } /* Generic.Prompt */
+.codehilite .gs { color: #000000; font-weight: bold } /* Generic.Strong */
+.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.codehilite .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
+.codehilite .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
+.codehilite .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
+.codehilite .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
+.codehilite .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
+.codehilite .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
+.codehilite .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
+.codehilite .ld { color: #000000 } /* Literal.Date */
+.codehilite .m { color: #0000cf; font-weight: bold } /* Literal.Number */
+.codehilite .s { color: #4e9a06 } /* Literal.String */
+.codehilite .na { color: #c4a000 } /* Name.Attribute */
+.codehilite .nb { color: #204a87 } /* Name.Builtin */
+.codehilite .nc { color: #000000 } /* Name.Class */
+.codehilite .no { color: #000000 } /* Name.Constant */
+.codehilite .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
+.codehilite .ni { color: #ce5c00 } /* Name.Entity */
+.codehilite .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
+.codehilite .nf { color: #000000 } /* Name.Function */
+.codehilite .nl { color: #f57900 } /* Name.Label */
+.codehilite .nn { color: #000000 } /* Name.Namespace */
+.codehilite .nx { color: #000000 } /* Name.Other */
+.codehilite .py { color: #000000 } /* Name.Property */
+.codehilite .nt { color: #204a87; font-weight: bold } /* Name.Tag */
+.codehilite .nv { color: #000000 } /* Name.Variable */
+.codehilite .ow { color: #204a87; font-weight: bold } /* Operator.Word */
+.codehilite .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
+.codehilite .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
+.codehilite .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
+.codehilite .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
+.codehilite .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
+.codehilite .sb { color: #4e9a06 } /* Literal.String.Backtick */
+.codehilite .sc { color: #4e9a06 } /* Literal.String.Char */
+.codehilite .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
+.codehilite .s2 { color: #4e9a06 } /* Literal.String.Double */
+.codehilite .se { color: #4e9a06 } /* Literal.String.Escape */
+.codehilite .sh { color: #4e9a06 } /* Literal.String.Heredoc */
+.codehilite .si { color: #4e9a06 } /* Literal.String.Interpol */
+.codehilite .sx { color: #4e9a06 } /* Literal.String.Other */
+.codehilite .sr { color: #4e9a06 } /* Literal.String.Regex */
+.codehilite .s1 { color: #4e9a06 } /* Literal.String.Single */
+.codehilite .ss { color: #4e9a06 } /* Literal.String.Symbol */
+.codehilite .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
+.codehilite .vc { color: #000000 } /* Name.Variable.Class */
+.codehilite .vg { color: #000000 } /* Name.Variable.Global */
+.codehilite .vi { color: #000000 } /* Name.Variable.Instance */
+.codehilite .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
\ No newline at end of file
--- a/site-media/style/stevelosh.css	Thu Jan 15 22:18:32 2009 -0500
+++ b/site-media/style/stevelosh.css	Fri Jan 16 00:22:26 2009 -0500
@@ -6,10 +6,12 @@
     margin-bottom: 5em;
 }
 
-p, ol, ul, code {
+p, ol, ul, pre, code, blockquote {
     font-size: 1.2em;
 }
 
+p code { background-color: #eee; padding: 2px; border: 1px solid #ddd; }
+
 input, textarea {
     font-size: 1.0em;
     margin: 0em;
@@ -104,5 +106,3 @@
 .invalid {
     color: #F00;
 }
-
-p code { background-color: #eee; padding: 2px; border: 1px solid #ddd; }
\ No newline at end of file
--- a/templates/blog/base.html	Thu Jan 15 22:18:32 2009 -0500
+++ b/templates/blog/base.html	Fri Jan 16 00:22:26 2009 -0500
@@ -5,6 +5,8 @@
 {% block style %}
 	<link rel="stylesheet" href="/site-media/style/blog.css" 
 		  type="text/css"/>
+	<link rel="stylesheet" href="/site-media/style/code.css" 
+		  type="text/css"/>
 {% endblock %}
 
 {% block header %}/ blog{% endblock %}
\ No newline at end of file
--- a/templates/blog/entry.html	Thu Jan 15 22:18:32 2009 -0500
+++ b/templates/blog/entry.html	Fri Jan 16 00:22:26 2009 -0500
@@ -27,7 +27,7 @@
 			</p>
 		</div>
 		<div id="blog-entry-body" class="content">
-			{{ entry.body|markdown }}
+			{{ entry.body|markdown:"codehilite" }}
 		</div>
 	</div>
 	<hr />