From 7d60c63ec5fd08170c27b48ff2e3e46053972c67 Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 29 Jan 2016 15:57:15 +0100 Subject: [PATCH 1/4] fix #85 --- bb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bb.sh b/bb.sh index 9fb3c07..2a08eca 100755 --- a/bb.sh +++ b/bb.sh @@ -664,7 +664,7 @@ all_posts() { done < <(ls -t ./*.html) echo "" 1>&3 echo "" - echo "
$template_archive_index_page
" + echo "
$template_archive_index_page
" } 3>&1 >"$contentfile" create_html_page "$contentfile" "$archive_index.tmp" yes "$global_title — $template_archive_title" @@ -696,7 +696,7 @@ all_tags() { done echo "" 1>&3 echo "" - echo "
$template_archive_index_page
" + echo "
$template_archive_index_page
" } 3>&1 > "$contentfile" create_html_page "$contentfile" "$tags_index.tmp" yes "$global_title — $template_tags_title" From 93d6877a387eb79814766fe2c0e75a0caa6e8a74 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Mon, 8 Feb 2016 10:25:43 +0100 Subject: [PATCH 2/4] fix #94 #97 --- bb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bb.sh b/bb.sh index 6973d07..a72634f 100755 --- a/bb.sh +++ b/bb.sh @@ -858,7 +858,7 @@ make_rss() { pubdate=$(LC_ALL=C date +"%a, %d %b %Y %H:%M:%S %z") echo '' echo '' - echo "$global_title$global_url" + echo "$global_title$global_url/$index_file" echo "$global_descriptionen" echo "$pubdate" echo "$pubdate" @@ -892,7 +892,7 @@ make_rss() { # generate headers, footers, etc create_includes() { { - echo "

$global_title

" + echo "

$global_title

" echo "
$global_description
" } > ".title.html" From 10078f28cbda71f6bec544532382a149217dfb0e Mon Sep 17 00:00:00 2001 From: platschi Date: Tue, 23 Feb 2016 16:18:47 -0300 Subject: [PATCH 3/4] remove topsy, their website now gets forwarded to apple support --- bb.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bb.sh b/bb.sh index a72634f..d55e63c 100755 --- a/bb.sh +++ b/bb.sh @@ -52,8 +52,7 @@ global_variables() { # Set this to false for a Twitter button with share count. The cookieless version # is just a link. global_twitter_cookieless="true" - # Set to "topsy" which can search tweets way early in time, or "twitter" - # for the default search page, where tweets more than a week old are hidden + # Default search page, where tweets more than a week old are hidden global_twitter_search="twitter" # Change this to your disqus username to use disqus for comments @@ -343,8 +342,7 @@ twitter() { id=$RANDOM search_engine="https://twitter.com/search?q=" - [[ $global_twitter_search == topsy ]] && search_engine="http://topsy.com/trackback?url=" - + echo "

$template_comments $template_twitter_button " echo " 

" # Get current tweet count From b22d96827804419a0f90ef8884c0aefcddf3174a Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Wed, 2 Mar 2016 20:34:54 +0100 Subject: [PATCH 4/4] 'rebuild' now keeps original author. Fixes #99 --- README.md | 1 + bb.sh | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0e68ba7..0c22047 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ As a guideline, pull requests should: Changelog --------- +- 2.6 Support for multiple authors, use a different `.config` for each one - 2.5 Massive code cleanup by Martijn Dekker
'tags' command
The word 'posts' in the tag list (both website and command) now has a singular form, check out `template_tags_posts_singular` diff --git a/bb.sh b/bb.sh index a72634f..38cdbb3 100755 --- a/bb.sh +++ b/bb.sh @@ -17,7 +17,7 @@ global_config=".config" # by the 'global_config' file contents global_variables() { global_software_name="BashBlog" - global_software_version="2.5" + global_software_version="2.6" # Blog title global_title="My fancy blog" @@ -396,12 +396,14 @@ is_boilerplate_file() { # "no" to insert new blog posts # $4 title for the html header # $5 original blog timestamp +# $6 post author create_html_page() { content=$1 filename=$2 index=$3 title=$4 timestamp=$5 + author=$6 # Create the actual blog post # html, head @@ -438,7 +440,7 @@ create_html_page() { else echo "
$(LC_ALL=$date_locale date +"$date_format" --date="$timestamp") — " fi - echo "$global_author
" + echo "$author" echo '' # This marks the text body, after the title, date... fi cat "$content" # Actual content @@ -511,7 +513,7 @@ parse_file() { done < "$1" # Create the actual html page - create_html_page "$content" "$filename" no "$title" "$2" + create_html_page "$content" "$filename" no "$title" "$2" "$global_author" rm "$content" } @@ -646,7 +648,7 @@ all_posts() { echo "" } 3>&1 >"$contentfile" - create_html_page "$contentfile" "$archive_index.tmp" yes "$global_title — $template_archive_title" + create_html_page "$contentfile" "$archive_index.tmp" yes "$global_title — $template_archive_title" "$global_author" mv "$archive_index.tmp" "$archive_index" chmod 644 "$archive_index" rm "$contentfile" @@ -677,7 +679,7 @@ all_tags() { echo "" } 3>&1 > "$contentfile" - create_html_page "$contentfile" "$tags_index.tmp" yes "$global_title — $template_tags_title" + create_html_page "$contentfile" "$tags_index.tmp" yes "$global_title — $template_tags_title" "$global_author" mv "$tags_index.tmp" "$tags_index" chmod 644 "$tags_index" rm "$contentfile" @@ -715,7 +717,7 @@ rebuild_index() { echo "" - create_html_page "$contentfile" "$newindexfile" yes "$global_title" + create_html_page "$contentfile" "$newindexfile" yes "$global_title" "$global_author" rm "$contentfile" mv "$newindexfile" "$index_file" chmod 644 "$index_file" @@ -790,7 +792,7 @@ rebuild_tags() { while IFS='' read -r i; do tagname=${i#./"$prefix_tags"} tagname=${tagname%.tmp.html} - create_html_page "$i" "$prefix_tags$tagname.html" yes "$global_title — $template_tag_title \"$tagname\"" + create_html_page "$i" "$prefix_tags$tagname.html" yes "$global_title — $template_tag_title \"$tagname\"" "$global_author" rm "$i" done < <(ls -t ./"$prefix_tags"*.tmp.html 2>/dev/null) echo @@ -803,6 +805,13 @@ get_post_title() { awk '/

/, /<\/a><\/h3>/{if (!/

/ && !/<\/a><\/h3>/) print}' "$1" } +# Return the post author +# +# $1 the html file +get_post_author() { + awk '/
.+/, //{if (!/
.+/ && !//) print}' "$1" | sed 's/<\/div>//g' +} + # Displays a list of the tags # # $2 if "-n", tags will be sorted by number of posts @@ -875,7 +884,7 @@ make_rss() { get_html_file_content 'text' 'entry' $cut_do <"$i" echo "]]>$global_url/${i#./}" echo "$global_url/$i" - echo "$global_author" + echo "$(get_post_author "$i")" echo "$(LC_ALL=C date -r "$i" +"%a, %d %b %Y %H:%M:%S %z")" n=$(( n + 1 )) @@ -985,12 +994,13 @@ rebuild_all_entries() { echo -n "." # Get the title and entry, and rebuild the html structure from scratch (divs, title, description...) title=$(get_post_title "$i") + get_html_file_content 'text' 'text' <"$i" >> "$contentfile" # Original post timestamp timestamp=$(LC_ALL=C date -r "$i" +"%a, %d %b %Y %H:%M:%S %z" ) - create_html_page "$contentfile" "$i.rebuilt" no "$title" "$timestamp" + create_html_page "$contentfile" "$i.rebuilt" no "$title" "$timestamp" "$(get_post_author "$i")" # keep the original timestamp! timestamp=$(LC_ALL=C date -r "$i" +'%Y%m%d%H%M') mv "$i.rebuilt" "$i"