Import folder names in lowercase. Document.
This commit is contained in:
parent
c48be129ee
commit
f1a5cd4b88
@ -243,6 +243,7 @@ SYMBOLS:
|
||||
- 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 are stored in lower case and can be replaced, appended or deleted.
|
||||
- Folder names are converted to all-lowercase tags during bookmarks html import.
|
||||
- Releases prior to [v2.7](https://github.com/jarun/Buku/releases/tag/v2.7) support both capital and lower cases in tags. From v2.7 all tags are stored in lowercase. An undocumented option `--fixtags` is introduced to modify the older tags. It also fixes another issue where the same tag appears multiple times in the tagset of a record. Run `buku --fixtags` once.
|
||||
- **Update** operation:
|
||||
- If --title, --tag or --comment is passed without argument, clear the corresponding field from DB.
|
||||
|
1
buku.1
1
buku.1
@ -42,6 +42,7 @@ Bookmarks with immutable titles are listed with bold '(L)' after the URL.
|
||||
.IP 5. 4
|
||||
\fBTags\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 are stored in lower case and can be replaced, appended or deleted.
|
||||
- Folder names are converted to all-lowercase tags during bookmarks html import.
|
||||
- Releases prior to v2.7 support both capital and lower cases in tags. From v2.7 all tags are stored in lowercase. An undocumented option --\fIfixtags\fR is introduced to modify the older tags. It also fixes another issue where the same tag appears multiple times in the tagset of a record. Run \fBbuku --fixtags\fR once.
|
||||
.PP
|
||||
.IP 6. 4
|
||||
|
24
buku.py
24
buku.py
@ -371,7 +371,7 @@ class BukuDb:
|
||||
return os.path.abspath('.')
|
||||
else:
|
||||
data_home = os.path.join(os.environ.get('HOME'),
|
||||
'.local', 'share')
|
||||
'.local', 'share')
|
||||
|
||||
return os.path.join(data_home, 'buku')
|
||||
|
||||
@ -1494,18 +1494,20 @@ class BukuDb:
|
||||
|
||||
html_tags = soup.findAll('a')
|
||||
|
||||
|
||||
resp = input('Add imported folders names as tags? (y/n): ')
|
||||
if resp == 'y' :
|
||||
for tag in html_tags :
|
||||
possible_folder = tag.find_previous('h3') # could be its folder or not
|
||||
tag_list = tag.parent.parent.find_parent('dl') # get list of tags within that folder
|
||||
if resp == 'y':
|
||||
for tag in html_tags:
|
||||
# could be its folder or not
|
||||
possible_folder = tag.find_previous('h3')
|
||||
# get list of tags within that folder
|
||||
tag_list = tag.parent.parent.find_parent('dl')
|
||||
|
||||
if (possible_folder) and possible_folder.parent in list(tag_list.parents):
|
||||
if ((possible_folder) and
|
||||
possible_folder.parent in list(tag_list.parents)):
|
||||
# then it's the folder of this bookmark
|
||||
if tag.has_attr('tags') :
|
||||
tag['tags'] += (DELIMITER + possible_folder.text)
|
||||
else :
|
||||
if tag.has_attr('tags'):
|
||||
tag['tags'] += (DELIM + possible_folder.text)
|
||||
else:
|
||||
tag['tags'] = possible_folder.text
|
||||
|
||||
for tag in html_tags:
|
||||
@ -1515,7 +1517,7 @@ class BukuDb:
|
||||
if comment_tag:
|
||||
desc = comment_tag.text[0:comment_tag.text.find('\n')]
|
||||
|
||||
self.add_rec(tag['href'], tag.string, delim_wrap(tag['tags'])
|
||||
self.add_rec(tag['href'], tag.string, parse_tags([tag['tags']])
|
||||
if tag.has_attr('tags') else None, desc, 0, True)
|
||||
|
||||
self.conn.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user