Skip to content

Commit

Permalink
fix new line bug in TODO item
Browse files Browse the repository at this point in the history
  • Loading branch information
Nriver committed Feb 24, 2022
1 parent c84090f commit e0316c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -43,7 +43,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/guides/single-sourcing-package-version/
version='0.5.7', # Required
version='0.5.8', # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down
3 changes: 2 additions & 1 deletion src/trilium_py/client.py
Expand Up @@ -362,6 +362,7 @@ def todo_uncheck(self, todo_index):

def add_todo(self, todo_description):
"""append item to todo list"""
todo_description = todo_description.strip()
try:
content = self.get_today_note_content()
soup = BeautifulSoup(content, 'html.parser')
Expand All @@ -385,7 +386,6 @@ def add_todo(self, todo_description):
todo_item = BeautifulSoup(todo_item_html, 'html.parser')
todo_list_label = soup.find_all("ul", {"class": "todo-list"})[0]
todo_list_label.append(todo_item)

new_content = str(soup)
# free mem
soup.decompose()
Expand All @@ -399,6 +399,7 @@ def add_todo(self, todo_description):

def update_todo(self, todo_index, todo_description):
"""update a todo item description"""
todo_description = todo_description.strip()
content = self.get_today_note_content()
soup = BeautifulSoup(content, 'html.parser')
todo_labels = soup.find_all("label", {"class": "todo-list__label"})
Expand Down

0 comments on commit e0316c3

Please sign in to comment.