Code Monkey home page Code Monkey logo

bashblog's People

Contributors

carlosbm avatar cfenollosa avatar damateos avatar dasistdaniel avatar datyedyeguy avatar enneka avatar juliangruber avatar lex-2008 avatar mcdutchie avatar pborreli avatar platschi avatar pointychimp avatar puuhinen avatar subtleq avatar vielmetti avatar ysangkok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bashblog's Issues

H3 titles

What's the reason for using the

tag for the blog post titles?

HTML5

Hi,

I think bashblog should be updated to generate HTML5 output. Are there any plans or do you want to stick with XHTML?

Greetings,
Tulpenzwiebel

Would be nice to have a generic "title-to-filename" function

Currently, there are two title-to-filename conversions (to find them, search for tr [:upper:] [:lower:]):

  • one in parse_file(), used when posting a file
  • another in write_entry(), used when saving a draft

They are already a bit different (because I edited one and didn't think about the other), so probably there should be a nice function to do that.

It makes it harder to write this function, since parse_file() expects $title to have a title, and $filename to store a filename, while in write_entry(), $title used for filename, and $filename -- for something else. So I'm not sure what variable name to use inside the function, that's why creating an issue instead of fixing myself :)

Shellcheck warnings

Out of habit I ran ShellCheck over bashblog, as it's quite a large shell script and bash is hard to write well.

While ShellCheck does tend to highlight things that aren't actually bugs, it did point out a few things that are problematic.

Output from shellcheck bb.sh below:

jonty@towel:~/sandbox $ shellcheck bb.sh

In bb.sh line 166:
    in="/tmp/md-in-$(echo $RANDOM).md"
                   ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.

In bb.sh line 167:
    out="/tmp/md-out-$(echo $RANDOM).html"
                     ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.

In bb.sh line 168:
    good="/tmp/md-good-$(echo $RANDOM).html"
                       ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.

In bb.sh line 169:
    echo -e "line 1\n\nline 2" > $in
                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 170:
    echo -e "<p>line 1</p>\n\n<p>line 2</p>" > $good
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 171:
    $markdown_bin $in > $out 2> /dev/null
                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 172:
    diff $good $out &> /dev/null # output is irrelevant, we'll check $?
         ^-- SC2086: Double quote to prevent globbing and word splitting.
               ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 174:
        rm -f $in $good $out
              ^-- SC2086: Double quote to prevent globbing and word splitting.
                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 178:
    rm -f $in $good $out
          ^-- SC2086: Double quote to prevent globbing and word splitting.
              ^-- SC2086: Double quote to prevent globbing and word splitting.
                    ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 185:
    out="$(echo $1 | sed 's/md$/html/g')"
                ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 186:
    while [ -f "$out" ]; do out="$(echo $out | sed 's/\.html$/\.'$RANDOM'\.html/')"; done
                                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 187:
    $markdown_bin $1 > $out
                  ^-- SC2086: Double quote to prevent globbing and word splitting.
                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 188:
    echo $out
         ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 197:
        echo "<script type=\"text/javascript\">
             ^-- SC1078: Did you forget to close this double quoted string?

In bb.sh line 200:
        _gaq.push(['_setAccount', '"$global_analytics"']);
                                   ^-- SC1079: This is actually an end quote, but due to next char it looks suspect.
                                    ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.

In bb.sh line 259:
    awk '/<!-- '$1' begin -->/, /<!-- '$2' end -->/{
                ^-- SC2086: Double quote to prevent globbing and word splitting.
                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 260:
        if (!/<!-- '$1' begin -->/ && !/<!-- '$2' end -->/) print
                    ^-- SC2086: Double quote to prevent globbing and word splitting.
                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 261:
        if ("'$3'" == "cut" && /'"$cut_line"'/){
              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 262:
            if ("'$2'" == "text") exit # no need to read further
                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 303:
            TMPFILE="$(basename $1).$RANDOM.html"
                                ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 305:
            echo "$(get_post_title $1)" > "$TMPFILE"
                 ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 307:
            get_html_file_content 'text' 'text' <$1 | sed "/^<p>$template_tags_line_header/s|<a href='$prefix_tags\([^']*\).html'>\\1</a>|\\1|g" >> "$TMPFILE"
                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 323:
    tags_after="$(tags_in_post $filename)"
                               ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 326:
        relevant_posts="$(posts_with_tags $relevant_tags) $filename"
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 341:
    description=$(grep -v "^<p>$template_tags_line_header" $1 | sed -e 's/<[^>]*>//g' | head -c 250 | tr '\n' ' ' | sed "s/\"/'/g") 
                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 343:
    image=$(sed -n 's/.*<img.*src="\([^"]*\)".*/\1/p' $1 | head -n 1) # First image is fine
                                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 345:
    [[ $image =~ ^https?:\/\/ ]] || image="$global_url/$image" # Check that URL is absolute
                         ^-- SC1001: This \/ will be a regular '/' in this context.
                           ^-- SC1001: This \/ will be a regular '/' in this context.

In bb.sh line 365:
            echo '<script type="text/javascript">$.ajax({type: "GET", url: "https://cdn.api.twitter.com/1/urls/count.json?url='$1'",
                                                                                                                               ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                                 ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.

In bb.sh line 390:
    name="`clean_filename $1`"
          ^-- SC2006: Use $(..) instead of legacy `..`.
                          ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 407:
    echo $name
         ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 431:
    echo "<title>$title</title>" >> "$filename"
    ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 438:
    echo '<div id="divbodyholder">' >> "$filename"
    ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 446:
    file_url="`clean_filename $filename`"
              ^-- SC2006: Use $(..) instead of legacy `..`.
                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 450:
        echo '<!-- entry begin -->' >> "$filename" # marks the beginning of the whole post
        ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 451:
        echo '<h3><a class="ablack" href="'$file_url'">' >> "$filename"
                                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 453:
        echo "$(echo "$title" | sed 's/<\/*p>//g')" >> "$filename"
             ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

In bb.sh line 456:
            echo '<div class="subtitle">'$(LC_ALL=$date_locale date +"$date_format")' &mdash; ' >> "$filename"
                                         ^-- SC2046: Quote this to prevent word splitting.

In bb.sh line 458:
            echo '<div class="subtitle">'$(LC_ALL=$date_locale date +"$date_format" --date="$timestamp") ' &mdash; ' >> "$filename"
                                         ^-- SC2046: Quote this to prevent word splitting.

In bb.sh line 465:
        echo -e '\n<!-- text end -->' >> "$filename"
        ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 478:
    cat .footer.html >> "$filename"
    ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 505:
                    filename="$(echo $title | eval $convert_filename)"
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 607:
            [[ "$convert_filename" ]] && title="$(echo $title | eval $convert_filename)"
                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                     ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 631:
        relevant_posts="$(posts_with_tags $relevant_tags) $filename"
                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 646:
    for i in $(ls -t *.html); do
             ^-- SC2045: Iterating over ls output is fragile. Use globs.
                     ^-- SC2035: Use ./*.html so names with dashes won't become options.

In bb.sh line 659:
        echo -n '<li><a href="'$i'">'$title'</a> &mdash;' >> "$contentfile"
                               ^-- SC2086: Double quote to prevent globbing and word splitting.
                                     ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 666:
    echo '<div id="all_posts"><a href="'./'">'$template_archive_index_page'</a></div>' >> "$contentfile"
                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 686:
        nposts="$(grep -c "<\!-- text begin -->" $i)"
                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 687:
        tagname="$(echo $i | cut -c $((${#prefix_tags}+3))- | sed 's/\.html//g')"
                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 688:
        i="`clean_filename $i`"
           ^-- SC2006: Use $(..) instead of legacy `..`.
                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 693:
    echo '<div id="all_posts"><a href="'./'">'$template_archive_index_page'</a></div>' >> "$contentfile"
                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 713:
    for i in $(ls -t ./*.html); do # sort by date, newest first
             ^-- SC2045: Iterating over ls output is fragile. Use globs.

In bb.sh line 717:
            get_html_file_content 'entry' 'entry' 'cut' <$i | awk '/'"$cut_line"'/ { print "<p class=\"readmore\"><a href=\"'$i'\">'"$template_read_more"'</a></p>" ; next } 1' >> "$contentfile"
                                                         ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                             ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 719:
            get_html_file_content 'entry' 'entry' <$i >> "$contentfile"
                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 722:
        n=$(( $n + 1 ))
              ^-- SC2004: $/${} is unnecessary on arithmetic variables.

In bb.sh line 727:
    echo '<div id="all_posts"><a href="'$archive_index'">'$template_archive'</a> &mdash; <a href="'$tags_index'">'$template_tags_title'</a> &mdash; <a href="'$feed'">'$template_subscribe'</a></div>' >> "$contentfile"
                                                          ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 741:
    sed -n "/^<p>$template_tags_line_header/{s/^<p>$template_tags_line_header//;s/<[^>]*>//g;s/[ ,]\+/ /g;p;}" $1 | tr ', ' ' '
                                                                                                               ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 749:
    tag_files="$(for i in $@; do echo -n $prefix_tags""$i.html" "; done)"
                          ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.
                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 750:
    sed -n '/^<h3><a class="ablack" href="[^"]*">/{s/.*href="\([^"]*\)">.*/\1/;p;}' $tag_files 2> /dev/null
                                                                                    ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 770:
        files="$(ls -t $files)"
                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 779:
            rm ./$prefix_tags$i.html &> /dev/null
                             ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 789:
            get_html_file_content 'entry' 'entry' 'cut' <$i | awk '/'"$cut_line"'/ { print "<p class=\"readmore\"><a href=\"'$i'\">'"$template_read_more"'</a></p>" ; next } 1' >> "$tmpfile"
                                                         ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                             ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 791:
            get_html_file_content 'entry' 'entry' <$i >> "$tmpfile"
                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 793:
        for tag in $(tags_in_post $i); do
                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 802:
        tagname="$(echo $i | cut -c $((${#prefix_tags}+3))- | sed 's/\.tmp\.html//g')"
                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 818:
    ls *.html &> /dev/null
       ^-- SC2035: Use ./*.html so names with dashes won't become options.

In bb.sh line 823:
    for i in $(ls -t ./*.html); do
             ^-- SC2045: Iterating over ls output is fragile. Use globs.

In bb.sh line 825:
        line="$n # $(get_post_title "$i") # $(LC_ALL=$date_locale date -r $i +"$date_format")"
                                                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 827:
        n=$(( $n + 1 ))
              ^-- SC2004: $/${} is unnecessary on arithmetic variables.

In bb.sh line 840:
    echo '<?xml version="1.0" encoding="UTF-8" ?>' >> "$rssfile"
    ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 842:
    echo '<channel><title>'$global_title'</title><link>'$global_url'</link>' >> "$rssfile"
                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 843:
    echo '<description>'$global_description'</description><language>en</language>' >> "$rssfile"
                        ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 844:
    echo '<lastBuildDate>'$(LC_ALL=C date +"%a, %d %b %Y %H:%M:%S %z")'</lastBuildDate>' >> "$rssfile"
                          ^-- SC2046: Quote this to prevent word splitting.

In bb.sh line 845:
    echo '<pubDate>'$(LC_ALL=C date +"%a, %d %b %Y %H:%M:%S %z")'</pubDate>' >> "$rssfile"
                    ^-- SC2046: Quote this to prevent word splitting.

In bb.sh line 849:
    for i in $(ls -t ./*.html); do
             ^-- SC2045: Iterating over ls output is fragile. Use globs.

In bb.sh line 853:
        echo '<item><title>' >> "$rssfile"
        ^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

In bb.sh line 854:
        echo "$(get_post_title "$i")" >> "$rssfile"
             ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

In bb.sh line 856:
        echo "$(get_html_file_content 'text' 'entry' $cut_do <$i)" >> "$rssfile"
             ^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
                                                              ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 857:
        echo "]]></description><link>$global_url/$(clean_filename $i)</link>" >> "$rssfile"
                                                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 860:
        echo '<pubDate>'$(LC_ALL=C date -r "$i" +"%a, %d %b %Y %H:%M:%S %z")'</pubDate></item>' >> "$rssfile"
                        ^-- SC2046: Quote this to prevent word splitting.

In bb.sh line 862:
        n=$(( $n + 1 ))
              ^-- SC2004: $/${} is unnecessary on arithmetic variables.

In bb.sh line 874:
    echo '<h1 class="nomargin"><a class="ablack" href="'$global_url'">'$global_title'</a></h1>' > ".title.html"
                                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 875:
    echo '<div id="description">'$global_description'</div>' >> ".title.html"
                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 883:
            echo '<link rel="stylesheet" href="'$css_file'" type="text/css" />' >> ".header.html"
                                                ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 886:
            echo '<link rel="alternate" type="application/rss+xml" title="'$template_subscribe_browser_button'" href="'$blog_feed'" />' >> ".header.html"
                                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 888:
            echo '<link rel="alternate" type="application/rss+xml" title="'$template_subscribe_browser_button'" href="'$global_feedburner'" />' >> ".header.html"
                                                                           ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 895:
        echo '<div id="footer">'$global_license '<a href="'$global_author_url'">'$global_author'</a> &mdash; <a href="mailto:'$protected_mail'">'$protected_mail'</a><br/>' >> ".footer.html"
                                ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                              ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                                                                                                                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 909:
    [ $css_include ] && return || css_include=('main.css' 'blog.css')
      ^-- SC2128: Expanding an array without an index only gives the first element.
      ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 964:
        get_html_file_content 'text' 'text' <$i >> "$contentfile"
                                             ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 967:
        timestamp="$(LC_ALL=C date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"
                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 971:
        timestamp="$(LC_ALL=C date -r $i +'%Y%m%d%H%M')"
                                      ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 974:
        touch -t $timestamp "$i"
                 ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 1006:
        rm .*.html *.html *.css *.rss &> /dev/null
                   ^-- SC2035: Use ./*.html so names with dashes won't become options.
                          ^-- SC2035: Use ./*.css so names with dashes won't become options.
                                ^-- SC2035: Use ./*.rss so names with dashes won't become options.

In bb.sh line 1016:
date_version_detect() {
^-- SC2120: date_version_detect references arguments, but none are ever passed.

In bb.sh line 1029:
                    format=$(echo $3 | sed 's/\+//g')
                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 1031:
                elif [[ $(echo $@ | grep '\-\-date') ]]; then
                        ^-- SC2143: Use grep -q instead of comparing output with [ -n .. ].
                               ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.

In bb.sh line 1033:
                    command date -j -f "%a, %d %b %Y %H:%M:%S %z" "$(echo $2 | sed 's/\-\-date\=//g')" "$1" 
                                                                          ^-- SC2086: Double quote to prevent globbing and word splitting.

In bb.sh line 1050:
    date_version_detect
    ^-- SC2119: Use date_version_detect "$@" if function's $1 should mean script's $1.

In bb.sh line 1075:
    ls *.html &> /dev/null
       ^-- SC2035: Use ./*.html so names with dashes won't become options.

In bb.sh line 1080:
    ls *.html &> /dev/null
       ^-- SC2035: Use ./*.html so names with dashes won't become options.

In bb.sh line 1082:
        tar cfz ".backup.tar.gz" *.html &&
                                 ^-- SC2035: Use ./*.html so names with dashes won't become options.

In bb.sh line 1118:
do_main $*
        ^-- SC2048: Use "$@" (with quotes) to prevent whitespace problems.
        ^-- SC2086: Double quote to prevent globbing and word splitting.

Disqus

Maybe implement Disqus as an alternative commenting system.

Changing date_locale to non-English breaks edit()

I edited this blog post (it's in Finnish), and I got an error message from date:

$ ./bb.sh edit ilmajuurrutuksen-opettelua-osa-i.md 
date: invalid date ‘la, 07 kesä 2014 17:51:27 +0300’
Posted ilmajuurrutuksen-opettelua-osa-i.html
Rebuilding the index ..
Creating an index page with all the posts ..
Rebuilding tag pages ..
Creating an index page with all the tags ........
Making RSS ..

These are the relevant parts in my .config:

# The locale to use for the dates displayed on screen (not for the timestamps)
#date_format="%B %d, %Y"
date_format="%-d. %Bta %Y"
date_locale="fi_FI.UTF-8"

The problem is probably that Bashblog allows me to set a date locale, but if I actually set it to something other than English, it breaks when editing. I think it's because it tries to get a timestamp with date -r file +"%a, %d %b %Y %H:%M:%S %z", which in an English locale produces a string that date can understand as an input to the --date= switch, but certainly not in Finnish.

I get correct timestamps on my initial posts, but missing timestamps (because of failed calls to date --date=...) on posts that I've edited.

edit: Dates are correct on the linked posts now.

iconv translit issue on netbsd

GNU iconv supports "ASCII//TRANSLIT", but not all other iconv implementations do. In particular, NetBSD's one doesn't.
I just removed "//translit" to fix the problem.

better defaults

I suggest changing some defaults:

  • if Markdown is installed, bb.sh post should use Markdown format by default. Because, well, if I installed Markdown, then, probably, I'm going to use it, right? In rare cases when I don't, I still would be able to use bb.sh post -html to post in HTML.
  • Asking if user wants to preview the post is not necessary, IMO: from technical point of view, it just chmods your file and prints a line. I believe it's safe to remove this question and always behave like if user asked y on this question.

I'd like to know what @cfenollosa thinks about it, but others are also welcome to state their opinions :-)

Allow categorization by tags

Alexey suggested:

* "tags" or some other way to organize the posts into groups. For example, 
if I write both in Russian and English, or if I post both about music and programming - probably 
readers would like to have an option to see posts on some topic only. Not sure how to implement
it, though. Use sub-directories, maybe? For now I decided to have several blogs in different 
directories (site.com/soft/, site.com/dev/, site.com/fun/) with same design, but it would be 
better to have a nicer way.

I'm not sure if this would be better implemented with subdirectories, or plain html files with an optional .htaccess redirection. Let's discuss it here.

$global_config not parsed if Text::Markdown isn't installed

Hi all,

I was facing exactly the same issue described in the ticket #74 - in fact came here to report it. I installed the Text::Markdown plugin, did a rebuild and now everything seems to be back on track.
My .config file is as follows:

    # Blog title
    global_title="error 404"
    # The typical subtitle for each blog
    global_description="Not really - Welcome to my corner on the interwebs"
    # The public base URL for this blog
    global_url="http://i90rr.github.io"

    # Your name
    global_author="Martín Cigorraga"
    # You can use twitter or facebook or anything for global_author_url
    global_author_url="http://twitter.com/_i90rr" 
    # Your email
    global_email="gmail: i90rr.i90rr"

    # CC by-nc-nd is a good starting point, you can change this to "&copy;" for Copyright
    global_license="CC by-sa / AGPL v3+"

    # If you have a Google Analytics ID (UA-XXXXX) and wish to use the standard
    # embedding code, put it on global_analytics
    # If you have custom analytics code (i.e. non-google) or want to use the Universal
    # code, leave global_analytics empty and specify a global_analytics_file
    global_analytics=""
    global_analytics_file=""

    # Leave this empty (i.e. "") if you don't want to use feedburner, 
    # or change it to your own URL
    global_feedburner=""

    # Change this to your username if you want to use twitter for comments
    global_twitter_username="_i90rr"
    # 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
    global_twitter_search="twitter"

    # Change this to your disqus username to use disqus for comments
    global_disqus_username="i90rr"

'Back to the index page' not working when $index_file != index.html

My .config file:

    # Blog title
    global_title="V for VERBOSE"
    # The typical subtitle for each blog
    global_description="deal with that R."
    # The public base URL for this blog
    global_url="http://i90rr.github.io/index2.html"

    # Your name
    global_author="i90rr"
    # You can use twitter or facebook or anything for global_author_url
    global_author_url="http://www.github.com/i90rr" 
    # Your email
    global_email="gmail inbox: i90rr.i90rr"

    # CC by-nc-nd is a good starting point, you can change this to "&copy;" for Copyright
    global_license="CC by-sa / AGPL v3+"

    # If you have a Google Analytics ID (UA-XXXXX) and wish to use the standard
    # embedding code, put it on global_analytics
    # If you have custom analytics code (i.e. non-google) or want to use the Universal
    # code, leave global_analytics empty and specify a global_analytics_file
    global_analytics="UA-72527112-1"
    global_analytics_file=""

    # Leave this empty (i.e. "") if you don't want to use feedburner, 
    # or change it to your own URL
    global_feedburner=""

    # Change this to your username if you want to use twitter for comments
    global_twitter_username="_i90rr"
    # 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
    global_twitter_search="twitter"

    # Change this to your disqus username to use disqus for comments
    global_disqus_username="i90rr"


    # Blog generated files
    # index page of blog (it is usually good to use "index.html" here)
    index_file="index2.html"
    number_of_index_articles="4"
    # global archive
    archive_index="all_posts.html"
    tags_index="all_tags.html"
    # feed file (rss in this case)
    blog_feed="feed.rss"
    number_of_feed_articles="10"
    # "cut" blog entry when putting it to index page. Leave blank for full articles in front page
    # i.e. include only up to first '<hr>', or '----' in markdown
    cut_do="cut"
    # When cutting, cut also tags? If "no", tags will appear in index page for cut articles
    cut_tags="yes"
    # Regexp matching the HTML line where to do the cut
    # note that slash is regexp separator so you need to prepend it with backslash
    cut_line='<hr ?\/?>'
    # save markdown file when posting with "bb post -m". Leave blank to discard it.
    save_markdown="yes"
    # prefix for tags/categories files
    # please make sure that no other html file starts with this prefix
    prefix_tags="tag_"
    # personalized header and footer (only if you know what you're doing)
    # DO NOT name them .header.html, .footer.html or they will be overwritten
    # leave blank to generate them, recommended
    header_file=""
    footer_file=""
    # extra content to add just after we open the <body> tag
    # and before the actual blog content
    body_begin_file=""
    # CSS files to include on every page, f.ex. css_include=('main.css' 'blog.css')
    # leave empty to use generated
    css_include=()
    # HTML files to exclude from index, f.ex. post_exclude=('imprint.html 'aboutme.html')
    html_exclude=()

    # Localization and i18n
    # "Comments?" (used in twitter link after every post)
    template_comments="Comments?"
    # "Read more..." (link under cut article on index page)
    template_read_more="Read more..."
    # "View more posts" (used on bottom of index page as link to archive)
    template_archive="View more posts"
    # "All posts" (title of archive page)
    template_archive_title="All posts"
    # "All tags"
    template_tags_title="All tags"
    # "posts" (on "All tags" page, text at the end of each tag line, like "2. Music - 15 posts")
    template_tags_posts="posts"
    template_tags_posts_singular="post"
    # "Posts tagged" (text on a title of a page with index of one tag, like "My Blog - Posts tagged "Music"")
    template_tag_title="Posts tagged"
    # "Tags:" (beginning of line in HTML file with list of all tags for this article)
    template_tags_line_header="Tags:"
    # "Back to the index page" (used on archive page, it is link to blog index)
    template_archive_index_page="Back to the index page"
    # "Subscribe" (used on bottom of index page, it is link to RSS feed)
    template_subscribe="Subscribe"
    # "Subscribe to this page..." (used as text for browser feed button that is embedded to html)
    template_subscribe_browser_button="Subscribe to this page..."
    # "Tweet" (used as twitter text button for posting to twitter)
    template_twitter_button="Tweet"
    template_twitter_comment="&lt;Type your comment here but please leave the URL so that other people can follow the comments&gt;"

    # The locale to use for the dates displayed on screen (not for the timestamps)
    date_format="%B %d, %Y"
    date_allposts_header="%B %Y"
    date_locale="C"

    # Perform the post title -> filename conversion
    # Experts only. You may need to tune the locales too
    # Leave empty for no conversion, which is not recommended
    # This default filter respects backwards compatibility
    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.
    # The invocation must support the signature 'markdown_bin in.md > out.html'
    markdown_bin=$(which Markdown.pl || which markdown)
}

Cheers!

Escape special characters

Given this input:

   <script>alert(33)</script>Title on this line

   <p>The rest of the text file is an <b>html</b> blog post. The process will continue as soon as you exit your editor.</p>

The generated index (+ blog entry itself) execute javascript. I guess that similar issues would arise if you put & or ? in the title too.

You should escape special characters to avoid XSS/issues.

Can 1179 lines of code be reduced?

bashblog has started to my knowledge with 500 lines, it has 1179 as of now.
Yes, each nice feature has its legitimacy. But in the end the pile of such features unfolds a complexity which veils the essentials of bashblog that really matter. I.e the lever of the tool once had goes down.
That is a common problem of any tool out there.

Why not introduce a feature of bashblog to not exceed 800 (or so) lines of code?
Simplicity and more brain power per line.
For a growth in quality.

Open post in a new window in your editor

Since we need to quit the text editor for the compiling process to continue, I think we should take into account opening a new post file in a separate window.

For those times when you have a lot of other text files open and the blank post opens as a new tab in your editor, I would have to close them all to continue.

I use gedit and the command-line option to accomplish this is simply --new-window, so where would I place this?

Non blog post pages

Which is the proper way to build content that is not a blog post with bashblog?
(I would call'em static pages although this doesn't make any sense when everything is static :) )

makrup language support

i forked the project here here and added markup language supports for like markdown. the advantage is the raw content will be kept in a sourcefile which makes the rebuild of the resources more clean and reliable.

the edit process will be much easier since it only need editing the raw content [markdown resource] and rebuilding the resources.

i don't know when will i have time to merge the code into bashblog (since i did so many changes, it need changes and some cleaning) but it can be easily achieved. more changes are listed here

Tags disappearing on rebuild/edit

Tags disappear when running ./bb.sh rebuild. Also, when editing any post (not the full html file, just the post content), there are no tags.

To reproduce the issue:

  1. Create a new post (with the title "My New Post", for example) with tags in them.
  2. Publish the post.
  3. Either type "./bb.sh edit my-new-post.html" to edit the post, or "./bb.sh rebuild" to rebuild the entire blog.

You'll see that there are no tags any more.

Template the Twitter Comment

I think the Twitter Comment

Type your comment here but please leave the URL so that other people can follow the comments

should be edited by another Template Variable

Custom head.html - how to set $title?

Perhaps I'm just stupid or have a blackout... I inserted my own header & footer-file in the .config-File (simple HTML), which works perfect.

But how to set the
< head >
< title > XYZ< /title >
< /head >
inside the custom header-file, so that it shows the site/page/article- and blog-name?

Thx for any help - and also the script, I love it! :)

starting new blog doesn't work

I'm trying to start a new blog but i only got this error messages

$ ../bashblog/bb.sh post new
date: .yesterday.tar.gz: No such file or directory
The file doesn't exist

"blog.css" and "main.css" are generated but nothing else.

Any interest in a better editing function?

Specifically making it easier to choose which post you'd like to edit.

My solution was that when you chose the edit option, a list of all the available posts would be listed, and you could choose one by the corresponding #number beside each listing.

Rather than having to type out the entire filename which is tedious.

Improve readability of the "all posts" page

To improve site navigation, it would be nice to have the "all posts" page broken down into smaller sections. Suggested ways to do this:

  • Insert a subheader for each year, maybe even each month.
  • Link to separate subpages: make links like <li><a href="$archive_index_2014-06.html">June 2014</a></li>, and then listing all posts created in that month on that page.

My concern is that if you post fairly frequently for a number of years, the $archive_index page is going to grow and eventually become quite cumbersome to navigate. Subdividing it in some way would be a welcome feature in my opinion.

Problem with date in make_rss()

I had to add "LC_ALL=C" in the function make_rss() in the lines that contain lastBuildDate and pubDate beacause it generates a wrong date in rss file.
I think the problem is about my server's locale. This is the output of the command "locale" in my server:

[ezq@zapp bashblog]$ locale
LANG=es_AR.UTF-8
LC_CTYPE="es_AR.UTF-8"
LC_NUMERIC="es_AR.UTF-8"
LC_TIME="es_AR.UTF-8"
LC_COLLATE="es_AR.UTF-8"
LC_MONETARY="es_AR.UTF-8"
LC_MESSAGES="es_AR.UTF-8"
LC_PAPER="es_AR.UTF-8"
LC_NAME="es_AR.UTF-8"
LC_ADDRESS="es_AR.UTF-8"
LC_TELEPHONE="es_AR.UTF-8"
LC_MEASUREMENT="es_AR.UTF-8"
LC_IDENTIFICATION="es_AR.UTF-8"
LC_ALL=

"View more posts"

The

View more posts
at Line 406 should be replaced by
'$template_archive'

For each edit bashblog appends a </p> to the html file

Each time I run ./bb.sh edit title-on-this-line.html, it appends another </p>.

Title an this line

<p>The rest of the text file is an <b>html</b> blog post. The process will continue as soon
as you exit your editor.</p>

<p>Tags: <a href='tag_keep-this-tag-format.html'>keep-this-tag-format</a>, <a href='tag_tags-are-optional.html'>tags-are-optional</a>, <a href='tag_example.html'>example</a>
</p>
</p>
</p>

`clean_filename` not being run on `tag_` pages?

I have somehow ended up with a file called tag_lempipuut-helsingissä.html. It still works fine, but I was under the impression that all filenames are supposed to go through clean_filename to make them all ASCII.

I tried to look through the code and find the problem myself, but I was unable to pinpoint it right now. Will try again at a better time.

the 'rebuild' command is broken

$ ./bb.sh rebuild
Rebuilding all entries .date: invalid date `mi\303\251 oct 26 16:05:00 CEST 2011'
.date: invalid date `mar sep 20 19:46:00 CEST 2011'
.date: invalid date `mi\303\251 mar 21 15:30:00 CET 2012'
..date: invalid date `jue nov 10 17:29:00 CET 2011'
.date: invalid date `jue sep 22 11:10:00 CEST 2011'
.date: invalid date `vie sep 23 19:18:00 CEST 2011'

Problems with .config

I ran into a Problem. I use bb.sh on a System where there is no Markdown.pl
If i create a .config file, ran bb.sh post than it wont work.
I had to ran bb.sh post -html to get it to work. This is not the case without .config file.

Test for markdown support when posting a draft

Called via bb.sh post file.md, we don't respect test_markdown results: if there's no markdown installed, there should be some error.

I believe that this line:

    [[ "$extension" == "md" || "$extension" == "html" ]] && fmt="$extension"

is guilty for the mentioned bug, but I don't have a "very nice" solution to fix it.

Perfectly the whole beginning of write_entry() function should be reworked by someone who likes reducing boolean expressions.

fail to set date when finishing to edit a post

On NetBSD with ksh after editing a post and closing nano (or your editor) here is the output :
date: unknown option -- f
Usage: date [-ajnu] [-d date] [-r seconds] [+format] [[[[[[CC]yy]mm]dd]HH]MM[.SS]]
Posted 158.html
Rebuilding tag pages .
Rebuilding the index ....
Creating an index page with all the posts ....
Creating an index page with all the tags ...
Making RSS ....

Tags not displayed on posts with a cut on index page

If a post contains a cut point, i.e. ---- in Markdown, Bashblog will not output the post's tags on the index and tag_* pages. Expected behaviour is to print the tags below the "Read more..." link, correct?

I assume this is because get_html_file_content() throws away all information in posts past the cut, including the tags.

I can't read awk very well, but I think what it's doing is:

  • check if we are configured to support cuts
  • if yes, check if there is a line that matches the cut marker
  • if yes, stop reading at that line

Instead we should continue reading but skip lines until we find the tags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.