mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 13:36:14 +02:00
Allow custom extensions when editing (for easier syntax highlighting) (#1139)
* Create tests and steps for temporary filename suffix * Have temporary filename suffix be -{template_filename} or .jrnl * Finalize extension_editor_file * Make suffix local variable in get_text_from_editor
This commit is contained in:
parent
c47c1e209e
commit
e9fd5cdc0e
5 changed files with 42 additions and 1 deletions
|
@ -248,6 +248,14 @@ def contains_editor_file(context, method, text=""):
|
|||
assert False, f"Method '{method}' not supported"
|
||||
|
||||
|
||||
@then('the temporary filename suffix should be "{suffix}"')
|
||||
def extension_editor_file(context, suffix):
|
||||
filename = Path(context.editor_file["name"]).name
|
||||
delimiter = "-" if "-" in filename else "."
|
||||
filename_suffix = delimiter + filename.split(delimiter)[-1]
|
||||
assert filename_suffix == suffix
|
||||
|
||||
|
||||
def _mock_getpass(inputs):
|
||||
def prompt_return(prompt=""):
|
||||
if type(inputs) == str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue