diff options
-rw-r--r-- | content/style.scss | 138 | ||||
-rwxr-xr-x | generate.py | 8 |
2 files changed, 80 insertions, 66 deletions
diff --git a/content/style.scss b/content/style.scss index 2c80e91..2ac18d5 100644 --- a/content/style.scss +++ b/content/style.scss @@ -33,7 +33,7 @@ nav { a:active { color: darkgrey; } } -code, div.codehilite pre { +div.codehilite pre { border: 1px dashed #DDD; background-color: #FAFAFA; padding: 0.1em; @@ -88,65 +88,77 @@ ul.projects { list-style: none; } -/* Syntax highlighting mess */ -.codehilite { - .c { color: #998; font-style: italic } - .err { color: #a61717; background-color: #e3d2d2 } - .k { font-weight: bold } - .o { font-weight: bold } - .cm { color: #998; font-style: italic } - .cp { color: #999; font-weight: bold } - .c1 { color: #998; font-style: italic } - .cs { color: #999; font-weight: bold; font-style: italic } - .gd { color: #000; background-color: #fdd } - .gd .x { color: #000; background-color: #faa } - .ge { font-style: italic } - .gr { color: #a00 } - .gh { color: #999 } - .gi { color: #000; background-color: #dfd } - .gi .x { color: #000; background-color: #afa } - .go { color: #888 } - .gp { color: #555 } - .gs { font-weight: bold } - .gu { color: #aaa } - .gt { color: #a00 } - .kc { font-weight: bold } - .kd { font-weight: bold } - .kp { font-weight: bold } - .kr { font-weight: bold } - .kt { color: #458; font-weight: bold } - .m { color: #099 } - .s { color: #d14 } - .na { color: #008080 } - .nb { color: #0086B3 } - .nc { color: #458; font-weight: bold } - .no { color: #008080 } - .ni { color: #800080 } - .ne { color: #900; font-weight: bold } - .nf { color: #900; font-weight: bold } - .nn { color: #555 } - .nt { color: #000080 } - .nv { color: #008080 } - .ow { font-weight: bold } - .w { color: #bbb } - .mf { color: #099 } - .mh { color: #099 } - .mi { color: #099 } - .mo { color: #099 } - .sb { color: #d14 } - .sc { color: #d14 } - .sd { color: #d14 } - .s2 { color: #d14 } - .se { color: #d14 } - .sh { color: #d14 } - .si { color: #d14 } - .sx { color: #d14 } - .sr { color: #009926 } - .s1 { color: #d14 } - .ss { color: #990073 } - .bp { color: #999 } - .vc { color: #008080 } - .vg { color: #008080 } - .vi { color: #008080 } - .il { color: #099 } -} +pre { line-height: 125%; } +td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } +td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.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 .ch { color: #408080; font-style: italic } /* Comment.Hashbang */ +.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */ +.codehilite .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */ +.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: #888888 } /* 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: #0044DD } /* 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 .mb { color: #666666 } /* Literal.Number.Bin */ +.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 .sa { color: #BA2121 } /* Literal.String.Affix */ +.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */ +.codehilite .sc { color: #BA2121 } /* Literal.String.Char */ +.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */ +.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 .fm { color: #0000FF } /* Name.Function.Magic */ +.codehilite .vc { color: #19177C } /* Name.Variable.Class */ +.codehilite .vg { color: #19177C } /* Name.Variable.Global */ +.codehilite .vi { color: #19177C } /* Name.Variable.Instance */ +.codehilite .vm { color: #19177C } /* Name.Variable.Magic */ +.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/generate.py b/generate.py index b18e1c2..96bfcb2 100755 --- a/generate.py +++ b/generate.py @@ -8,6 +8,7 @@ from itertools import chain from jinja2 import Environment, FileSystemLoader, Markup from markdown import markdown from operator import attrgetter +from scss import Compiler from subprocess import call as run from sys import argv import meta @@ -25,8 +26,8 @@ ERRORS = { 504: "Gateway Timeout", } -md = lambda s: Markup(markdown(s, extensions=['markdown.extensions.fenced_code', - 'markdown.extensions.codehilite'])) +md = lambda s: Markup(markdown(s, extensions=['fenced_code', + 'codehilite'])) File = namedtuple('File', 'content date slug ext') def parse(path, has_date=False): @@ -171,7 +172,8 @@ def main(argv=['generate.py']): } output('error/{}.html'.format(code), env.get_template('error.html').render(page=page)) - run(['scss', os.path.join(CONTENT, 'style.scss'), os.path.join(OUTPUT, 'style.css')]) + with open(os.path.join(OUTPUT, 'style.css'), 'w') as f: + f.write(Compiler().compile(os.path.join(CONTENT, 'style.scss'))) run(['cp', '-r', os.path.join(CONTENT, 'images'), OUTPUT]) if __name__ == '__main__': |