diff --git a/buku.py b/buku.py index b76ddd5..144446d 100755 --- a/buku.py +++ b/buku.py @@ -1491,8 +1491,23 @@ class BukuDb: except Exception as e: logerr(e) return False - + 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 (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 : + tag['tags'] = possible_folder.text + for tag in html_tags: # Extract comment from