$preview_url for those who writes posts locally before uploading them

This commit is contained in:
Alexey Shpakovsky 2014-06-22 08:26:39 +02:00
parent b0dd400d1c
commit feb7f415ce

9
bb.sh
View File

@ -223,6 +223,12 @@ global_variables() {
# This default filter respects backwards compatibility # This default filter respects backwards compatibility
convert_filename="iconv -f utf-8 -t ascii//translit | sed 's/^-*//' | tr [:upper:] [:lower:] | tr ' ' '-' | tr -dc '[:alnum:]-'" convert_filename="iconv -f utf-8 -t ascii//translit | sed 's/^-*//' | tr [:upper:] [:lower:] | tr ' ' '-' | tr -dc '[:alnum:]-'"
# URL where you can view the post while it's being edited
# same as global_url by default
# You can change it to path on your computer, if you write posts locally
# before copying them to the server
preview_url=""
# Markdown location. Trying to autodetect by default. # Markdown location. Trying to autodetect by default.
# The invocation must support the signature 'markdown_bin in.md > out.html' # The invocation must support the signature 'markdown_bin in.md > out.html'
markdown_bin="$(which Markdown.pl)" markdown_bin="$(which Markdown.pl)"
@ -635,7 +641,8 @@ EOF
read p read p
if [[ "$p" != "n" ]] && [[ "$p" != "N" ]]; then if [[ "$p" != "n" ]] && [[ "$p" != "N" ]]; then
chmod 644 "$filename" chmod 644 "$filename"
echo "Open $global_url/$filename in your browser" [ $preview_url ] || preview_url="$global_url"
echo "Open $preview_url/$filename in your browser"
fi fi
echo -n "[P]ost this entry, [E]dit again, [D]raft for later? (p/E/d) " echo -n "[P]ost this entry, [E]dit again, [D]raft for later? (p/E/d) "