Store tags in lower case.

This commit is contained in:
Arun Prakash Jana 2016-11-20 11:52:28 +05:30
parent e56c04a315
commit 63bce1004d
3 changed files with 6 additions and 5 deletions

View File

@ -220,7 +220,7 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi
- URLs are unique in DB. The same URL cannot be added twice.
- Bookmarks with immutable titles are listed with bold `(L)` after the URL.
- **Tags**:
- Comma (`,`) is the tag delimiter in DB. A tag cannot have comma(s) in it. Tags are filtered (for unique tags) and sorted. Tags can be replaced.
- Comma (`,`) is the tag delimiter in DB. A tag cannot have comma(s) in it. Tags are filtered (for unique tags) and sorted. Tags are stored in lower case and can be replaced, appended or deleted.
- **Update** operation:
- If --title, --tag or --comment is passed without argument, clear the corresponding field from DB.
- If --url is passed (and --title is omitted), update the title from web using the URL.

2
buku.1
View File

@ -34,7 +34,7 @@ URLs are unique in DB. The same URL cannot be added twice.
Bookmarks with immutable titles are listed with bold '(L)' after the URL.
.PP
\fITags\fR:
- Comma (',') is the tag delimiter in DB. A tag cannot have comma(s) in it. Tags are filtered (for unique tags) and sorted. Tags can be replaced.
- Comma (',') is the tag delimiter in DB. A tag cannot have comma(s) in it. Tags are filtered (for unique tags) and sorted. Tags are stored in lower case and can be replaced, appended or deleted.
.PP
\fIUpdate\fR operation:
- If --title, --tag or --comment is passed without argument, clear the corresponding field from DB.

View File

@ -1624,11 +1624,12 @@ def parse_tags(keywords=None):
orig_tags += tags.strip(DELIM).split(DELIM)
for tag in orig_tags:
if tag not in unique_tags:
unique_tags += (tag, ) # Select unique tags
if tag.lower() not in unique_tags:
# Add unique tags in lowercase
unique_tags += (tag.lower(), )
# Sort the tags
sorted_tags = sorted(unique_tags, key=str.lower)
sorted_tags = sorted(unique_tags)
# Wrap with delimiter
return '%s%s%s' % (DELIM, DELIM.join(sorted_tags), DELIM)