Replace in-tag commas with spaces.

Operational note on tag delimiter.
This commit is contained in:
Arun Prakash Jana 2016-05-29 14:34:26 +05:30
parent 8556d61cf3
commit c6c4b8ea6e
No known key found for this signature in database
GPG Key ID: C0A712ED95043DCB
3 changed files with 5 additions and 2 deletions

View File

@ -185,6 +185,7 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi
- It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading `http://` or `https://` token. buku looks up title data (found within <title></title> tags of HTML) from the web ONLY for fully-formed HTTP(S) URLs.
- If the URL contains characters like `;`, `&` or brackets they may be interpreted specially by the shell. To avoid it, add the URL within single or double (`'`/`"`) quotes.
- URLs are unique in DB. The same URL cannot be added twice. You can update tags and re-fetch title data.
- For tags, comma (`,`) is the delimiter in DB. Tags are comma separated, filtered (for unique tags) and sorted. Hence, a tag cannot have comma(s) in it. In-tag commas are replaced by spaces.
- **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.

4
buku
View File

@ -893,9 +893,9 @@ def parse_tags(keywords=[]):
tags += ','
if tag[-1] == ',': # if delimiter is present, maintain it (e.g. token1, token2)
tag = tag.strip(',') + ','
tag = tag.strip(',').replace(',', ' ') + ','
else: # a token in a multi-word tag (e.g. token1 token2)
tag = tag.strip(',')
tag = tag.strip(',').replace(',', ' ')
if tag == ',': # isolated delimiter (e.g. token1 , token2)
if tags[-1] != ',':

2
buku.1
View File

@ -30,6 +30,8 @@ If the URL contains characters like ';', '&' or brackets they may be interpreted
.PP
URLs are unique in DB. The same URL cannot be added twice. You can update tags and re-fetch title data.
.PP
For tags, comma (',') is the delimiter in DB. Tags are comma separated, filtered (for unique tags) and sorted. Hence, a tag cannot have comma(s) in it. In-tag commas are replaced by spaces.
.PP
\fBUpdate\fR 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.