Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 25 Oct 2015 21:51:11 UTC Commit: d3b2a97510fdceb8aeed486d571cc2e3feadc614 https://github.com/geany/www.geany.org/commit/d3b2a97510fdceb8aeed486d571cc2...
Log Message: ----------- Migrate Pygments CSS update script into a management command
Same behavior but now cleanly integrated into Django as management command: python manage.py generate_snippets_css
Modified Paths: -------------- pastebin/management/commands/generate_snippets_css.py pastebin/static/css/pygments.css
Modified: pastebin/management/commands/generate_snippets_css.py 21 lines changed, 12 insertions(+), 9 deletions(-) =================================================================== @@ -1,25 +1,28 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- -# # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. -# +# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
+from django.core.management.base import BaseCommand from pygments.formatters import HtmlFormatter
-f = open('pastebin/static/css/pygments.css', 'w') - -# You can change style and the html class here: -f.write(HtmlFormatter(style='colorful').get_style_defs('.code')) +######################################################################## +class Command(BaseCommand): + help = "Regenerate CSS for snippet sxntax highlighting py Pygments" + requires_system_checks = False
-f.close() + #---------------------------------------------------------------------- + def handle(self, *args, **options): + with open('pastebin/static/css/pygments.css', 'w') as css_file: + # You can change style and the html class here: + css_file.write(HtmlFormatter(style='colorful').get_style_defs('.code'))
Modified: pastebin/static/css/pygments.css 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -40,6 +40,7 @@ .code .nv { color: #996633 } /* Name.Variable */ .code .ow { color: #000000; font-weight: bold } /* Operator.Word */ .code .w { color: #bbbbbb } /* Text.Whitespace */ +.code .mb { color: #6600EE; font-weight: bold } /* Literal.Number.Bin */ .code .mf { color: #6600EE; font-weight: bold } /* Literal.Number.Float */ .code .mh { color: #005588; font-weight: bold } /* Literal.Number.Hex */ .code .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).