mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Make editing work with templates
This commit is contained in:
parent
3f9d9bf84f
commit
03bce74262
1 changed files with 2 additions and 4 deletions
|
@ -128,11 +128,9 @@ def load_and_fix_json(json_path):
|
||||||
|
|
||||||
def get_text_from_editor(config, template=""):
|
def get_text_from_editor(config, template=""):
|
||||||
tmpfile = os.path.join(tempfile.gettempdir(), "jrnl")
|
tmpfile = os.path.join(tempfile.gettempdir(), "jrnl")
|
||||||
if template:
|
|
||||||
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
with codecs.open(tmpfile, 'w', "utf-8") as f:
|
||||||
|
if template:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
with open(tmpfile, 'w'):
|
|
||||||
pass
|
|
||||||
subprocess.call(config['editor'].split() + [tmpfile])
|
subprocess.call(config['editor'].split() + [tmpfile])
|
||||||
with codecs.open(tmpfile, "r", "utf-8") as f:
|
with codecs.open(tmpfile, "r", "utf-8") as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
|
|
Loading…
Add table
Reference in a new issue