Merge remote-tracking branch 'cfenollosa/master'

This commit is contained in:
Carlos Bautista 2013-04-02 14:36:01 +02:00
commit d3b8de1856

20
bb.sh
View file

@ -142,6 +142,9 @@ global_variables() {
template_subscribe_browser_button="Subscribe to this page..." template_subscribe_browser_button="Subscribe to this page..."
# "Tweet" (used as twitter text button for posting to twitter) # "Tweet" (used as twitter text button for posting to twitter)
template_twitter_button="Tweet" template_twitter_button="Tweet"
template_twitter_comment="<Type your comment here but please leave the URL so that other people can follow the comments>"
# The locale to use for the dates displayed on screen (not for the timestamps) # The locale to use for the dates displayed on screen (not for the timestamps)
date_format="%B %d, %Y" date_format="%B %d, %Y"
date_locale="C" date_locale="C"
@ -188,7 +191,7 @@ edit() {
# $1 the post URL # $1 the post URL
twitter() { twitter() {
echo "<p id='twitter'>$template_comments &nbsp;" echo "<p id='twitter'>$template_comments &nbsp;"
echo "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-text=\"&lt;Type your comment here but please leave the URL so that other people can follow the comments&gt;\" data-url=\"$1\"" echo "<a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-text=\"$template_twitter_comment\" data-url=\"$1\""
if [ "$global_twitter_username" != "" ]; then if [ "$global_twitter_username" != "" ]; then
echo " data-via=\"$global_twitter_username\"" echo " data-via=\"$global_twitter_username\""
@ -409,7 +412,7 @@ rebuild_index() {
done done
if [ "$global_feedburner" == "" ]; then if [ "$global_feedburner" == "" ]; then
echo '<div id="all_posts"><a href="'$archive_index'">View more posts</a> &mdash; <a href="'$blog_feed'">'$template_subscribe'</a></div>' >> "$contentfile" echo '<div id="all_posts"><a href="'$archive_index'">'$template_archive'</a> &mdash; <a href="'$blog_feed'">'$template_subscribe'</a></div>' >> "$contentfile"
else else
echo '<div id="all_posts"><a href="'$archive_index'">'$template_archive'</a> &mdash; <a href="'$global_feedburner'">Subscribe</a></div>' >> "$contentfile" echo '<div id="all_posts"><a href="'$archive_index'">'$template_archive'</a> &mdash; <a href="'$global_feedburner'">Subscribe</a></div>' >> "$contentfile"
fi fi
@ -424,6 +427,12 @@ rebuild_index() {
# Displays a list of the posts # Displays a list of the posts
list_posts() { list_posts() {
ls *.html &> /dev/null
if [[ $? -ne 0 ]]; then
echo "No posts yet. Use 'bb.sh post' to create one"
return
fi
lines="" lines=""
n=1 n=1
for i in $(ls -t *.html); do for i in $(ls -t *.html); do
@ -599,8 +608,10 @@ reset() {
echo "Are you sure you want to delete all blog entries? Please write \"Yes, I am!\" " echo "Are you sure you want to delete all blog entries? Please write \"Yes, I am!\" "
read line read line
if [ "$line" == "Yes, I am!" ]; then if [ "$line" == "Yes, I am!" ]; then
rm *.html *.css *.rss rm .*.html *.html *.css *.rss &> /dev/null
echo
echo "Deleted all posts, stylesheets and feeds." echo "Deleted all posts, stylesheets and feeds."
echo "Kept your old '.backup.tar.gz' just in case, please delete it manually if needed."
else else
echo "Phew! You dodged a bullet there. Nothing was modified." echo "Phew! You dodged a bullet there. Nothing was modified."
fi fi
@ -645,8 +656,11 @@ do_main() {
fi fi
# We're going to back up just in case # We're going to back up just in case
ls *.html &> /dev/null
if [[ $? -eq 0 ]]; then
tar cfz ".backup.tar.gz" *.html tar cfz ".backup.tar.gz" *.html
chmod 600 ".backup.tar.gz" chmod 600 ".backup.tar.gz"
fi
if [ "$1" == "reset" ]; then if [ "$1" == "reset" ]; then
reset reset