This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ColorMirror JS Editor for dbtemplates and EditableHeadfiles admin…
- Loading branch information
Showing
15 changed files
with
408 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* ---------------------------------------------------------------------------- | ||
CodeMirror | ||
http://marijn.haverbeke.nl/codemirror/css/ | ||
------------------------------------------------------------------------------- */ | ||
html * { | ||
font-family: monospace; | ||
font-size: 1em; | ||
} | ||
.editbox { | ||
width: 90%; | ||
margin: 0; | ||
padding: 0; | ||
color: black; | ||
} | ||
pre.code, .editbox { | ||
color: #666666; | ||
} | ||
.editbox p { | ||
margin: 0; | ||
} | ||
|
||
.CodeMirror-line-numbers { | ||
width:2.2em; | ||
text-align:right; | ||
color:#999; | ||
margin:.4em .4em .4em 6em; | ||
padding:0; | ||
} | ||
|
||
/* colors for xml, css and js */ | ||
span.css-unit,span.js-atom,span.xml-attribute{color:#281} | ||
span.css-identifier,span.js-variable,span.js-property,span.xml-punctuation,span.xml-text{color:#000} | ||
span.css-important,span.js-variabledef,span.xml-attname{color:#00F} | ||
span.css-colorcode,span.js-localvariable{color:#049} | ||
span.css-comment,span.js-comment,span.xml-comment{color:#A70} | ||
span.css-string,span.js-string,span.xml-entity{color:#A22} | ||
span.css-at,span.css-value,span.js-keyword{color:#708} | ||
span.js-punctuation,span.js-operator{color:#666} | ||
span.xml-tagname{color:#A0B} | ||
span.xml-cdata{color:#48A} | ||
span.xml-processing{color:#999} | ||
span.xml-error{color:red!important} |
87 changes: 87 additions & 0 deletions
87
pylucid_project/media/PyLucid/codemirror/codemirror_base.js
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
pylucid_project/media/PyLucid/codemirror/codemirror_min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
101 changes: 101 additions & 0 deletions
101
pylucid_project/media/PyLucid/codemirror/get_codemirror_files.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
""" | ||
PyLucid codemirror helper | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Get needed CodeMirror files and save it compressed. | ||
use: | ||
http://code.google.com/closure/compiler/ | ||
:copyleft: 2010 by the PyLucid team, see AUTHORS for more details. | ||
:license: GNU GPL v3 or above, see LICENSE for more details. | ||
""" | ||
|
||
import json # New in Python v2.6 | ||
import pprint | ||
import sys | ||
import time | ||
import urllib | ||
import datetime | ||
|
||
|
||
CLOSURE_COMPILTER_URL = "http://closure-compiler.appspot.com/compile" | ||
|
||
CODEMIRROR_BASE_URL = "http://marijn.haverbeke.nl/codemirror/js/" | ||
SOURCE_URLS = ( | ||
# Library | ||
("codemirror_min.js", [CODEMIRROR_BASE_URL + "codemirror.js"]), | ||
# base files | ||
("codemirror_base.js", [ | ||
CODEMIRROR_BASE_URL + "util.js", | ||
CODEMIRROR_BASE_URL + "stringstream.js", | ||
CODEMIRROR_BASE_URL + "select.js", | ||
CODEMIRROR_BASE_URL + "undo.js", | ||
CODEMIRROR_BASE_URL + "editor.js", | ||
CODEMIRROR_BASE_URL + "tokenize.js", | ||
]), | ||
# Parsers | ||
("parsecss.js", [CODEMIRROR_BASE_URL + "parsecss.js"]), | ||
("tokenizejavascript.js", [CODEMIRROR_BASE_URL + "tokenizejavascript.js"]), | ||
("parsejavascript.js", [CODEMIRROR_BASE_URL + "parsejavascript.js"]), | ||
("parsecss.js", [CODEMIRROR_BASE_URL + "parsecss.js"]), | ||
("parsehtmlmixed.js", [CODEMIRROR_BASE_URL + "parsehtmlmixed.js"]), | ||
|
||
# Contributed parsers | ||
("parsepython.js", ["http://marijn.haverbeke.nl/codemirror/contrib/python/js/parsepython.js"]), | ||
("parsedjango.js", ["http://github.com/jezdez/django-dbtemplates/raw/master/dbtemplates/media/dbtemplates/js/parsedjango.js"]), | ||
) | ||
|
||
# http://code.google.com/closure/compiler/docs/api-ref.html | ||
DEFAULTS = { | ||
# Required Request Parameters | ||
"compilation_level": "SIMPLE_OPTIMIZATIONS", | ||
"output_format": "json", | ||
"output_info": "compiled_code", | ||
} | ||
|
||
def get_and_save(filename, urls): | ||
print "_"*79 | ||
print " *** %r ***" % filename | ||
print "urls:" | ||
print "\n".join(urls) | ||
|
||
post_data = DEFAULTS.copy() | ||
post_data["code_url"] = urls | ||
# print post_data | ||
params = urllib.urlencode(post_data, doseq=True) | ||
# print params | ||
|
||
print "request %s..." % CLOSURE_COMPILTER_URL, | ||
start_time = time.time() | ||
f = urllib.urlopen(CLOSURE_COMPILTER_URL, params) | ||
payload = f.read() | ||
print "get response in %.2fsec" % (time.time()-start_time) | ||
|
||
response_data = json.loads(payload) | ||
if not "compiledCode" in response_data: | ||
print "Response error, response data:" | ||
pprint.pprint(response_data) | ||
else: | ||
code = response_data["compiledCode"] | ||
print "compressed code length:", len(code) | ||
print "Write file...", | ||
f = file(filename, "w") | ||
f.write("/* content from:\n") | ||
for url in urls: | ||
f.write(" * %s\n" % url) | ||
f.write(" * closure compiled %s */\n" % datetime.date.today().isoformat()) | ||
f.write(code) | ||
f.close() | ||
print "OK" | ||
|
||
print "-"*79 | ||
|
||
if __name__ == "__main__": | ||
for filename, urls in SOURCE_URLS: | ||
get_and_save(filename, urls) | ||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.