From c6c4b8ea6ec83d429528e853173fbad7ce8aed4c Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 29 May 2016 14:34:26 +0530 Subject: [PATCH] Replace in-tag commas with spaces. Operational note on tag delimiter. --- README.md | 1 + buku | 4 ++-- buku.1 | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 28a4f2e..840b0ef 100644 --- a/README.md +++ b/README.md @@ -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 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. diff --git a/buku b/buku index 0a555ca..b925596 100755 --- a/buku +++ b/buku @@ -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] != ',': diff --git a/buku.1 b/buku.1 index 28067fb..4f7cf16 100644 --- a/buku.1 +++ b/buku.1 @@ -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.