Closed DjangoReinhard closed 3 years ago
Hi,
found the bug on my own. Its caused by gvim, which does not block the commandline during editing. So html-file will be generated before editing starts.
A possible fix might be, to move lines 611 + 612 up directly after the editor call (original position is commented out):
filename=""
while [[ $post_status != "p" && $post_status != "P" ]]; do
[[ -n $filename ]] && rm "$filename" # Delete the generated html file, if any
$EDITOR "$TMPFILE"
echo -n "[P]ost this entry, [E]dit again, [D]raft for later? (p/E/d) "
read -r post_status
if [[ $fmt == md ]]; then
html_from_md=$(markdown "$TMPFILE")
parse_file "$html_from_md"
rm "$html_from_md"
else
parse_file "$TMPFILE" # this command sets $filename as the html processed file
fi
chmod 644 "$filename"
[[ -n $preview_url ]] || preview_url=$global_url
echo "To preview the entry, open $preview_url/$filename in your browser"
# echo -n "[P]ost this entry, [E]dit again, [D]raft for later? (p/E/d) "
# read -r post_status
if [[ $post_status == d || $post_status == D ]]; then
mkdir -p "drafts/"
Set your $EDITOR to gvim -f
so the editor stays on the foreground in the shell.
Hi,
I just tried you script and whatever I write, it always publishes the default content generated from script. So I started the script with xtrace option and save the output to a logfile. The log shows, that a markdown-file is used for editing, but then the html-file gets parsed without generating html-content from markdown:
excerpt from script is this (line 598ff):
testing markdown on commandline shows, that markdown prints the converted html to stdout. So I guess, markdown line is missing some content-redirection into html-file.