From 7adb17452d8c845f46858b4cebe8198988edfdbc Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Sat, 20 Dec 2014 23:33:03 +0100 Subject: [PATCH 1/7] [enh] add result_templates/code.html --- requirements.txt | 1 + searx/engines/searchcode_code.py | 32 ++++--- searx/static/courgette/css/style.css | 80 +++++++++++++++- searx/static/default/css/style.css | 87 +----------------- searx/static/default/less/code.less | 83 +++++++++++++++++ searx/static/default/less/style.less | 2 + searx/static/oscar/css/bootstrap.min.css | Bin 116497 -> 114586 bytes searx/static/oscar/css/oscar.min.css | Bin 1078 -> 3454 bytes searx/static/oscar/less/oscar/code.less | 79 ++++++++++++++++ searx/static/oscar/less/oscar/oscar.less | 2 + .../courgette/result_templates/code.html | 9 ++ .../default/result_templates/code.html | 9 ++ .../oscar/result_templates/code.html | 17 ++++ searx/webapp.py | 46 +++++++++ setup.py | 1 + versions.cfg | 1 + 16 files changed, 350 insertions(+), 99 deletions(-) create mode 100644 searx/static/default/less/code.less create mode 100644 searx/static/oscar/less/oscar/code.less create mode 100644 searx/templates/courgette/result_templates/code.html create mode 100644 searx/templates/default/result_templates/code.html create mode 100644 searx/templates/oscar/result_templates/code.html diff --git a/requirements.txt b/requirements.txt index 07b53d2ad..2d434825d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ flask-babel requests lxml pyyaml +pygments python-dateutil diff --git a/searx/engines/searchcode_code.py b/searx/engines/searchcode_code.py index 2ba0e52f1..ac9647fcd 100644 --- a/searx/engines/searchcode_code.py +++ b/searx/engines/searchcode_code.py @@ -21,6 +21,18 @@ paging = True url = 'https://searchcode.com/' search_url = url+'api/codesearch_I/?{query}&p={pageno}' +code_endings = {'c': 'c', + 'css': 'css', + 'cpp': 'cpp', + 'c++': 'cpp', + 'h': 'c', + 'html': 'html', + 'hpp': 'cpp', + 'js': 'js', + 'lua': 'lua', + 'php': 'php', + 'py': 'python'} + # do search-request def request(query, params): @@ -40,26 +52,22 @@ def response(resp): for result in search_results['results']: href = result['url'] title = "" + result['name'] + " - " + result['filename'] - content = result['repo'] + "
" + repo = result['repo'] lines = dict() for line, code in result['lines'].items(): lines[int(line)] = code - content = content + '
'
-        for line, code in sorted(lines.items()):
-            content = content + '"
-            
-        content = content + "
' - content = content + str(line) + '' - # Replace every two spaces with ' &nbps;' to keep formatting while allowing the browser to break the line if necessary - content = content + cgi.escape(code).replace('\t', ' ').replace(' ', '  ').replace(' ', '  ') - content = content + "
" - + code_language = code_endings.get(result['filename'].split('.')[-1].lower(), None) + # append result results.append({'url': href, 'title': title, - 'content': content}) + 'content': '', + 'repository': repo, + 'codelines': sorted(lines.items()), + 'code_language': code_language, + 'template': 'code.html'}) # return results return results diff --git a/searx/static/courgette/css/style.css b/searx/static/courgette/css/style.css index 55db91317..866686c9c 100644 --- a/searx/static/courgette/css/style.css +++ b/searx/static/courgette/css/style.css @@ -579,4 +579,82 @@ select { border: 1px solid #DDD; padding: 0.5em 0.8em; font-size: 1em; -} \ No newline at end of file +} + +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f8f8f8; } +.highlight .c { color: #408080; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #008000; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #BC7A00 } /* Comment.Preproc */ +.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008000 } /* Keyword.Pseudo */ +.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #B00040 } /* Keyword.Type */ +.highlight .m { color: #666666 } /* Literal.Number */ +.highlight .s { color: #BA2121 } /* Literal.String */ +.highlight .na { color: #7D9029 } /* Name.Attribute */ +.highlight .nb { color: #008000 } /* Name.Builtin */ +.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.highlight .no { color: #880000 } /* Name.Constant */ +.highlight .nd { color: #AA22FF } /* Name.Decorator */ +.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0000FF } /* Name.Function */ +.highlight .nl { color: #A0A000 } /* Name.Label */ +.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #19177C } /* Name.Variable */ +.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #666666 } /* Literal.Number.Float */ +.highlight .mh { color: #666666 } /* Literal.Number.Hex */ +.highlight .mi { color: #666666 } /* Literal.Number.Integer */ +.highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ +.highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #BA2121 } /* Literal.String.Double */ +.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.highlight .sx { color: #008000 } /* Literal.String.Other */ +.highlight .sr { color: #BB6688 } /* Literal.String.Regex */ +.highlight .s1 { color: #BA2121 } /* Literal.String.Single */ +.highlight .ss { color: #19177C } /* Literal.String.Symbol */ +.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #19177C } /* Name.Variable.Class */ +.highlight .vg { color: #19177C } /* Name.Variable.Global */ +.highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ + +.highlight pre { overflow: auto; } + +.highlight .lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: default; +} + +.highlight .lineno::selection { background: transparent; } /* WebKit/Blink Browsers */ +.highlight .lineno::-moz-selection { background: transparent; } /* Gecko Browsers */ diff --git a/searx/static/default/css/style.css b/searx/static/default/css/style.css index 277f55e8d..f0e498db7 100644 --- a/searx/static/default/css/style.css +++ b/searx/static/default/css/style.css @@ -1,86 +1 @@ -html{font-family:sans-serif;font-size:.9em;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;color:#444;padding:0;margin:0} -body,#container{padding:0;margin:0} -#container{width:100%;position:absolute;top:0} -.search{padding:0;margin:0}.search .checkbox_container label{font-size:.9em;border-bottom:2px solid #e8e7e6} -.search .checkbox_container label:hover{border-bottom:2px solid #3498db} -.search .checkbox_container input[type="checkbox"]:checked+label{border-bottom:2px solid #2980b9} -#search_wrapper{position:relative;width:50em;padding:10px} -.center #search_wrapper{margin-left:auto;margin-right:auto} -.q{background:none repeat scroll 0 0 #fff;border:1px solid #3498db;color:#222;font-size:16px;height:28px;margin:0;outline:medium none;padding:2px;padding-left:8px;padding-right:0 !important;width:100%;z-index:2} -#search_submit{position:absolute;top:13px;right:1px;padding:0;border:0;background:url('../img/search-icon.png') no-repeat;background-size:24px 24px;opacity:.8;width:24px;height:30px;font-size:0} -@media screen and (max-width:50em){#search_wrapper{width:90%;clear:both;overflow:hidden}}ul.autocompleter-choices{position:absolute;margin:0;padding:0;list-style:none;border:1px solid #3498db;border-left-color:#3498db;border-right-color:#3498db;border-bottom-color:#3498db;text-align:left;font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;z-index:50;background-color:#fff;color:#444}ul.autocompleter-choices li{position:relative;margin:-2px 0 0 0;padding:.2em 1.5em .2em 1em;display:block;float:none !important;cursor:pointer;font-weight:normal;white-space:nowrap;font-size:1em;line-height:1.5em}ul.autocompleter-choices li.autocompleter-selected{background-color:#444;color:#fff}ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried{color:#9fcfff} -ul.autocompleter-choices span.autocompleter-queried{display:inline;float:none;font-weight:bold;margin:0;padding:0} -.row{max-width:800px;margin:20px auto;text-align:justify}.row h1{font-size:3em;margin-top:50px} -.row p{padding:0 10px;max-width:700px} -.row h3,.row ul{margin:4px 8px} -.hmarg{margin:0 20px;border:1px solid #3498db;padding:4px 10px} -a:link.hmarg{color:#3498db} -a:visited.hmarg{color:#3498db} -a:active.hmarg{color:#3498db} -a:hover.hmarg{color:#3498db} -.top_margin{margin-top:60px} -.center{text-align:center} -h1{font-size:5em} -div.title{background:url('../img/searx.png') no-repeat;width:100%;min-height:80px;background-position:center}div.title h1{visibility:hidden} -input[type="submit"]{padding:2px 6px;margin:2px 4px;display:inline-block;background:#3498db;color:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:0;cursor:pointer} -input[type="checkbox"]{visibility:hidden} -fieldset{margin:8px;border:1px solid #3498db} -#categories{margin:0 10px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} -.checkbox_container{display:inline-block;position:relative;margin:0 3px;padding:0}.checkbox_container input{display:none} -.checkbox_container label,.engine_checkbox label{cursor:pointer;padding:4px 10px;margin:0;display:block;text-transform:capitalize;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} -.checkbox_container input[type="checkbox"]:checked+label{background:#3498db;color:#fff} -.engine_checkbox{padding:4px} -label.allow{background:#e74c3c;padding:4px 8px;color:#fff;display:none} -label.deny{background:#2ecc71;padding:4px 8px;color:#444;display:inline} -.engine_checkbox input[type="checkbox"]:checked+label:nth-child(2)+label{display:none} -.engine_checkbox input[type="checkbox"]:checked+label.allow{display:inline} -a{text-decoration:none;color:#1a11be}a:visited{color:#8e44ad} -.result{margin:19px 0 18px 0;padding:0;clear:both} -.result_title{margin-bottom:0}.result_title a{color:#2980b9;font-weight:normal;font-size:1.1em}.result_title a:hover{text-decoration:underline} -.result_title a:visited{color:#8e44ad} -.cache_link{font-size:10px !important} -.result h3{font-size:1em;word-wrap:break-word;margin:5px 0 1px 0;padding:0} -.result .content{font-size:.8em;margin:0;padding:0;max-width:54em;word-wrap:break-word;line-height:1.24}.result .content img{float:left;margin-right:5px;max-width:200px;max-height:100px} -.result .content br.last{clear:both} -.result .url{font-size:.8em;margin:0 0 3px 0;padding:0;max-width:54em;word-wrap:break-word;color:#c0392b} -.result .published_date{font-size:.8em;color:#888;Margin:5px 20px} -.result .thumbnail{width:400px} -.engines{color:#888} -.small_font{font-size:.8em} -.small p{margin:2px 0} -.right{float:right} -.invisible{display:none} -.left{float:left} -.highlight{color:#094089} -.content .highlight{color:#000} -.image_result{display:inline-block;margin:10px 10px;position:relative;max-height:160px}.image_result img{border:0;max-height:160px} -.image_result p{margin:0;padding:0}.image_result p span a{display:none;color:#fff} -.image_result p:hover span a{display:block;position:absolute;bottom:0;right:0;padding:4px;background-color:rgba(0,0,0,0.6);font-size:.7em} -.torrent_result{border-left:10px solid #d3d3d3;padding-left:3px}.torrent_result p{margin:3px;font-size:.8em} -.definition_result{border-left:10px solid #808080;padding-left:3px} -.percentage{position:relative;width:300px}.percentage div{background:#444} -table{width:100%} -td{padding:0 4px} -tr:hover{background:#ddd} -#results{margin:auto;padding:0;width:50em;margin-bottom:20px} -#sidebar{position:fixed;bottom:10px;left:10px;margin:0 2px 5px 5px;padding:0 2px 2px 2px;width:14em}#sidebar input{padding:0;margin:3px;font-size:.8em;display:inline-block;background:transparent;color:#444;cursor:pointer} -#sidebar input[type="submit"]{text-decoration:underline} -#suggestions form{display:inline} -#suggestions,#answers{margin-top:20px;max-width:45em} -#suggestions input,#answers input,#infoboxes input{padding:0;margin:3px;font-size:.8em;display:inline-block;background:transparent;color:#444;cursor:pointer} -#suggestions input[type="submit"],#answers input[type="submit"],#infoboxes input[type="submit"]{text-decoration:underline} -#answers form,#infoboxes form{min-width:210px} -#infoboxes{position:absolute;top:100px;right:20px;margin:0 2px 5px 5px;padding:0 2px 2px;max-width:21em}#infoboxes .infobox{margin:10px 0 10px;border:1px solid #ddd;padding:5px;font-size:.8em;}#infoboxes .infobox img{max-width:20em;max-heigt:12em;display:block;margin:5px;padding:5px} -#infoboxes .infobox h2{margin:0} -#infoboxes .infobox table{width:auto}#infoboxes .infobox table td{vertical-align:top} -#infoboxes .infobox input{font-size:1em} -#infoboxes .infobox br{clear:both} -#search_url{margin-top:8px}#search_url input{border:1px solid #888;padding:4px;color:#444;width:14em;display:block;margin:4px;font-size:.8em} -#preferences{top:10px;padding:0;border:0;background:url('../img/preference-icon.png') no-repeat;background-size:28px 28px;opacity:.8;width:28px;height:30px;display:block}#preferences *{display:none} -#pagination{clear:both}#pagination br{clear:both} -#apis{margin-top:8px;clear:both} -#categories_container{position:relative} -@media screen and (max-width:50em){#results{margin:auto;padding:0;width:90%} .github{display:none} .checkbox_container{display:block;width:90%}.checkbox_container label{border-bottom:0} .preferences_container{display:none;postion:fixed !important;top:100px;right:0}}@media screen and (max-width:75em){div.title h1{font-size:1em} html.touch #categories{width:95%;height:30px;text-align:left;overflow-x:scroll;overflow-y:hidden;-webkit-overflow-scrolling:touch}html.touch #categories #categories_container{width:1000px;width:-moz-max-content;width:-webkit-max-content;width:max-content}html.touch #categories #categories_container .checkbox_container{display:inline-block;width:auto} #categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto} #suggestions,#answers{margin-top:5px} #infoboxes{position:inherit;max-width:inherit}#infoboxes .infobox{clear:both}#infoboxes .infobox img{float:left;max-width:10em} #categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto} #sidebar{position:static;max-width:50em;margin:0 0 2px 0;padding:0;float:none;border:none;width:auto}#sidebar input{border:0} #apis{display:none} #search_url{display:none} .result{border-top:1px solid #e8e7e6;margin:8px 0 8px 0}.result .thumbnail{max-width:98%} .image_result{max-width:98%}.image_result img{max-width:98%}}.favicon{float:left;margin-right:4px;margin-top:2px} -.preferences_back{background:none repeat scroll 0 0 #3498db;border:0 none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;cursor:pointer;display:inline-block;margin:2px 4px;padding:4px 6px}.preferences_back a{color:#fff} -.hidden{opacity:0;overflow:hidden;font-size:.8em;position:absolute;bottom:-20px;width:100%;text-position:center;background:#fff;transition:opacity 1s ease} -#categories_container:hover .hidden{transition:opacity 1s ease;opacity:.8} +.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#408080;font-style:italic}.highlight .err{border:1px solid #f00}.highlight .k{color:#008000;font-weight:bold}.highlight .o{color:#666}.highlight .cm{color:#408080;font-style:italic}.highlight .cp{color:#bc7a00}.highlight .c1{color:#408080;font-style:italic}.highlight .cs{color:#408080;font-style:italic}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .gr{color:#f00}.highlight .gh{color:#000080;font-weight:bold}.highlight .gi{color:#00a000}.highlight .go{color:#888}.highlight .gp{color:#000080;font-weight:bold}.highlight .gs{font-weight:bold}.highlight .gu{color:#800080;font-weight:bold}.highlight .gt{color:#04d}.highlight .kc{color:#008000;font-weight:bold}.highlight .kd{color:#008000;font-weight:bold}.highlight .kn{color:#008000;font-weight:bold}.highlight .kp{color:#008000}.highlight .kr{color:#008000;font-weight:bold}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#7d9029}.highlight .nb{color:#008000}.highlight .nc{color:#00f;font-weight:bold}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#999;font-weight:bold}.highlight .ne{color:#d2413a;font-weight:bold}.highlight .nf{color:#00f}.highlight .nl{color:#a0a000}.highlight .nn{color:#00f;font-weight:bold}.highlight .nt{color:#008000;font-weight:bold}.highlight .nv{color:#19177c}.highlight .ow{color:#a2f;font-weight:bold}.highlight .w{color:#bbb}.highlight .mf{color:#666}.highlight .mh{color:#666}.highlight .mi{color:#666}.highlight .mo{color:#666}.highlight .sb{color:#ba2121}.highlight .sc{color:#ba2121}.highlight .sd{color:#ba2121;font-style:italic}.highlight .s2{color:#ba2121}.highlight .se{color:#b62;font-weight:bold}.highlight .sh{color:#ba2121}.highlight .si{color:#b68;font-weight:bold}.highlight .sx{color:#008000}.highlight .sr{color:#b68}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:#008000}.highlight .vc{color:#19177c}.highlight .vg{color:#19177c}.highlight .vi{color:#19177c}.highlight .il{color:#666}.highlight pre{overflow:auto}.highlight .lineno{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.highlight .lineno::selection{background:transparent}.highlight .lineno::-moz-selection{background:transparent}html{font-family:sans-serif;font-size:.9em;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;color:#444;padding:0;margin:0}body,#container{padding:0;margin:0}#container{width:100%;position:absolute;top:0}.search{padding:0;margin:0}.search .checkbox_container label{font-size:.9em;border-bottom:2px solid #e8e7e6}.search .checkbox_container label:hover{border-bottom:2px solid #3498db}.search .checkbox_container input[type="checkbox"]:checked+label{border-bottom:2px solid #2980b9}#search_wrapper{position:relative;width:50em;padding:10px}.center #search_wrapper{margin-left:auto;margin-right:auto}.q{background:none repeat scroll 0 0 #fff;border:1px solid #3498db;color:#222;font-size:16px;height:28px;margin:0;outline:medium none;padding:2px;padding-left:8px;padding-right:0 !important;width:100%;z-index:2}#search_submit{position:absolute;top:13px;right:1px;padding:0;border:0;background:url('../img/search-icon.png') no-repeat;background-size:24px 24px;opacity:.8;width:24px;height:30px;font-size:0}@media screen and (max-width:50em){#search_wrapper{width:90%;clear:both;overflow:hidden}}ul.autocompleter-choices{position:absolute;margin:0;padding:0;list-style:none;border:1px solid #3498db;border-left-color:#3498db;border-right-color:#3498db;border-bottom-color:#3498db;text-align:left;font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;z-index:50;background-color:#fff;color:#444}ul.autocompleter-choices li{position:relative;margin:-2px 0 0 0;padding:.2em 1.5em .2em 1em;display:block;float:none !important;cursor:pointer;font-weight:normal;white-space:nowrap;font-size:1em;line-height:1.5em}ul.autocompleter-choices li.autocompleter-selected{background-color:#444;color:#fff}ul.autocompleter-choices li.autocompleter-selected span.autocompleter-queried{color:#9fcfff}ul.autocompleter-choices span.autocompleter-queried{display:inline;float:none;font-weight:bold;margin:0;padding:0}.row{max-width:800px;margin:20px auto;text-align:justify}.row h1{font-size:3em;margin-top:50px}.row p{padding:0 10px;max-width:700px}.row h3,.row ul{margin:4px 8px}.hmarg{margin:0 20px;border:1px solid #3498db;padding:4px 10px}a:link.hmarg{color:#3498db}a:visited.hmarg{color:#3498db}a:active.hmarg{color:#3498db}a:hover.hmarg{color:#3498db}.top_margin{margin-top:60px}.center{text-align:center}h1{font-size:5em}div.title{background:url('../img/searx.png') no-repeat;width:100%;min-height:80px;background-position:center}div.title h1{visibility:hidden}input[type="submit"]{padding:2px 6px;margin:2px 4px;display:inline-block;background:#3498db;color:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:0;cursor:pointer}input[type="checkbox"]{visibility:hidden}fieldset{margin:8px;border:1px solid #3498db}#categories{margin:0 10px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.checkbox_container{display:inline-block;position:relative;margin:0 3px;padding:0}.checkbox_container input{display:none}.checkbox_container label,.engine_checkbox label{cursor:pointer;padding:4px 10px;margin:0;display:block;text-transform:capitalize;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.checkbox_container input[type="checkbox"]:checked+label{background:#3498db;color:#fff}.engine_checkbox{padding:4px}label.allow{background:#e74c3c;padding:4px 8px;color:#fff;display:none}label.deny{background:#2ecc71;padding:4px 8px;color:#444;display:inline}.engine_checkbox input[type="checkbox"]:checked+label:nth-child(2)+label{display:none}.engine_checkbox input[type="checkbox"]:checked+label.allow{display:inline}a{text-decoration:none;color:#1a11be}a:visited{color:#8e44ad}.result{margin:19px 0 18px 0;padding:0;clear:both}.result_title{margin-bottom:0}.result_title a{color:#2980b9;font-weight:normal;font-size:1.1em}.result_title a:hover{text-decoration:underline}.result_title a:visited{color:#8e44ad}.cache_link{font-size:10px !important}.result h3{font-size:1em;word-wrap:break-word;margin:5px 0 1px 0;padding:0}.result .content{font-size:.8em;margin:0;padding:0;max-width:54em;word-wrap:break-word;line-height:1.24}.result .content img{float:left;margin-right:5px;max-width:200px;max-height:100px}.result .content br.last{clear:both}.result .url{font-size:.8em;margin:0 0 3px 0;padding:0;max-width:54em;word-wrap:break-word;color:#c0392b}.result .published_date{font-size:.8em;color:#888;Margin:5px 20px}.result .thumbnail{width:400px}.engines{color:#888}.small_font{font-size:.8em}.small p{margin:2px 0}.right{float:right}.invisible{display:none}.left{float:left}.highlight{color:#094089}.content .highlight{color:#000}.image_result{display:inline-block;margin:10px 10px;position:relative;max-height:160px}.image_result img{border:0;max-height:160px}.image_result p{margin:0;padding:0}.image_result p span a{display:none;color:#fff}.image_result p:hover span a{display:block;position:absolute;bottom:0;right:0;padding:4px;background-color:rgba(0,0,0,0.6);font-size:.7em}.torrent_result{border-left:10px solid lightgray;padding-left:3px}.torrent_result p{margin:3px;font-size:.8em}.definition_result{border-left:10px solid gray;padding-left:3px}.percentage{position:relative;width:300px}.percentage div{background:#444}table{width:100%}td{padding:0 4px}tr:hover{background:#ddd}#results{margin:auto;padding:0;width:50em;margin-bottom:20px}#sidebar{position:fixed;bottom:10px;left:10px;margin:0 2px 5px 5px;padding:0 2px 2px 2px;width:14em}#sidebar input{padding:0;margin:3px;font-size:.8em;display:inline-block;background:transparent;color:#444;cursor:pointer}#sidebar input[type="submit"]{text-decoration:underline}#suggestions form{display:inline}#suggestions,#answers{margin-top:20px;max-width:45em}#suggestions input,#answers input,#infoboxes input{padding:0;margin:3px;font-size:.8em;display:inline-block;background:transparent;color:#444;cursor:pointer}#suggestions input[type="submit"],#answers input[type="submit"],#infoboxes input[type="submit"]{text-decoration:underline}#answers form,#infoboxes form{min-width:210px}#infoboxes{position:absolute;top:100px;right:20px;margin:0 2px 5px 5px;padding:0 2px 2px;max-width:21em}#infoboxes .infobox{margin:10px 0 10px;border:1px solid #ddd;padding:5px;font-size:.8em}#infoboxes .infobox img{max-width:20em;max-heigt:12em;display:block;margin:5px;padding:5px}#infoboxes .infobox h2{margin:0}#infoboxes .infobox table{width:auto}#infoboxes .infobox table td{vertical-align:top}#infoboxes .infobox input{font-size:1em}#infoboxes .infobox br{clear:both}#search_url{margin-top:8px}#search_url input{border:1px solid #888;padding:4px;color:#444;width:14em;display:block;margin:4px;font-size:.8em}#preferences{top:10px;padding:0;border:0;background:url('../img/preference-icon.png') no-repeat;background-size:28px 28px;opacity:.8;width:28px;height:30px;display:block}#preferences *{display:none}#pagination{clear:both}#pagination br{clear:both}#apis{margin-top:8px;clear:both}#categories_container{position:relative}@media screen and (max-width:50em){#results{margin:auto;padding:0;width:90%}.github{display:none}.checkbox_container{display:block;width:90%}.checkbox_container label{border-bottom:0}.preferences_container{display:none;postion:fixed !important;top:100px;right:0}}@media screen and (max-width:75em){div.title h1{font-size:1em}html.touch #categories{width:95%;height:30px;text-align:left;overflow-x:scroll;overflow-y:hidden;-webkit-overflow-scrolling:touch}html.touch #categories #categories_container{width:1000px;width:-moz-max-content;width:-webkit-max-content;width:max-content}html.touch #categories #categories_container .checkbox_container{display:inline-block;width:auto}#categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto}#suggestions,#answers{margin-top:5px}#infoboxes{position:inherit;max-width:inherit}#infoboxes .infobox{clear:both}#infoboxes .infobox img{float:left;max-width:10em}#categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto}#sidebar{position:static;max-width:50em;margin:0 0 2px 0;padding:0;float:none;border:none;width:auto}#sidebar input{border:0}#apis{display:none}#search_url{display:none}.result{border-top:1px solid #e8e7e6;margin:8px 0 8px 0}.result .thumbnail{max-width:98%}.image_result{max-width:98%}.image_result img{max-width:98%}}.favicon{float:left;margin-right:4px;margin-top:2px}.preferences_back{background:none repeat scroll 0 0 #3498db;border:0 none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;cursor:pointer;display:inline-block;margin:2px 4px;padding:4px 6px}.preferences_back a{color:#fff}.hidden{opacity:0;overflow:hidden;font-size:.8em;position:absolute;bottom:-20px;width:100%;text-position:center;background:white;transition:opacity 1s ease}#categories_container:hover .hidden{transition:opacity 1s ease;opacity:.8} \ No newline at end of file diff --git a/searx/static/default/less/code.less b/searx/static/default/less/code.less new file mode 100644 index 000000000..a688dd98d --- /dev/null +++ b/searx/static/default/less/code.less @@ -0,0 +1,83 @@ +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f8f8f8; } +.highlight .c { color: #408080; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #008000; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #BC7A00 } /* Comment.Preproc */ +.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #008000 } /* Keyword.Pseudo */ +.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #B00040 } /* Keyword.Type */ +.highlight .m { color: #666666 } /* Literal.Number */ +.highlight .s { color: #BA2121 } /* Literal.String */ +.highlight .na { color: #7D9029 } /* Name.Attribute */ +.highlight .nb { color: #008000 } /* Name.Builtin */ +.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.highlight .no { color: #880000 } /* Name.Constant */ +.highlight .nd { color: #AA22FF } /* Name.Decorator */ +.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #0000FF } /* Name.Function */ +.highlight .nl { color: #A0A000 } /* Name.Label */ +.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #19177C } /* Name.Variable */ +.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #666666 } /* Literal.Number.Float */ +.highlight .mh { color: #666666 } /* Literal.Number.Hex */ +.highlight .mi { color: #666666 } /* Literal.Number.Integer */ +.highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ +.highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #BA2121 } /* Literal.String.Double */ +.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.highlight .sx { color: #008000 } /* Literal.String.Other */ +.highlight .sr { color: #BB6688 } /* Literal.String.Regex */ +.highlight .s1 { color: #BA2121 } /* Literal.String.Single */ +.highlight .ss { color: #19177C } /* Literal.String.Symbol */ +.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #19177C } /* Name.Variable.Class */ +.highlight .vg { color: #19177C } /* Name.Variable.Global */ +.highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ + +.highlight pre { + overflow: auto; +} + +.highlight .lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: default; + + &::selection { + background: transparent; /* WebKit/Blink Browsers */ + } + &::-moz-selection { + background: transparent; /* Gecko Browsers */ + } +} diff --git a/searx/static/default/less/style.less b/searx/static/default/less/style.less index 9851b1305..bae4f2749 100644 --- a/searx/static/default/less/style.less +++ b/searx/static/default/less/style.less @@ -8,6 +8,8 @@ @import "mixins.less"; +@import "code.less"; + // Main LESS-Code html { diff --git a/searx/static/oscar/css/bootstrap.min.css b/searx/static/oscar/css/bootstrap.min.css index a9f57473e2c7f2439218d29bcbd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Xy$S~7Q0SNMolYGoOIThEc$a?9nD*r_;dln{ZvO=5;__J- z6YU2aaDu*Q|0iWBydT;HRp9Sll(T1g;pVw=sV*6P$qPnU1;>|m-gnLfg$aj!7M~cb zFtQ_c1nV%Dow+UcxifW|sz_5#i8GvP_-`e8Ja6RhrBnTQ_;7bzkjC{lV0_3l%Z3!} XRyf&hZmSpUd$64@UW#l^PjCJY;C1v7 delta 190 zcmew-wT)wfx)fJZeoAF^Zeme-W}a?Reo0Awu9byBK}9XsM0+bnu8Eb7Kw_6SBiCeB z#uy-($QS}7w=x1nCNW6^nbJ(EK+=K921wR0Ntto!6{QxJ=9K7` +

{% if result['favicon'] %}{{result['favicon']}}{% endif %}{{ result.title|safe }}

+

{{ result.pretty_url }} cached

+ {% if result.publishedDate %}

{{ result.publishedDate }}

{% endif %} +

{% if result.img_src %}{% endif %}{% if result.content %}{{ result.content|safe }}
{% endif %}

+ {% if result.repository %}

{{ result.repository }}

{% endif %} + + {{ result.codelines|code_highlighter(result.code_language)|safe }} + diff --git a/searx/templates/default/result_templates/code.html b/searx/templates/default/result_templates/code.html new file mode 100644 index 000000000..616b7ea62 --- /dev/null +++ b/searx/templates/default/result_templates/code.html @@ -0,0 +1,9 @@ +
+

{% if result['favicon'] %}{{result['favicon']}}{% endif %}{{ result.title|safe }}

+

{{ result.pretty_url }} cached

+ {% if result.publishedDate %}

{{ result.publishedDate }}

{% endif %} +

{% if result.img_src %}{% endif %}{% if result.content %}{{ result.content|safe }}
{% endif %}

+ {% if result.repository %}

{{ result.repository }}

{% endif %} + + {{ result.codelines|code_highlighter(result.code_language)|safe }} +
diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html new file mode 100644 index 000000000..d9079a464 --- /dev/null +++ b/searx/templates/oscar/result_templates/code.html @@ -0,0 +1,17 @@ +{% from 'oscar/macros.html' import icon %} + +

{% if result['favicon'] %}{{ result['favicon'] }} {% endif %}{{ result.title|safe }}

+ +{% if result.publishedDate %}{% endif %} +{{ icon('link') }} {{ _('cached') }} + +{% if result.content %}

{{ result.content|safe }}

{% endif %} + +{% if result.repository %}

{{ icon('file') }} {{ result.repository }}

{% endif %} + +{{ result.codelines|code_highlighter(result.code_language)|safe }} + +
+ +{{ result.engine }} +

{{ result.pretty_url }}

diff --git a/searx/webapp.py b/searx/webapp.py index 915fb3564..11db1bf2e 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -33,6 +33,9 @@ from flask import ( redirect, send_from_directory ) from flask.ext.babel import Babel, gettext, format_date +from pygments import highlight +from pygments.lexers import get_lexer_by_name +from pygments.formatters import HtmlFormatter from searx import settings, searx_dir from searx.engines import ( categories, engines, get_engines_stats, engine_shortcuts @@ -90,6 +93,49 @@ def get_locale(): return locale +# code-highlighter +@app.template_filter('code_highlighter') +def code_highlighter(codelines, language=None): + if not language: + language = 'text' + + # find lexer by programing language + lexer = get_lexer_by_name(language, stripall=True) + + html_code = '' + tmp_code = '' + last_line = None + + # parse lines + for line, code in codelines: + if not last_line: + line_code_start = line + + # new codeblock is detected + if last_line != None and\ + last_line +1 != line: + + # highlight last codepart + formatter = HtmlFormatter(linenos='inline', linenostart=line_code_start) + html_code = html_code + highlight(tmp_code, lexer, formatter) + + # reset conditions for next codepart + tmp_code = '' + line_code_start = line + + # add codepart + tmp_code += code + '\n' + + # update line + last_line = line + + # highlight last codepart + formatter = HtmlFormatter(linenos='inline', linenostart=line_code_start) + html_code = html_code + highlight(tmp_code, lexer, formatter) + + return html_code + + def get_base_url(): if settings['server']['base_url']: hostname = settings['server']['base_url'] diff --git a/setup.py b/setup.py index d976a31f7..1c1a19ddf 100644 --- a/setup.py +++ b/setup.py @@ -44,6 +44,7 @@ setup( 'requests', 'lxml', 'pyyaml', + 'pygments', 'setuptools', 'python-dateutil', ], diff --git a/versions.cfg b/versions.cfg index 2f5dae8ee..7f1734908 100644 --- a/versions.cfg +++ b/versions.cfg @@ -4,6 +4,7 @@ Flask = 0.10.1 Flask-Babel = 0.9 Jinja2 = 2.7.2 MarkupSafe = 0.18 +Pygments = 2.0.1 WebOb = 1.3.1 WebTest = 2.0.11 Werkzeug = 0.9.4 From 7b44fd47a72ab0c9a4c586193757a4f195bb5fe4 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Mon, 22 Dec 2014 15:28:23 +0100 Subject: [PATCH 2/7] [enh] improve grunt-file for oscar_template --- searx/static/oscar/css/bootstrap.min.css | Bin 114586 -> 113911 bytes searx/static/oscar/css/oscar.min.css | Bin 3454 -> 3387 bytes searx/static/oscar/gruntfile.js | 43 +++++++++++++++++++++-- searx/static/oscar/js/searx.min.js | Bin 5026 -> 5026 bytes searx/static/oscar/package.json | 3 +- 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/searx/static/oscar/css/bootstrap.min.css b/searx/static/oscar/css/bootstrap.min.css index 691604be6ac3671e5df785c4720f3adeba26acf2..fb0e84ae429d9fe45130887dafe747f77cfa7f31 100644 GIT binary patch delta 5892 zcmeHLYj9J?6`rHV#g-kw0U3;qkqyRHxf0g~*9g6+e-9sq-$*R z65#Mm0uDQ{;bE|G0h@$Jb7=%^aR{9@lQu&_r;~&>-L-h^vV!65AHzneW`s7{=4h#BaGJn05yk=7Js_T5!&wIm7 zy)+TeQh(UJg1j&`o2)fkg-}D#>x+&wc$E07z3=+$*TkMmfk?P8ZNT39p5;>7k zi2tK=8pAa;c3Vw2671S)XW^FB&#z=kbRji8OKYKGWLPF$)Z8g!J3Dhe*uQJ_{wO;Jag){8ohP{$GKI6~dHgpMQBafCXK zP&Z!J#dL^5PNI+_6uNYwj!?%r)NzEm@`R2f)NzD5j!;*T&}k^oon~U54VIUb#Bj*895QV(H#%g7%S2Kz zcX5rHR8;jz5psQ^j9i~cA=hWI$n~DAa${~x(0nDg2%_Y6NF-d(8TN8th>}_1zK}}> zR`-P@u3NdZa1Hl`>*VV~l-zLK7jk@mAmY9dabJkIFGR`I>AsL;zRoXN%Y9+cxi3V? zEzNx)m)w=y7jnss#eE@{+#I?u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FQ)PM>o_%g#61u;6ex?v{p;)-A z;9sqxQLN#@RXOLg{xX~`+hFE5&r@F5_p8Z+(v|5-y~`VPTc@%^+lGce{`DWy`m6c) z@&?o5Xh%Uy^$bUi);uFI+Hzl6iskCEYrcjCFLG2PaUHNhEP7ZEL)qc0Z6;%93p;+F zY?cFeUK>ZTS$y@nk{Hmo>%C84oa=92#9lD-P9C0%@7VC9-kk8>JC~A@MS{k6YgAy; zvo$Mgy)`=A*;8lINn`OG*ZT=v-02;egsH+_kTEGKxN@h{CjS#Gt5WV9XHycc6b~AlDj53qC|ioR(fa%9DiS@X z;kKga7Czlh6_1vjQ9Rp0d5@N+;gJgtsvPuaiFzD2W7&V#(tg271^iw)1s;d(yQT=g z{zvZThOn{65&MBftbpIFpjD5<_5%uAq^gS6Wg}&Y%%gFnM!uLwmx_?Os7PC_Fke|o z$UOPr0BzLs9o`qhzq9*?JcI=vKchK;MqE`HW*8I2W-(&jp;lP*GvIl!! zzJn${EU`f3QQ7=YJ1Fg8o8(5G+DVs^2Pcl!8oAw$$-^Y|Fsekd&8_=M!E5e*8i`l^ ze!`WWZ`w~CcolZg2)w3t(5(I;?&zT9q(r{$K%NXrdM8cC>uNXU^W~kS0`KmmO1#RB zP!Ye|sk@apgU{%q+=NQqVB*`ls6bc`(rkXai-rK}9>46O3_kJz7KH9LkH2z&#u&us z`Nad2W8ekZu@57jW^u>XT{Rk&qxjB4WaWQ876R zSJ#zwjI6*1jv>*YUp}r?LFZd$b<**yS9kfNwrQI}9>@nls*~BPhh~m()-&vN*7D7=a+OFtscBt7pkQ-zCfKjU=N5dE%w!( nI<2v)+`ne3v>X2~CtksKUBGy^oTrKbF62(5uMu3mK%e{%u$Srf diff --git a/searx/static/oscar/css/oscar.min.css b/searx/static/oscar/css/oscar.min.css index 6ca433a3392109364ed4dfcb0f1ae66cecabc514..28f66e3d35d1f10b889eeeed6dafec986f92e421 100644 GIT binary patch delta 666 zcmew-wOeY#21aIc1B1z17~R42e@4^Irc7HIC%k|cIMS*0n)Vqj*IFd delta 693 zcmdlj^-pTU21b^o{G61@n;G39jK7Sgj0&5Ln6@%9DolRPtO+CqSmv=Prx_Sb-pC>< zp=@AaVPIfjotB?hqFbJtnVwN%1u|jtZ5DAxBapIMy$qme4oF5pFFm6=IX@@A$O@8?{e2wb;weTZhQ^7Qie7UBIAH2U zwWb7N4OXvBF6T56Ni@PVX7WDHOKeGrMutX)lLcAjCvW9a7fCWR!gR%ZE)&BfGYbp} w6n7L?pt@snAa@o!G+Z_x;C5x?E-6aPD=tVZO3f>oY{(-#S(;ad2T80J0F9mKU;qFB diff --git a/searx/static/oscar/gruntfile.js b/searx/static/oscar/gruntfile.js index 79da491c4..c591e8505 100644 --- a/searx/static/oscar/gruntfile.js +++ b/searx/static/oscar/gruntfile.js @@ -33,9 +33,43 @@ module.exports = function(grunt) { } } }, + less: { + development: { + options: { + paths: ["less/oscar"] + //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + }, + files: {"css/oscar.css": "less/oscar/oscar.less"} + }, + production: { + options: { + paths: ["less/oscar"], + //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', + cleancss: true + }, + files: {"css/oscar.min.css": "less/oscar/oscar.less"} + }, + bootstrap: { + options: { + paths: ["less/bootstrap"], + cleancss: true + }, + files: {"css/bootstrap.min.css": "less/bootstrap/bootstrap.less"} + }, + }, watch: { - files: ['<%= jshint.files %>'], - tasks: ['jshint'] + scripts: { + files: ['<%= jshint.files %>'], + tasks: ['jshint', 'concat', 'uglify'] + }, + oscar_styles: { + files: ['less/oscar/**/*.less'], + tasks: ['less:development', 'less:production'] + }, + bootstrap_styles: { + files: ['less/bootstrap/**/*.less'], + tasks: ['less:bootstrap'] + } } }); @@ -43,9 +77,12 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-less'); grunt.registerTask('test', ['jshint']); - grunt.registerTask('default', ['jshint', 'concat', 'uglify']); + grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less']); + + grunt.registerTask('styles', ['less']); }; diff --git a/searx/static/oscar/js/searx.min.js b/searx/static/oscar/js/searx.min.js index 2fba710630d38cc0c3eaf502750699834ac52550..0b3aa73f9e799a3252ab027a2cb7d26e57bb92ed 100644 GIT binary patch delta 13 UcmZ3azDRw7B$JWRM(K8803O){2mk;8 delta 13 UcmZ3azDRw7B$J`#M(K8803P-P4gdfE diff --git a/searx/static/oscar/package.json b/searx/static/oscar/package.json index 945b7943d..7eae9df2b 100644 --- a/searx/static/oscar/package.json +++ b/searx/static/oscar/package.json @@ -4,7 +4,8 @@ "grunt-contrib-uglify": "~0.6.0", "grunt-contrib-watch" : "~0.6.1", "grunt-contrib-concat" : "~0.5.0", - "grunt-contrib-jshint" : "~0.10.0" + "grunt-contrib-jshint" : "~0.10.0", + "grunt-contrib-less" : "~0.11.0" }, "scripts": { From d810763107733cec017b8688c0350dff527f2ed1 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Mon, 22 Dec 2014 16:07:02 +0100 Subject: [PATCH 3/7] [enh] remove repeating codeparts inside the oscar template --- searx/static/oscar/css/oscar.min.css | Bin 3387 -> 3411 bytes searx/static/oscar/less/oscar/results.less | 5 ++++ searx/templates/oscar/macros.html | 25 ++++++++++++++++++ .../oscar/result_templates/code.html | 13 +++------ .../oscar/result_templates/default.html | 13 +++------ .../oscar/result_templates/images.html | 4 ++- .../templates/oscar/result_templates/map.html | 14 +++------- .../oscar/result_templates/torrent.html | 13 +++------ .../oscar/result_templates/videos.html | 13 +++------ 9 files changed, 53 insertions(+), 47 deletions(-) diff --git a/searx/static/oscar/css/oscar.min.css b/searx/static/oscar/css/oscar.min.css index 28f66e3d35d1f10b889eeeed6dafec986f92e421..970850a4a87c18d1c576152530c6cb7bd79200b2 100644 GIT binary patch delta 24 fcmdljby;e|aVGAf)Z)^d65Ztdl+?|;m>RhNemDuJ delta 12 TcmcaCwOeY#ai-1pnM$|-CN>35 diff --git a/searx/static/oscar/less/oscar/results.less b/searx/static/oscar/less/oscar/results.less index 08500b3ff..cea8f3b41 100644 --- a/searx/static/oscar/less/oscar/results.less +++ b/searx/static/oscar/less/oscar/results.less @@ -55,6 +55,11 @@ clear: both; } +// code formating of results +.result-code { + clear: both; +} + // suggestion .suggestion_item { margin: 2px 5px; diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index f61de2015..1dc696341 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -1,3 +1,28 @@ + {% macro icon(action) -%} {%- endmacro %} + + + +{% macro draw_favicon(favicon) -%} + {{ favicon }} +{%- endmacro %} + + +{% macro result_header(result) -%} +

{% if result.favicon %}{{ draw_favicon(result.favicon) }} {% endif %}{{ result.title|safe }}

+{%- endmacro %} + + +{% macro result_sub_header(result) -%} + {% if result.publishedDate %}{% endif %} + {{ icon('link') }} {{ _('cached') }} +{%- endmacro %} + + +{% macro result_footer(result) -%} +
+ {{ result.engine }} +

{{ result.pretty_url }}

+{%- endmacro %} diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index d9079a464..236834d0a 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,9 +1,7 @@ -{% from 'oscar/macros.html' import icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} -

{% if result['favicon'] %}{{ result['favicon'] }} {% endif %}{{ result.title|safe }}

- -{% if result.publishedDate %}{% endif %} -{{ icon('link') }} {{ _('cached') }} +{{ result_header(result) }} +{{ result_sub_header(result) }} {% if result.content %}

{{ result.content|safe }}

{% endif %} @@ -11,7 +9,4 @@ {{ result.codelines|code_highlighter(result.code_language)|safe }} -
- -{{ result.engine }} -

{{ result.pretty_url }}

+{{ result_footer(result) }} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index 0f090d862..bc967f01e 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -1,13 +1,8 @@ -{% from 'oscar/macros.html' import icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %} -

{% if result['favicon'] %}{{ result['favicon'] }} {% endif %}{{ result.title|safe }}

- -{% if result.publishedDate %}{% endif %} -{{ icon('link') }} {{ _('cached') }} +{{ result_header(result) }} +{{ result_sub_header(result) }} {% if result.content %}

{{ result.content|safe }}

{% endif %} -
- -{{ result.engine }} -

{{ result.pretty_url }}

+{{ result_footer(result) }} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index 7689f9f58..69c2e6fff 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -1,3 +1,5 @@ +{% from 'oscar/macros.html' import draw_favicon %} + {{ result.title|striptags }} @@ -7,7 +9,7 @@