Fixed bug in markdown detection

This commit is contained in:
Carlos Fenollosa 2013-12-23 21:09:22 +01:00
parent 9f07bdbc3d
commit 5e14442cc7

14
bb.sh
View file

@ -177,7 +177,7 @@ global_variables() {
# Test if the markdown script is working correctly # Test if the markdown script is working correctly
test_markdown() { test_markdown() {
[[ -z "$markdown_bin" ]] && echo "Markdown binary not found" && return 1 [[ -z "$markdown_bin" ]] && return 1
in="/tmp/md-in-$(echo $RANDOM).md" in="/tmp/md-in-$(echo $RANDOM).md"
out="/tmp/md-out-$(echo $RANDOM).html" out="/tmp/md-out-$(echo $RANDOM).html"
@ -188,7 +188,6 @@ test_markdown() {
diff $good $out &> /dev/null # output is irrelevant, we'll check $? diff $good $out &> /dev/null # output is irrelevant, we'll check $?
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
rm -f $in $good $out rm -f $in $good $out
echo "Markdown binary not converting properly"
return 1 return 1
fi fi
@ -402,9 +401,14 @@ parse_file() {
write_entry() { write_entry() {
fmt="html"; f="$2" fmt="html"; f="$2"
[[ "$2" == "-m" ]] && fmt="md" && f="$3" [[ "$2" == "-m" ]] && fmt="md" && f="$3"
[[ "$fmt" == "md" ]] && [[ $(test_markdown) -ne 0 ]] && if [[ "$fmt" == "md" ]]; then
echo "Markdown is not working, please use HTML. Press a key to continue..." && test_markdown
fmt="html" && read if [[ "$?" -ne 0 ]]; then
echo "Markdown is not working, please use HTML. Press a key to continue..."
fmt="html"
read
fi
fi
if [[ "$f" != "" ]]; then if [[ "$f" != "" ]]; then
TMPFILE="$f" TMPFILE="$f"