diff options
author | Alexey Shpakovsky <alexey@shpakovsky.ru> | 2014-03-01 13:55:55 +0100 |
---|---|---|
committer | Aleksei Shpakovskii <alekseis@opera.com> | 2014-03-10 09:22:19 +0100 |
commit | b365aec7978f663f21c3560e82ada7f0b49cdc1d (patch) | |
tree | 5bb1c9738b7214682783e0cee180362c66cdaebe /bb.sh | |
parent | 699ecc60058106751d579c76156a7a08d7e5a85b (diff) |
show only text content in the editor
Diffstat (limited to 'bb.sh')
-rwxr-xr-x | bb.sh | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -338,14 +338,25 @@ get_html_file_content() { # Please note that this function does not automatically republish anything, as # it is usually called from 'main'. # -# 'edit' is kind of an advanced feature, as it leaves to the user the responsibility -# of editing an html file +# Note that it edits HTML file, even if you wrote the post as markdown originally +# Note that if you edit title then filename might also change # # $1 the file to edit edit() { - timestamp="$(date -r $1 +'%Y%m%d%H%M')" - $EDITOR "$1" - touch -t $timestamp "$1" + edit_timestamp="$(date -r $1 +'%Y%m%d%H%M')" + # Create the content file + TMPFILE="$1.$RANDOM" + # Title + echo "$(get_post_title $1)" > "$TMPFILE" + # Post text with plaintext tags + get_html_file_content 'text' 'text' <$1 | sed "s|<a href='$prefix_tags\([^']*\).html'>\\1</a>|\\1|g" >> "$TMPFILE" + rm $1 + $EDITOR "$TMPFILE" + parse_file "$TMPFILE" # this command sets $filename as the html processed file + touch -t $edit_timestamp "$filename" + rm "$TMPFILE" + chmod 644 "$filename" + echo "Posted $filename" } # Adds the code needed by the twitter button |