Skip to content

Commit

Permalink
auto check .html file exists and generate it for command 'status'
Browse files Browse the repository at this point in the history
  • Loading branch information
LeslieZhu committed Oct 20, 2022
1 parent a7aa214 commit 79be58c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion orgnote/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from __future__ import absolute_import

__version__ = "1.0.1"
__version__ = "1.0.2"

def main():
import orgnote.__main__
Expand Down
16 changes: 15 additions & 1 deletion orgnote/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,7 @@ def do_status(self):
_html = _note.replace(".md",".html")
else:
_html = _note

publish_line = util.publish_note(self.notes_db[_note],self.source_dir)

if publish_line not in publish_data and publish_line not in nopublish_data:
Expand All @@ -2497,6 +2497,20 @@ def do_status(self):
# \033[41;37m红色\033[0m
all_publish = False

# check .html exists
for _note in publish_data:
if _note.endswith(".org"):
_html = _note.replace(".org",".html")
elif _note.endswith(".md"):
_html = _note.replace(".md",".html")
else:
continue

if os.path.exists(_note) and not os.path.exists(_html):
all_publish = False
print("\033[34m[Warning]\033[0m: %s not generate html file yet!" % _note)
publish_line = util.publish_note(_note,_note)

if all_publish:
print("all notes published!")

Expand Down

0 comments on commit 79be58c

Please sign in to comment.