From 7e762e1d635be225d3d40f404929922a7c7caf95 Mon Sep 17 00:00:00 2001 From: Stephan Gabler Date: Fri, 10 Aug 2012 21:34:15 +0200 Subject: [PATCH] filter the journal according to search also for html display --- jrnl/exporters.py | 1 - jrnl/jrnl.py | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/jrnl/exporters.py b/jrnl/exporters.py index 046f42f0..c0312c1b 100644 --- a/jrnl/exporters.py +++ b/jrnl/exporters.py @@ -47,7 +47,6 @@ def to_html(journal, open_in_browser=False): and can open it in the default browser""" bla = to_md(journal) html_body = markdown.markdown(bla.decode('utf8')) - print html_body tmp_file = os.path.join(tempfile.gettempdir(), "pretty.html") url = 'file://' + tmp_file output_file = codecs.open(tmp_file, "w", encoding="utf8") diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index a68089e8..e991bcf4 100755 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -185,13 +185,16 @@ def cli(): journal.write() # Reading mode - elif not mode_export: + elif not mode_export or args.html: journal.filter(tags=args.text, - start_date=args.start_date, end_date=args.end_date, - strict=args.strict, - short=args.short) + start_date=args.start_date, end_date=args.end_date, + strict=args.strict, + short=args.short) journal.limit(args.limit) - print(journal) + if args.html: + exporters.to_html(journal, True) + else: + print(journal) # Various export modes elif args.tags: @@ -203,10 +206,6 @@ def cli(): elif args.markdown: # export to json print(exporters.to_md(journal)) - elif args.html: #export to html and open in browser - print 'test' - exporters.to_html(journal, True) - elif (args.encrypt is not False or args.decrypt is not False) and not PYCRYPTO: print("PyCrypto not found. To encrypt or decrypt your journal, install the PyCrypto package from http://www.pycrypto.org.")