removed blog content, modified joplin export to export only notes/notebooks tagged with -blog-, readme update
This commit is contained in:
22
joplinexport
22
joplinexport
@@ -39,9 +39,11 @@ class Folder:
|
||||
title: str
|
||||
icon: str
|
||||
|
||||
def is_private(self) -> bool:
|
||||
"""Return whether this folder is private."""
|
||||
return contains_word("private", self.title)
|
||||
def is_for_blog(self) -> bool:
|
||||
"""Return whether this folder is for posting to blog."""
|
||||
"""Currently looks for the joplin folder named Blog"""
|
||||
|
||||
return contains_word("Blog", self.title)
|
||||
|
||||
def get_url(self) -> str:
|
||||
"""Return the folder's relative URL."""
|
||||
@@ -78,15 +80,15 @@ class Note:
|
||||
updated_time: datetime
|
||||
tags: List[str] = dataclasses.field(default_factory=list)
|
||||
|
||||
def is_private(self) -> bool:
|
||||
def is_for_blog(self) -> bool:
|
||||
"""
|
||||
Check whether a note is private.
|
||||
Check whether a note is tagged for being published to blog.
|
||||
|
||||
This function checks a note's title and tags and returns whether it
|
||||
should be considered private or whether it should be published.
|
||||
should be whether it should be published or be considered private
|
||||
"""
|
||||
hidden_keywords = ["private", "wip", "draft"]
|
||||
for keyword in hidden_keywords:
|
||||
blog_keywords = ["blog"]
|
||||
for keyword in blog_keywords:
|
||||
if contains_word(keyword, self.title) or keyword in self.tags:
|
||||
return True
|
||||
return False
|
||||
@@ -215,7 +217,7 @@ class JoplinExporter:
|
||||
}
|
||||
|
||||
self.folders = {
|
||||
id: folder for id, folder in self.folders.items() if not folder.is_private()
|
||||
id: folder for id, folder in self.folders.items() if folder.is_for_blog()
|
||||
}
|
||||
|
||||
# Get the tags by ID.
|
||||
@@ -252,7 +254,7 @@ class JoplinExporter:
|
||||
datetime.fromtimestamp(updated_time / 1000),
|
||||
tags=note_tags[id],
|
||||
)
|
||||
if note.is_private():
|
||||
if note.is_for_blog():
|
||||
continue
|
||||
|
||||
self.notes[note.folder.id].append(note)
|
||||
|
Reference in New Issue
Block a user