Merge pull request 'Removed needless test_ function since we will require pandoc around line 166' (#5) from test_pandoc-removal into main

Reviewed-on: #5

merging. Testing successful.
This commit is contained in:
PresGas 2021-07-04 18:33:22 +00:00
commit 64db976d9d
1 changed files with 1 additions and 33 deletions

34
bb.sh
View File

@ -183,25 +183,6 @@ global_variables_check() {
}
# Test if the markdown script is working correctly
#test_markdown() {
# [[ -n $markdown_bin ]] &&
# (
# [[ $("$markdown_bin" <<< $'line 1\n\nline 2') == $'<p>line 1</p>\n\n<p>line 2</p>' ]] ||
# [[ $("$markdown_bin" <<< $'line 1\n\nline 2') == $'<p>line 1</p>\n<p>line 2</p>' ]]
# )
#}
#test_pandoc() {
# [[ $($pandoc_command <<< $'line 1\n\nline 2') == $'<p>line 1</p>\n\n<p>line 2</p>' ]]
#}
# The function above isn't working. Making placeholder to make function true
test_pandoc() {
[[ 1 == 1 ]]
}
# Parse a Commonmark Markdown file into HTML and return the generated file
commonmark() {
out=${1%.md}.html
@ -313,11 +294,6 @@ edit() {
filename=$1
else
if [[ ${1##*.} == md ]]; then
test_pandoc
if (($? != 0)); then
echo "pandoc is not working, please edit HTML file directly."
exit
fi
# editing commonmark file
$EDITOR "$1"
TMPFILE=$(commonmark "$1")
@ -568,7 +544,7 @@ parse_file() {
# Manages the creation of the text file and the parsing to html file
# also the drafts
write_entry() {
test_pandoc && fmt=md || fmt=html
fmt=md || fmt=html
f=$2
[[ $2 == -html ]] && fmt=html && f=$3
@ -584,14 +560,6 @@ write_entry() {
[[ $extension == md || $extension == html ]] && fmt=$extension
# but let user override it (`bb.sh post -html file.md`)
[[ $2 == -html ]] && fmt=html
# Test if pandoc is working before re-posting a .md file
if [[ $extension == md ]]; then
test_pandoc
if (($? != 0)); then
echo "pandoc is not working, please edit HTML file directly."
exit
fi
fi
else
TMPFILE=.entry-$RANDOM.$fmt
echo -e "Title on this line\n" >> "$TMPFILE"