@@ -17,7 +17,7 @@ global_config=".config"
17
17
# by the 'global_config' file contents
18
18
global_variables () {
19
19
global_software_name=" BashBlog"
20
- global_software_version=" 2.5 "
20
+ global_software_version=" 2.6 "
21
21
22
22
# Blog title
23
23
global_title=" My fancy blog"
@@ -52,8 +52,7 @@ global_variables() {
52
52
# Set this to false for a Twitter button with share count. The cookieless version
53
53
# is just a link.
54
54
global_twitter_cookieless=" true"
55
- # Set to "topsy" which can search tweets way early in time, or "twitter"
56
- # for the default search page, where tweets more than a week old are hidden
55
+ # Default search page, where tweets more than a week old are hidden
57
56
global_twitter_search=" twitter"
58
57
59
58
# Change this to your disqus username to use disqus for comments
@@ -343,8 +342,7 @@ twitter() {
343
342
id=$RANDOM
344
343
345
344
search_engine=" https://twitter.com/search? q= "
346
- [[ $global_twitter_search == topsy ]] && search_engine=" http://topsy.com/trackback? url= "
347
-
345
+
348
346
echo " < p id= ' twitter' >< a href= ' http://twitter.com/intent/tweet?url=$1&text=$template_twitter_comment&via=$global_twitter_username' > $template_comments $template_twitter_button < /a> "
349
347
echo " < a href= ' $search_engine""$1' >< span id= ' count-$id' >< /span>< /a> & nbsp; < /p> "
350
348
# Get current tweet count
@@ -396,12 +394,14 @@ is_boilerplate_file() {
396
394
# "no" to insert new blog posts
397
395
# $4 title for the html header
398
396
# $5 original blog timestamp
397
+ # $6 post author
399
398
create_html_page () {
400
399
content=$1
401
400
filename=$2
402
401
index=$3
403
402
title=$4
404
403
timestamp=$5
404
+ author=$6
405
405
406
406
# Create the actual blog post
407
407
# html, head
@@ -438,7 +438,7 @@ create_html_page() {
438
438
else
439
439
echo " <div class=\" subtitle\" >$( LC_ALL=$date_locale date +" $date_format " --date=" $timestamp " ) — "
440
440
fi
441
- echo " $global_author </div>"
441
+ echo " $author </div>"
442
442
echo ' <!-- text begin -->' # This marks the text body, after the title, date...
443
443
fi
444
444
cat " $content " # Actual content
@@ -511,7 +511,7 @@ parse_file() {
511
511
done < " $1 "
512
512
513
513
# Create the actual html page
514
- create_html_page " $content " " $filename " no " $title " " $2 "
514
+ create_html_page " $content " " $filename " no " $title " " $2 " " $global_author "
515
515
rm " $content "
516
516
}
517
517
@@ -643,10 +643,10 @@ all_posts() {
643
643
done < <( ls -t ./* .html)
644
644
echo " " 1>&3
645
645
echo " </ul>"
646
- echo " <div id=\" all_posts\" ><a href=\" ./\" >$template_archive_index_page </a></div>"
646
+ echo " <div id=\" all_posts\" ><a href=\" ./$index_file \" >$template_archive_index_page </a></div>"
647
647
} 3>&1 > " $contentfile "
648
648
649
- create_html_page " $contentfile " " $archive_index .tmp" yes " $global_title — $template_archive_title "
649
+ create_html_page " $contentfile " " $archive_index .tmp" yes " $global_title — $template_archive_title " " $global_author "
650
650
mv " $archive_index .tmp" " $archive_index "
651
651
chmod 644 " $archive_index "
652
652
rm " $contentfile "
@@ -674,10 +674,10 @@ all_tags() {
674
674
done
675
675
echo " " 1>&3
676
676
echo " </ul>"
677
- echo " <div id=\" all_posts\" ><a href=\" ./\" >$template_archive_index_page </a></div>"
677
+ echo " <div id=\" all_posts\" ><a href=\" ./$index_file \" >$template_archive_index_page </a></div>"
678
678
} 3>&1 > " $contentfile "
679
679
680
- create_html_page " $contentfile " " $tags_index .tmp" yes " $global_title — $template_tags_title "
680
+ create_html_page " $contentfile " " $tags_index .tmp" yes " $global_title — $template_tags_title " " $global_author "
681
681
mv " $tags_index .tmp" " $tags_index "
682
682
chmod 644 " $tags_index "
683
683
rm " $contentfile "
@@ -715,7 +715,7 @@ rebuild_index() {
715
715
716
716
echo " "
717
717
718
- create_html_page " $contentfile " " $newindexfile " yes " $global_title "
718
+ create_html_page " $contentfile " " $newindexfile " yes " $global_title " " $global_author "
719
719
rm " $contentfile "
720
720
mv " $newindexfile " " $index_file "
721
721
chmod 644 " $index_file "
@@ -795,7 +795,7 @@ rebuild_tags() {
795
795
while IFS=' ' read -r i; do
796
796
tagname=${i# ./ " $prefix_tags " }
797
797
tagname=${tagname% .tmp.html}
798
- create_html_page " $i " " $prefix_tags$tagname .html" yes " $global_title — $template_tag_title \" $tagname \" "
798
+ create_html_page " $i " " $prefix_tags$tagname .html" yes " $global_title — $template_tag_title \" $tagname \" " " $global_author "
799
799
rm " $i "
800
800
done < <( ls -t ./" $prefix_tags " * .tmp.html 2> /dev/null)
801
801
echo
@@ -808,6 +808,13 @@ get_post_title() {
808
808
awk ' /<h3><a class="ablack" href=".+">/, /<\/a><\/h3>/{if (!/<h3><a class="ablack" href=".+">/ && !/<\/a><\/h3>/) print}' " $1 "
809
809
}
810
810
811
+ # Return the post author
812
+ #
813
+ # $1 the html file
814
+ get_post_author () {
815
+ awk ' /<div class="subtitle">.+/, /<!-- text begin -->/{if (!/<div class="subtitle">.+/ && !/<!-- text begin -->/) print}' " $1 " | sed ' s/<\/div>//g'
816
+ }
817
+
811
818
# Displays a list of the tags
812
819
#
813
820
# $2 if "-n", tags will be sorted by number of posts
@@ -863,7 +870,7 @@ make_rss() {
863
870
pubdate=$( LC_ALL=C date +" %a, %d %b %Y %H:%M:%S %z" )
864
871
echo ' <?xml version="1.0" encoding="UTF-8" ?>'
865
872
echo ' <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'
866
- echo " <channel><title>$global_title </title><link>$global_url </link>"
873
+ echo " <channel><title>$global_title </title><link>$global_url / $index_file </link>"
867
874
echo " <description>$global_description </description><language>en</language>"
868
875
echo " <lastBuildDate>$pubdate </lastBuildDate>"
869
876
echo " <pubDate>$pubdate </pubDate>"
@@ -880,7 +887,7 @@ make_rss() {
880
887
get_html_file_content ' text' ' entry' $cut_do < " $i "
881
888
echo " ]]></description><link>$global_url /${i# ./ } </link>"
882
889
echo " <guid>$global_url /$i </guid>"
883
- echo " <dc:creator>$global_author </dc:creator>"
890
+ echo " <dc:creator>$( get_post_author " $i " ) </dc:creator>"
884
891
echo " <pubDate>$( LC_ALL=C date -r " $i " +" %a, %d %b %Y %H:%M:%S %z" ) </pubDate></item>"
885
892
886
893
n=$(( n + 1 ))
@@ -897,7 +904,7 @@ make_rss() {
897
904
# generate headers, footers, etc
898
905
create_includes () {
899
906
{
900
- echo " <h1 class=\" nomargin\" ><a class=\" ablack\" href=\" $global_url \" >$global_title </a></h1>"
907
+ echo " <h1 class=\" nomargin\" ><a class=\" ablack\" href=\" $global_url / $index_file \" >$global_title </a></h1>"
901
908
echo " <div id=\" description\" >$global_description </div>"
902
909
} > " .title.html"
903
910
@@ -990,12 +997,13 @@ rebuild_all_entries() {
990
997
echo -n " ."
991
998
# Get the title and entry, and rebuild the html structure from scratch (divs, title, description...)
992
999
title=$( get_post_title " $i " )
1000
+
993
1001
get_html_file_content ' text' ' text' < " $i " >> " $contentfile "
994
1002
995
1003
# Original post timestamp
996
1004
timestamp=$( LC_ALL=C date -r " $i " +" %a, %d %b %Y %H:%M:%S %z" )
997
1005
998
- create_html_page " $contentfile " " $i .rebuilt" no " $title " " $timestamp "
1006
+ create_html_page " $contentfile " " $i .rebuilt" no " $title " " $timestamp " " $( get_post_author " $i " ) "
999
1007
# keep the original timestamp!
1000
1008
timestamp=$( LC_ALL=C date -r " $i " +' %Y%m%d%H%M' )
1001
1009
mv " $i .rebuilt" " $i "
0 commit comments