-
-
Save linuxcaffe/4c82977fb3894b1bf6d8 to your computer and use it in GitHub Desktop.
Revisions
-
wbsch revised this gist
Mar 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ inline_tags = re.findall(r"(?:\A| )@([^ ]+)", t['description']) for newtag in inline_tags: if 'tags' not in t: t['tags'] = [newtag] elif newtag not in t['tags']: t['tags'].append(newtag) -
wbsch revised this gist
Mar 25, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env python # # PoC for "inline tags", as described in TW-1357 # https://bug.tasktools.org/browse/TW-1357 # # Turns # $ task add I saw @bob in the @garden -
wbsch created this gist
Mar 25, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/usr/bin/env python # # PoC for "inline tags", as described in TW-1377 # https://bug.tasktools.org/browse/TW-1377 # # Turns # $ task add I saw @bob in the @garden # Into the equivalent of # $ task add I saw bob in the garden +bob +garden import json import re import sys t = json.loads(sys.stdin.readline()) inline_tags = re.findall(r"(?:\A| )@([^ ]+)", t['description']) for newtag in inline_tags: if not 'tags' in t: t['tags'] = [newtag] elif newtag not in t['tags']: t['tags'].append(newtag) t['description'] = re.sub(r"(\A| )@([^ ]+)", r"\1\2", t['description']) print(json.dumps(t))