diff --git a/README.md b/README.md index b88083d..d02ed56 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ To install, download a [released alfred-bear workflow](https://github.com/chrisb ## Versions **0.2.0** +* Now allows non-ASCII characters. * Searching by tag now displays not only tags that match the search query, but notes that match those tags as well. * Searching by tag now works with *or* without the '#' symbol in front of the tag. diff --git a/create.py b/create.py index 40a6ccb..9a69ba9 100644 --- a/create.py +++ b/create.py @@ -58,13 +58,13 @@ def create_query_output(title, tags): query_string = '' if title: - query_string += 'title=' + quote(title) - query_string += '&text=' + quote(title) + query_string += 'title=' + quote(title.encode('utf-8')) + query_string += '&text=' + quote(title.encode('utf-8')) if tags: tags_string = '' for tag in tags: - tags_string += quote(tag) + ',' + tags_string += quote(tag.encode('utf-8')) + ',' query_string = strip_tags_from_string(tags, query_string) tags_string = tags_string[:-1] query_string += '&tags=' + tags_string @@ -79,7 +79,7 @@ def strip_tags_from_string(tags, query): Yanks out all the hashtags from a string. """ for tag in tags: - query = query.replace(quote('#' + tag), '') + query = query.replace(quote('#' + tag.encode('utf-8')), '') query = query.replace('#' + tag, '') return query diff --git a/info.plist b/info.plist index 47d8b62..a8bb84d 100644 --- a/info.plist +++ b/info.plist @@ -120,37 +120,6 @@ version 2 - - config - - concurrently - - escaping - 102 - script - orig_query={query} -echo $orig_query -if [[ $orig_query == ":t:"* ]]; then - new_query=${orig_query:3} - open "bear://x-callback-url/open-tag?name=$new_query" -else - new_query=${orig_query:3} - open "bear://x-callback-url/open-note?id=$new_query" -fi - scriptargtype - 0 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - 34803D0C-B70E-4032-96FA-E0A5E179236A - version - 2 - config @@ -204,7 +173,15 @@ fi escaping 102 script - open "bear://x-callback-url/create?{query}" + orig_query={query} +echo $orig_query +if [[ $orig_query == ":t:"* ]]; then + new_query=${orig_query:3} + open "bear://x-callback-url/open-tag?name=$new_query" +else + new_query=${orig_query:3} + open "bear://x-callback-url/open-note?id=$new_query" +fi scriptargtype 0 scriptfile @@ -215,7 +192,7 @@ fi type alfred.workflow.action.script uid - B7C7DDC1-B797-4FF0-8AA0-0362C306C19A + 34803D0C-B70E-4032-96FA-E0A5E179236A version 2 @@ -264,6 +241,29 @@ fi version 2 + + config + + concurrently + + escaping + 102 + script + open "bear://x-callback-url/create?{query}" + scriptargtype + 0 + scriptfile + + type + 0 + + type + alfred.workflow.action.script + uid + B7C7DDC1-B797-4FF0-8AA0-0362C306C19A + version + 2 + readme # Bear Alfred Workflow @@ -327,7 +327,7 @@ To install, download a released alfred-bear.alfredworkflow and double-click to o version - 0.1.0 + 0.2.0 webaddress https://github.com/chrisbro/alfred-bear diff --git a/search.py b/search.py index d3d48b5..7620521 100644 --- a/search.py +++ b/search.py @@ -69,6 +69,7 @@ def execute_search_query(args): query = None if args.query: query = args.query[0] + query = query.encode('utf-8') if SINGLE_QUOTE in query: query = query.replace(SINGLE_QUOTE, ESC_SINGLE_QUOTE) diff --git a/version b/version index 6c6aa7c..341cf11 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.2.0 \ No newline at end of file