From 43c6b2ca0191dd0e0d7c0e2ca5aa11e4cc15d76a Mon Sep 17 00:00:00 2001 From: Severyn Kozak Date: Wed, 14 May 2014 22:46:17 -0400 Subject: [PATCH] Add languages.json, integrate with languages.py. Add: bitshift/resources -Add directory for bitshift's Python resources. bitshift/resources/languages.json -Add `json` file containing all the programming languages supported by bitshift. bitshift/languages.py -Set `LANGS` by reading `languages.json`. --- app.py | 3 ++- bitshift/languages.py | 5 ++++- bitshift/resources/languages.json | 4 ++++ static/sass/index.sass | 2 -- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 bitshift/resources/languages.json diff --git a/app.py b/app.py index 3fae72f..92949bd 100644 --- a/app.py +++ b/app.py @@ -6,6 +6,7 @@ from flask import Flask from flask import render_template, session from bitshift import assets +from bitshift import languages # from bitshift.database import Database # from bitshift.query import parse_query @@ -20,7 +21,7 @@ app_env.globals.update(assets=assets) @app.route("/") def index(): - return render_template("index.html") + return render_template("index.html", typeahead_languages=languages.LANGS) @app.route("/search/") def search(query): diff --git a/bitshift/languages.py b/bitshift/languages.py index b04c094..78c0830 100644 --- a/bitshift/languages.py +++ b/bitshift/languages.py @@ -1,2 +1,5 @@ +import json -LANGS = ["Python", "C", "Java", "Ruby"] +with open("bitshift/resources/languages.json") as lang_json: + LANGS = [lang.encode("ascii","ignore") for lang in + json.load(lang_json)["languages"]] diff --git a/bitshift/resources/languages.json b/bitshift/resources/languages.json new file mode 100644 index 0000000..02ca0ad --- /dev/null +++ b/bitshift/resources/languages.json @@ -0,0 +1,4 @@ +{ + "_comment" : "A list of programming languages supported by `bitshift`.", + "languages" : ["Debian Sourcelist", "Delphi", "JavaScript+Mako", "Brainfuck", "Ceylon", "JavaScript+Django/Jinja", "HTML+Evoque", "NumPy", "Modula-2", "LiveScript", "Nimrod", "Bash", "HTML+Django/Jinja", "CSS+PHP", "XML+Lasso", "VimL", "CSS+Genshi Text", "Fancy", "Coldfusion HTML", "cfstatement", "Scalate Server Page", "Smarty", "XML+Evoque", "haXe", "PowerShell", "Tea", "HTML+Cheetah", "Mason", "Django/Jinja", "JAGS", "ApacheConf", "DTD", "Lighttpd configuration file", "Java", "JavaScript+Genshi Text", "Scheme", "Nemerle", "RHTML", "Ragel in Java Host", "Darcs Patch", "Puppet", "Octave", "CoffeeScript", "Ragel in D Host", "Scilab", "Monkey", "HTML+Myghty", "CSS", "JavaScript+Smarty", "Io", "COBOLFree", "Asymptote", "vhdl", "Python 3", "CSS+Ruby", "Fortran", "d-objdump", "MySQL", "REBOL", "C++", "ERB", "CBM BASIC V2", "Befunge", "Julia", "MoonScript", "Ruby", "XML+Smarty", "Dylan", "Groovy", "MoinMoin/Trac Wiki markup", "autohotkey", "C", "HTML", "Felix", "CMake", "NSIS", "SourcePawn", "Mako", "VGL", "Velocity", "Koka", "CUDA", "Gnuplot", "IRC logs", "Prolog", "Python", "CSS+Django/Jinja", "verilog", "Smalltalk", "JavaScript+Myghty", "YAML", "Julia console", "ANTLR With ActionScript Target", "XML+Mako", "XSLT", "UrbiScript", "Scaml", "S", "DylanLID", "MAQL", "sqlite3con", "Boo", "OCaml", "eC", "ActionScript", "VB.net", "SquidConf", "XQuery", "D", "Fantom", "Gettext Catalog", "Logos", "Lasso", "SCSS", "BBCode", "Haml", "FoxPro", "Python 3.0 Traceback", "MuPAD", "XML+Ruby", "Dart", "IDL", "dg", "Evoque", "Jade", "c-objdump", "Kconfig", "Java Server Page", "reg", "ABAP", "XML+Velocity", "JavaScript+Cheetah", "HTML+Mako", "Ragel in Ruby Host", "RobotFramework", "Protocol Buffer", "CFEngine3", "Ragel", "GLSL", "COBOL", "TypeScript", "Ada", "PostgreSQL SQL dialect", "Xtend", "Logtalk", "objdump", "CSS+Mako", "ca65", "Objective-C++", "Gherkin", "HTML+PHP", "Makefile", "PostScript", "Hxml", "Kotlin", "PL/pgSQL", "Vala", "Haskell", "Bro", "Lua", "POVRay", "Sass", "ANTLR With Java Target", "Tcl", "ANTLR With ObjectiveC Target", "JavaScript+Ruby", "Racket", "AspectJ", "Base Makefile", "ANTLR With Python Target", "cpp-objdump", "Genshi Text", "Ioke", "PyPy Log", "Croc", "Objective-J", "GAS", "Batchfile", "Snobol", "XML", "ANTLR", "Opa", "XML+Cheetah", "Go", "Diff", "MiniD", "Cython", "Ragel in C Host", "Erlang", "Debian Control file", "aspx-vb", "BUGS", "Ragel in CPP Host", "aspx-cs", "Properties", "Groff", "Clojure", "Modelica", "QML", "JavaScript+Lasso", "ANTLR With Perl Target", "Genshi", "BlitzMax", "Treetop", "Matlab", "Myghty", "HTML+Genshi", "Duel", "Perl", "FSharp", "reStructuredText", "NewLisp", "Scala", "CSS+Lasso", "XML+PHP", "Stan", "INI", "MOOCode", "Shell Session", "RPMSpec", "Newspeak", "Bash Session", "Coq", "Raw token data", "Tcsh", "HTML+Lasso", "C#", "Gosu Template", "RConsole", "MXML", "TeX", "CSS+Smarty", "Text only", "ANTLR With C# Target", "OpenEdge ABL", "Cheetah", "Smali", "CSS+Myghty", "Rd", "LLVM", "Standard ML", "Elixir", "Nginx configuration file", "GoodData-CL", "AppleScript", "HTML+Smarty", "Objective-C", "JavaScript", "Rust", "Common Lisp", "Embedded Ragel", "ActionScript 3", "systemverilog", "Literate Haskell", "Python Traceback", "PHP", "ANTLR With CPP Target", "Gosu", "Hybris", "JavaScript+PHP", "Factor", "HTML+Velocity", "Mscgen", "Ooc", "SQL", "HTTP", "ECL", "Redcode", "Ragel in Objective C Host", "XML+Django/Jinja", "Awk", "JSON", "NASM", "ANTLR With Ruby Target", "XML+Myghty", "AutoIt", "Mako", "CSS+Mako", "HTML+Mako", "XML+Mako", "JavaScript+Mako"] +} diff --git a/static/sass/index.sass b/static/sass/index.sass index a0acd84..7348b4b 100644 --- a/static/sass/index.sass +++ b/static/sass/index.sass @@ -81,12 +81,10 @@ div#search-field background-color: white border: 1px solid $baseColor2 margin: 0px - max-height: 0.1px overflow: auto padding: 0px &.visible - max-height: 100% padding-bottom: 30px >div