forked from GithubBackups/healthchecks
pygmentize management command needs to be run rarely, and only during development. Remove Pygments from requirements.txt
This commit is contained in:
parent
5d2cc0b0fc
commit
144cf0da90
@ -1,9 +1,9 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from pygments import highlight, lexers
|
||||
from pygments.formatters import HtmlFormatter
|
||||
|
||||
|
||||
def _process(fin, fout, lexer):
|
||||
from pygments import highlight
|
||||
from pygments.formatters import HtmlFormatter
|
||||
source = open("templates/front/snippets/" + fin).read()
|
||||
processed = highlight(source, lexer, HtmlFormatter())
|
||||
processed = processed.replace("PING_URL", "{{ ping_url }}")
|
||||
@ -12,9 +12,18 @@ def _process(fin, fout, lexer):
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Compiles snippets with pygmentize'
|
||||
help = 'Compiles snippets with Pygments'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
try:
|
||||
from pygments import lexers
|
||||
except ImportError:
|
||||
self.stdout.write("This command requires Pygments package.")
|
||||
self.stdout.write("Please install it with:\n\n")
|
||||
self.stdout.write(" pip install Pygments\n\n")
|
||||
return
|
||||
|
||||
_process("bash.txt", "bash.html", lexers.BashLexer())
|
||||
_process("browser.txt", "browser.html", lexers.JavascriptLexer())
|
||||
_process("crontab.txt", "crontab.html", lexers.BashLexer())
|
||||
|
@ -6,5 +6,4 @@ djmail==0.11.0
|
||||
futures==3.0.3
|
||||
premailer==2.9.6
|
||||
psycopg2==2.6.1
|
||||
Pygments==2.0.2
|
||||
requests==2.8.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user