[gimp-web/gimp-web-static] Added styling for code blocks with pygment and codehilite



commit b42b51ac8aada7786ee71419e89e98db1ca1e4ff
Author: Pat David <patdavid gmail com>
Date:   Thu Aug 6 13:40:17 2015 -0500

    Added styling for code blocks with pygment and codehilite

 content/about/meta/index.md                     |   23 ++++++++
 pelicanconf.py                                  |    2 +
 themes/newgimp/static/css/gimp.css              |   20 +++++++
 themes/newgimp/static/css/pygments-colorful.css |   61 ++++++++++++++++++++++
 themes/newgimp/static/css/pygments-default.css  |   62 +++++++++++++++++++++++
 themes/newgimp/templates/page.html              |    1 +
 6 files changed, 169 insertions(+), 0 deletions(-)
---
diff --git a/content/about/meta/index.md b/content/about/meta/index.md
index 7918b7c..e89f7fb 100644
--- a/content/about/meta/index.md
+++ b/content/about/meta/index.md
@@ -115,6 +115,29 @@ To hide a page from being included on the navigation elements, add to the pages
 `status: hidden`
 
 
+#### Python SimpleHTTPServer & SVG
+
+Apparently the python (2.7.x) built-in http server doesn't serve .svg files correctly for use as images in 
html.
+To fix this, either run a different http server to test with, or from [this blog 
post](http://gotmetoo.blogspot.com/2013/07/python-simple-http-server-with-svg.html) you can do this:
+
+    :::python
+    #!/usr/bin/python 
+    import SimpleHTTPServer
+    import SocketServer
+    import mimetypes
+    
+    PORT = 8000
+    
+    Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
+    
+    Handler.extensions_map['.svg']='image/svg+xml'
+    httpd = SocketServer.TCPServer(("", PORT), Handler)
+    
+    print "serving at port", PORT
+    httpd.serve_forever()
+
+Or just be aware that any SVG elements used as images will not display correctly on the page (but *should* 
display fine when being served from wgo).
+
 
 [WGO Redesign]: http://wiki.gimp.org/index.php?title=WGO_Redesign
 [Markdown]: http://daringfireball.net/projects/markdown/ 
diff --git a/pelicanconf.py b/pelicanconf.py
index 3ae80ce..9eacff6 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -73,3 +73,5 @@ TYPOGRIFY = True
 TYPOGRIFY_IGNORE_TAGS = ['title']
 
 DELETE_OUTPUT_DIRECTORY = True
+
+MD_EXTENSIONS = ['fenced_code', 'codehilite(css_class=codehilite)', 'extra']
diff --git a/themes/newgimp/static/css/gimp.css b/themes/newgimp/static/css/gimp.css
index 55c9f8f..4166461 100644
--- a/themes/newgimp/static/css/gimp.css
+++ b/themes/newgimp/static/css/gimp.css
@@ -80,3 +80,23 @@ figure {
     display: inline;
     vertical-align: text-top;
 }
+
+.codehilitetable {
+    margin: 1rem auto;
+    font-size: 0.8rem;
+    max-width: 34rem;
+    width: 34rem;
+}
+
+.codehilite {
+    font-size: 0.8rem;
+    max-width: 34rem;
+    margin: 1rem auto;
+    padding: 0.5rem;
+    border: solid 1px #ddd;
+    border-radius: 3px;
+}
+
+.codehilite pre {
+    margin: 0;
+}
diff --git a/themes/newgimp/static/css/pygments-colorful.css b/themes/newgimp/static/css/pygments-colorful.css
new file mode 100644
index 0000000..72750df
--- /dev/null
+++ b/themes/newgimp/static/css/pygments-colorful.css
@@ -0,0 +1,61 @@
+.codehilite .hll { background-color: #ffffcc }
+.codehilite .c { color: #808080 } /* Comment */
+.codehilite .err { color: #F00000; background-color: #F0A0A0 } /* Error */
+.codehilite .k { color: #008000; font-weight: bold } /* Keyword */
+.codehilite .o { color: #303030 } /* Operator */
+.codehilite .cm { color: #808080 } /* Comment.Multiline */
+.codehilite .cp { color: #507090 } /* Comment.Preproc */
+.codehilite .c1 { color: #808080 } /* Comment.Single */
+.codehilite .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
+.codehilite .gd { color: #A00000 } /* Generic.Deleted */
+.codehilite .ge { font-style: italic } /* Generic.Emph */
+.codehilite .gr { color: #FF0000 } /* Generic.Error */
+.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.codehilite .gi { color: #00A000 } /* Generic.Inserted */
+.codehilite .go { color: #808080 } /* Generic.Output */
+.codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
+.codehilite .gs { font-weight: bold } /* Generic.Strong */
+.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
+.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.codehilite .kp { color: #003080; font-weight: bold } /* Keyword.Pseudo */
+.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.codehilite .kt { color: #303090; font-weight: bold } /* Keyword.Type */
+.codehilite .m { color: #6000E0; font-weight: bold } /* Literal.Number */
+.codehilite .s { background-color: #fff0f0 } /* Literal.String */
+.codehilite .na { color: #0000C0 } /* Name.Attribute */
+.codehilite .nb { color: #007020 } /* Name.Builtin */
+.codehilite .nc { color: #B00060; font-weight: bold } /* Name.Class */
+.codehilite .no { color: #003060; font-weight: bold } /* Name.Constant */
+.codehilite .nd { color: #505050; font-weight: bold } /* Name.Decorator */
+.codehilite .ni { color: #800000; font-weight: bold } /* Name.Entity */
+.codehilite .ne { color: #F00000; font-weight: bold } /* Name.Exception */
+.codehilite .nf { color: #0060B0; font-weight: bold } /* Name.Function */
+.codehilite .nl { color: #907000; font-weight: bold } /* Name.Label */
+.codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.codehilite .nt { color: #007000 } /* Name.Tag */
+.codehilite .nv { color: #906030 } /* Name.Variable */
+.codehilite .ow { color: #000000; font-weight: bold } /* Operator.Word */
+.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
+.codehilite .mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */
+.codehilite .mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */
+.codehilite .mi { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */
+.codehilite .mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */
+.codehilite .sb { background-color: #fff0f0 } /* Literal.String.Backtick */
+.codehilite .sc { color: #0040D0 } /* Literal.String.Char */
+.codehilite .sd { color: #D04020 } /* Literal.String.Doc */
+.codehilite .s2 { background-color: #fff0f0 } /* Literal.String.Double */
+.codehilite .se { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */
+.codehilite .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */
+.codehilite .si { background-color: #e0e0e0 } /* Literal.String.Interpol */
+.codehilite .sx { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */
+.codehilite .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */
+.codehilite .s1 { background-color: #fff0f0 } /* Literal.String.Single */
+.codehilite .ss { color: #A06000 } /* Literal.String.Symbol */
+.codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.codehilite .vc { color: #306090 } /* Name.Variable.Class */
+.codehilite .vg { color: #d07000; font-weight: bold } /* Name.Variable.Global */
+.codehilite .vi { color: #3030B0 } /* Name.Variable.Instance */
+.codehilite .il { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */
diff --git a/themes/newgimp/static/css/pygments-default.css b/themes/newgimp/static/css/pygments-default.css
new file mode 100644
index 0000000..ef95359
--- /dev/null
+++ b/themes/newgimp/static/css/pygments-default.css
@@ -0,0 +1,62 @@
+.codehilite .hll { background-color: #ffffcc }
+.codehilite  { background: #f8f8f8; }
+.codehilite .c { color: #408080; font-style: italic } /* Comment */
+.codehilite .err { border: 1px solid #FF0000 } /* Error */
+.codehilite .k { color: #008000; font-weight: bold } /* Keyword */
+.codehilite .o { color: #666666 } /* Operator */
+.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */
+.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */
+.codehilite .gd { color: #A00000 } /* Generic.Deleted */
+.codehilite .ge { font-style: italic } /* Generic.Emph */
+.codehilite .gr { color: #FF0000 } /* Generic.Error */
+.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.codehilite .gi { color: #00A000 } /* Generic.Inserted */
+.codehilite .go { color: #808080 } /* Generic.Output */
+.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.codehilite .gs { font-weight: bold } /* Generic.Strong */
+.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
+.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.codehilite .kp { color: #008000 } /* Keyword.Pseudo */
+.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.codehilite .kt { color: #B00040 } /* Keyword.Type */
+.codehilite .m { color: #666666 } /* Literal.Number */
+.codehilite .s { color: #BA2121 } /* Literal.String */
+.codehilite .na { color: #7D9029 } /* Name.Attribute */
+.codehilite .nb { color: #008000 } /* Name.Builtin */
+.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.codehilite .no { color: #880000 } /* Name.Constant */
+.codehilite .nd { color: #AA22FF } /* Name.Decorator */
+.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.codehilite .nf { color: #0000FF } /* Name.Function */
+.codehilite .nl { color: #A0A000 } /* Name.Label */
+.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.codehilite .nv { color: #19177C } /* Name.Variable */
+.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
+.codehilite .mf { color: #666666 } /* Literal.Number.Float */
+.codehilite .mh { color: #666666 } /* Literal.Number.Hex */
+.codehilite .mi { color: #666666 } /* Literal.Number.Integer */
+.codehilite .mo { color: #666666 } /* Literal.Number.Oct */
+.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */
+.codehilite .sc { color: #BA2121 } /* Literal.String.Char */
+.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */
+.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.codehilite .sx { color: #008000 } /* Literal.String.Other */
+.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */
+.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */
+.codehilite .ss { color: #19177C } /* Literal.String.Symbol */
+.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.codehilite .vc { color: #19177C } /* Name.Variable.Class */
+.codehilite .vg { color: #19177C } /* Name.Variable.Global */
+.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
+.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */
diff --git a/themes/newgimp/templates/page.html b/themes/newgimp/templates/page.html
index 5dfa5b6..66d37e2 100644
--- a/themes/newgimp/templates/page.html
+++ b/themes/newgimp/templates/page.html
@@ -5,6 +5,7 @@
 {% block head %}
 {{ super() }}
 <link rel='stylesheet' type='text/css' href="{{ SITEURL }}/theme/css/page.css" />
+<link rel='stylesheet' type='text/css' href="{{ SITEURL }}/theme/css/pygments-default.css" />
 
 {% endblock head %}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]