From f1b0372d1cad18dd5e70d04d473b0feb469253c7 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Sun, 10 May 2015 18:31:45 +0200 Subject: Add pygments syntax highlighting --- Makefile | 2 +- scripts/bupa | 3 +- src/pygments-default.css | 63 +++++++++++++++++++++++++++++++++++++++ src/templates/layout-journal.html | 1 + 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 src/pygments-default.css diff --git a/Makefile b/Makefile index 0e3a90b..d0824af 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ HTML := index.html journal.html about.html -CSS := style.css journal/isso.css +CSS := style.css pygments-default.css journal/isso.css RESOURCES := glider.png me.jpg TEMPLATES := $(shell find src/templates) diff --git a/scripts/bupa b/scripts/bupa index e87ca4c..3802982 100755 --- a/scripts/bupa +++ b/scripts/bupa @@ -29,7 +29,8 @@ class Page(object): def reST_to_html(s, id_prefix='id'): formated = core.publish_parts(s, writer_name='html4css1', settings_overrides={'footnote_references': 'superscript', - 'auto_id_prefix': str(id_prefix) + '-',}) + 'auto_id_prefix': str(id_prefix) + '-', + 'syntax_highlight': 'short'}) return formated['fragment'] def filename_to_id(file_name): diff --git a/src/pygments-default.css b/src/pygments-default.css new file mode 100644 index 0000000..d96c334 --- /dev/null +++ b/src/pygments-default.css @@ -0,0 +1,63 @@ +/* generated with ``pygmentize -S default -f html -a pre.code`` */ +pre.code .hll { background-color: #ffffcc } +pre.code { background: #f8f8f8; } +pre.code .c { color: #408080; font-style: italic } /* Comment */ +pre.code .err { border: 1px solid #FF0000 } /* Error */ +pre.code .k { color: #008000; font-weight: bold } /* Keyword */ +pre.code .o { color: #666666 } /* Operator */ +pre.code .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +pre.code .cp { color: #BC7A00 } /* Comment.Preproc */ +pre.code .c1 { color: #408080; font-style: italic } /* Comment.Single */ +pre.code .cs { color: #408080; font-style: italic } /* Comment.Special */ +pre.code .gd { color: #A00000 } /* Generic.Deleted */ +pre.code .ge { font-style: italic } /* Generic.Emph */ +pre.code .gr { color: #FF0000 } /* Generic.Error */ +pre.code .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +pre.code .gi { color: #00A000 } /* Generic.Inserted */ +pre.code .go { color: #808080 } /* Generic.Output */ +pre.code .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +pre.code .gs { font-weight: bold } /* Generic.Strong */ +pre.code .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +pre.code .gt { color: #0040D0 } /* Generic.Traceback */ +pre.code .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +pre.code .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +pre.code .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +pre.code .kp { color: #008000 } /* Keyword.Pseudo */ +pre.code .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +pre.code .kt { color: #B00040 } /* Keyword.Type */ +pre.code .m { color: #666666 } /* Literal.Number */ +pre.code .s { color: #BA2121 } /* Literal.String */ +pre.code .na { color: #7D9029 } /* Name.Attribute */ +pre.code .nb { color: #008000 } /* Name.Builtin */ +pre.code .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +pre.code .no { color: #880000 } /* Name.Constant */ +pre.code .nd { color: #AA22FF } /* Name.Decorator */ +pre.code .ni { color: #999999; font-weight: bold } /* Name.Entity */ +pre.code .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +pre.code .nf { color: #0000FF } /* Name.Function */ +pre.code .nl { color: #A0A000 } /* Name.Label */ +pre.code .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +pre.code .nt { color: #008000; font-weight: bold } /* Name.Tag */ +pre.code .nv { color: #19177C } /* Name.Variable */ +pre.code .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +pre.code .w { color: #bbbbbb } /* Text.Whitespace */ +pre.code .mf { color: #666666 } /* Literal.Number.Float */ +pre.code .mh { color: #666666 } /* Literal.Number.Hex */ +pre.code .mi { color: #666666 } /* Literal.Number.Integer */ +pre.code .mo { color: #666666 } /* Literal.Number.Oct */ +pre.code .sb { color: #BA2121 } /* Literal.String.Backtick */ +pre.code .sc { color: #BA2121 } /* Literal.String.Char */ +pre.code .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +pre.code .s2 { color: #BA2121 } /* Literal.String.Double */ +pre.code .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +pre.code .sh { color: #BA2121 } /* Literal.String.Heredoc */ +pre.code .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +pre.code .sx { color: #008000 } /* Literal.String.Other */ +pre.code .sr { color: #BB6688 } /* Literal.String.Regex */ +pre.code .s1 { color: #BA2121 } /* Literal.String.Single */ +pre.code .ss { color: #19177C } /* Literal.String.Symbol */ +pre.code .bp { color: #008000 } /* Name.Builtin.Pseudo */ +pre.code .vc { color: #19177C } /* Name.Variable.Class */ +pre.code .vg { color: #19177C } /* Name.Variable.Global */ +pre.code .vi { color: #19177C } /* Name.Variable.Instance */ +pre.code .il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/src/templates/layout-journal.html b/src/templates/layout-journal.html index 83765bd..4ad4589 100644 --- a/src/templates/layout-journal.html +++ b/src/templates/layout-journal.html @@ -4,6 +4,7 @@ {{ title }} + -- cgit v1.2.3-70-g09d2