Skip to content

Commit a996df3

Browse files
committed
Merge pull request #396 from Ne4istb/master
Added plugin for quick search in AngularJS documentation
2 parents 86680a2 + d63b750 commit a996df3

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed
37.9 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
angular ~query(directive)
2+
ng ~query(compile)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "angulardocs",
3+
"displayName": "AngularJS Docs",
4+
"description": "Quick search in AngularJS Documentation",
5+
"examples": ["angular directives", "ng compile"],
6+
"categories": ["Developer"],
7+
"creator_name": "Ne4istb"
8+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import urllib
2+
import json
3+
import i18n
4+
5+
6+
def results(parsed, original_query):
7+
8+
angular_specs = [
9+
["~query", "http://docs-angular.herokuapp.com/#/<query>"]
10+
]
11+
for key, url in angular_specs:
12+
if key in parsed:
13+
search_query = parsed[key].encode('UTF-8')
14+
title = i18n.localstr("Search in Angular Docs for '{0}'").format(search_query)
15+
search_url = url.replace("<query>", urllib.quote(search_query))
16+
return {
17+
"title": title,
18+
"run_args": [search_url],
19+
"html": """
20+
<script>
21+
setTimeout(function() {
22+
window.location = %s
23+
}, 500);
24+
</script>
25+
""" % (json.dumps(search_url)),
26+
"webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
27+
"webview_links_open_in_browser": True
28+
}
29+
30+
def run(url):
31+
import os
32+
os.system('open "{0}"'.format(url))

0 commit comments

Comments
 (0)