diff --git a/bb.sh b/bb.sh index 5b612dd..304b17f 100755 --- a/bb.sh +++ b/bb.sh @@ -16,172 +16,172 @@ global_config=".config" # This function will load all the variables defined here. They might be overridden # by the 'global_config' file contents global_variables() { - global_software_name="bashblog" - global_software_version="2.8" + global_software_name="bashblog" + global_software_version="2.8" - # Blog title - global_title="my tildelog" - # The typical subtitle for each blog - global_description="a blog about tildes" - # The public base URL for this blog - global_url="https://tilde.team/~$USER/blog" + # Blog title + global_title="my tildelog" + # The typical subtitle for each blog + global_description="a blog about tildes" + # The public base URL for this blog + global_url="https://tilde.team/~$USER/blog" - # Your name - global_author="~$USER" - # You can use twitter or facebook or anything for global_author_url - global_author_url="https://tilde.team/~$USER/" - # Your email - global_email="$USER@tilde.team" + # Your name + global_author="~$USER" + # You can use twitter or facebook or anything for global_author_url + global_author_url="https://tilde.team/~$USER/" + # Your email + global_email="$USER@tilde.team" - # CC by-nc-nd is a good starting point, you can change this to "©" for Copyright - global_license="CC by-nc-nd" + # CC by-nc-nd is a good starting point, you can change this to "©" for Copyright + global_license="CC by-nc-nd" - # Leave this empty (i.e. "") if you don't want to use feedburner, - # or change it to your own URL - global_feedburner="" + # 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="" - # Set this to false for a Twitter button with share count. The cookieless version - # is just a link. - global_twitter_cookieless="true" + # Change this to your username if you want to use twitter for comments + global_twitter_username="" + # Set this to false for a Twitter button with share count. The cookieless version + # is just a link. + global_twitter_cookieless="true" - # Blog generated files - # index page of blog (it is usually good to use "index.html" here) - index_file="index.html" - number_of_index_articles="10" - # global archive - archive_index="all_posts.html" - tags_index="all_tags.html" + # Blog generated files + # index page of blog (it is usually good to use "index.html" here) + index_file="index.html" + number_of_index_articles="10" + # global archive + archive_index="all_posts.html" + tags_index="all_tags.html" - # ignore gophermap file - gophermap="gophermap" + # ignore gophermap file + gophermap="gophermap" - # ignore gemini generation script and gemini index - gemini_index="index.gmi" + # ignore gemini generation script and gemini index + gemini_index="index.gmi" - # Non blogpost files. Bashblog will ignore these. Useful for static pages and custom content - # Add them as a bash array, e.g. non_blogpost_files=("news.html" "test.html") - non_blogpost_files=() + # Non blogpost files. Bashblog will ignore these. Useful for static pages and custom content + # Add them as a bash array, e.g. non_blogpost_files=("news.html" "test.html") + non_blogpost_files=() - # feed file (rss in this case) - blog_feed="feed.rss" - number_of_feed_articles="50" - # "cut" blog entry when putting it to index page. Leave blank for full articles in front page - # i.e. include only up to first '
line 1
\n\nline 2
' - local c2=$'line 1
\nline 2
' - # shellcheck disable=SC2235 # must enforce order of operations - [[ -n $markdown_bin ]] && ( [[ "$m1" == "$c1" ]] || [[ "$m2" == "$c2" ]] ) + local m1; m1=$("$markdown_bin" <<< $'line 1\n\nline 2') + local m2; m2=$("$markdown_bin" <<< $'line 1\n\nline 2') + local c1=$'line 1
\n\nline 2
' + local c2=$'line 1
\nline 2
' + # shellcheck disable=SC2235 # must enforce order of operations + [[ -n $markdown_bin ]] && ( [[ "$m1" == "$c1" ]] || [[ "$m2" == "$c2" ]] ) } # Parse a Markdown file into HTML and return the generated file markdown() { - out=${1%.md}.html - while [[ -f $out ]]; do out=${out%.html}.$RANDOM.html; done - $markdown_bin "$1" > "$out" - echo "$out" + out=${1%.md}.html + while [[ -f $out ]]; do out=${out%.html}.$RANDOM.html; done + $markdown_bin "$1" > "$out" + echo "$out" } # Reads HTML file from stdin, prints its content to stdout @@ -191,15 +191,15 @@ markdown() { # note that this does not remove$template_tags_line_header/ ) print - } - } - }" + awk "//, //{ + if (!// && !//) print + if (\"$3\" == \"cut\" && /$cut_line/){ + if (\"$2\" == \"text\") exit # no need to read further + while (getline > 0 && !//) { + if (\"$cut_tags\" == \"no\" && /^
$template_tags_line_header/ ) print
+ }
+ }
+ }"
}
# Edit an existing, published .html file while keeping its original timestamp
@@ -215,55 +215,56 @@ get_html_file_content() {
# "full" to edit full HTML, and not only text part (keeps old filename)
# leave empty for default behavior (edit only text part and change name)
edit() {
- [[ ! -f "${1%%.*}.html" ]] && \
+ [[ ! -f "${1%%.*}.html" ]] && \
printf "Can't edit post \"%s.html\", did you mean to use \"bb.sh post $template_tags_line_header/s|\\1|\\1|g" >> "$TMPFILE"
- $EDITOR "$TMPFILE"
- filename=$1
- fi
- rm "$filename"
- if [[ $2 == keep ]]; then
- parse_file "$TMPFILE" "$edit_timestamp" "$filename"
- else
- parse_file "$TMPFILE" "$edit_timestamp" # this command sets $filename as the html processed file
- [[ ${1##*.} == md ]] && mv "$1" "${filename%%.*}.md" 2>/dev/null
- fi
- rm "$TMPFILE"
- fi
- touch -t "$touch_timestamp" "$filename"
- touch -t "$touch_timestamp" "$1"
- chmod 644 "$filename"
- echo "Posted $filename"
- tags_after=$(tags_in_post "$filename")
- relevant_tags=$(echo "$tags_before $tags_after" | tr ',' ' ' | tr ' ' '\n' | sort -u | tr '\n' ' ')
- if [[ -n $relevant_tags ]]; then
+
+ # Original post timestamp
+ edit_timestamp=$(LC_ALL=C date -r "${1%%.*}.html" +"$date_format_full" )
+ touch_timestamp=$(LC_ALL=C date -r "${1%%.*}.html" +"$date_format_timestamp")
+ tags_before=$(tags_in_post "${1%%.*}.html")
+ if [[ $2 == full ]]; then
+ $EDITOR "$1"
+ filename=$1
+ else
+ if [[ ${1##*.} == md ]]; then
+ if test_markdown; then
+ echo "Markdown is not working, please edit HTML file directly."
+ exit
+ fi
+ # editing markdown file
+ $EDITOR "$1"
+ TMPFILE=$(markdown "$1")
+ filename=${1%%.*}.html
+ else
+ # Create the content file
+ TMPFILE=$(basename "$1").$RANDOM.html
+ # Title
+ get_post_title "$1" > "$TMPFILE"
+ # Post text with plaintext tags
+ get_html_file_content 'text' 'text' <"$1" | sed "/^ $template_tags_line_header/s|\\1|\\1|g" >> "$TMPFILE"
+ $EDITOR "$TMPFILE"
+ filename=$1
+ fi
+ rm "$filename"
+ if [[ $2 == keep ]]; then
+ parse_file "$TMPFILE" "$edit_timestamp" "$filename"
+ else
+ parse_file "$TMPFILE" "$edit_timestamp" # this command sets $filename as the html processed file
+ [[ ${1##*.} == md ]] && mv "$1" "${filename%%.*}.md" 2>/dev/null
+ fi
+ rm "$TMPFILE"
+ fi
+ touch -t "$touch_timestamp" "$filename"
+ touch -t "$touch_timestamp" "$1"
+ chmod 644 "$filename"
+ echo "Posted $filename"
+ tags_after=$(tags_in_post "$filename")
+ relevant_tags=$(echo "$tags_before $tags_after" | tr ',' ' ' | tr ' ' '\n' | sort -u | tr '\n' ' ')
+ if [[ -n $relevant_tags ]]; then
# shellcheck disable=SC2086 # Intended splitting of $relevant_tags
- relevant_posts="$(posts_with_tags $relevant_tags) $filename"
- rebuild_tags "$relevant_posts" "$relevant_tags"
- fi
+ relevant_posts="$(posts_with_tags $relevant_tags) $filename"
+ rebuild_tags "$relevant_posts" "$relevant_tags"
+ fi
}
# Create a Twitter summary (twitter "card") for the post
@@ -271,41 +272,41 @@ edit() {
# $1 the post file
# $2 the title
twitter_card() {
- [[ -z $global_twitter_username ]] && return
-
- echo ""
- echo ""
- echo "" # Twitter truncates at 70 char
- description=$(grep -v "^ $template_tags_line_header" "$1" | sed -e 's/<[^>]*>//g' | head -c 250 | tr '\n' ' ' | sed "s/\"/'/g")
- echo ""
- image=$(sed -n 's/.* $template_tags_line_header" "$1" | sed -e 's/<[^>]*>//g' | head -c 250 | tr '\n' ' ' | sed "s/\"/'/g")
+ echo ""
+ image=$(sed -n 's/.* $template_comments $template_twitter_button "
- echo " $template_comments ";
- fi
+ echo " $template_comments $template_twitter_button "
+ echo " $template_comments ";
+ fi
- echo "$template_twitter_button "
- echo " 's on the title because of markdown conversion
- title=${title// /}
- title=${title//<\/p>/}
- echo "$title"
- echo ' 's on the title because of markdown conversion
+ title=${title// /}
+ title=${title//<\/p>/}
+ echo "$title"
+ echo ' and and $template_tags_line_header"* ]]; then
+ tags=$(echo "$line" | cut -d ":" -f 2- | sed -e 's/<\/p>//g' -e 's/^ *//' -e 's/ *$//' -e 's/, /,/g')
+ IFS=, read -r -a array <<< "$tags"
- # Check for duplicate file names
- while [[ -f $filename ]]; do
- filename=${filename%.html}$RANDOM.html
- done
- fi
- content=$filename.tmp
- # Parse possible tags
- elif [[ $line == " $template_tags_line_header"* ]]; then
- tags=$(echo "$line" | cut -d ":" -f 2- | sed -e 's/<\/p>//g' -e 's/^ *//' -e 's/ *$//' -e 's/, /,/g')
- IFS=, read -r -a array <<< "$tags"
+ echo -n " $template_tags_line_header " >> "$content"
+ for item in "${array[@]}"; do
+ echo -n "$item, "
+ done | sed 's/, $/<\/p>/g' >> "$content"
+ else
+ echo "$line" >> "$content"
+ fi
+ done < "$1"
- echo -n " $template_tags_line_header " >> "$content"
- for item in "${array[@]}"; do
- echo -n "$item, "
- done | sed 's/, $/<\/p>/g' >> "$content"
- else
- echo "$line" >> "$content"
- fi
- done < "$1"
-
- # Create the actual html page
- create_html_page "$content" "$filename" no "$title" "$2" "$global_author"
- rm "$content"
+ # Create the actual html page
+ create_html_page "$content" "$filename" no "$title" "$2" "$global_author"
+ rm "$content"
}
# Manages the creation of the text file and the parsing to html file
# also the drafts
write_entry() {
- test_markdown && fmt=md || fmt=html
- f=$2
- [[ $2 == -html ]] && fmt=html && f=$3
+ test_markdown && fmt=md || fmt=html
+ f=$2
+ [[ $2 == -html ]] && fmt=html && f=$3
- if [[ -n $f ]]; then
- TMPFILE=$f
- if [[ ! -f $TMPFILE ]]; then
- echo "The file doesn't exist"
- delete_includes
- exit
- fi
- # guess format from TMPFILE
- extension=${TMPFILE##*.}
- [[ $extension == md || $extension == html ]] && fmt=$extension
- # but let user override it (`bb.sh post -html file.md`)
- [[ $2 == -html ]] && fmt=html
- # Test if Markdown is working before re-posting a .md file
- if [[ $extension == md ]]; then
- if test_markdown; then
- echo "Markdown is not working, please edit HTML file directly."
- exit
- fi
- fi
- else
- TMPFILE=.entry-$RANDOM.$fmt
- echo -e "Title on this line\n" >> "$TMPFILE"
+ if [[ -n $f ]]; then
+ TMPFILE=$f
+ if [[ ! -f $TMPFILE ]]; then
+ echo "The file doesn't exist"
+ delete_includes
+ exit
+ fi
+ # guess format from TMPFILE
+ extension=${TMPFILE##*.}
+ [[ $extension == md || $extension == html ]] && fmt=$extension
+ # but let user override it (`bb.sh post -html file.md`)
+ [[ $2 == -html ]] && fmt=html
+ # Test if Markdown is working before re-posting a .md file
+ if [[ $extension == md ]]; then
+ if test_markdown; then
+ echo "Markdown is not working, please edit HTML file directly."
+ exit
+ fi
+ fi
+ else
+ TMPFILE=.entry-$RANDOM.$fmt
+ echo -e "Title on this line\n" >> "$TMPFILE"
- [[ $fmt == html ]] && cat << EOF >> "$TMPFILE"
+ [[ $fmt == html ]] && cat << EOF >> "$TMPFILE"
The rest of the text file is an html blog post. The process will continue as soon
as you exit your editor. $template_tags_line_header keep-this-tag-format, tags-are-optional, example $template_tags_line_header/{s/^ $template_tags_line_header//;s/<[^>]*>//g;s/[ ,]\+/ /g;p;}" "$1" | tr ', ' ' '
+ sed -n "/^ $template_tags_line_header/{s/^ $template_tags_line_header//;s/<[^>]*>//g;s/[ ,]\+/ /g;p;}" "$1" | tr ', ' ' '
}
# Finds all posts referenced in a number of tags.
# Arguments are tags
# Prints one line with space-separated tags to stdout
posts_with_tags() {
- (($# < 1)) && return
- set -- "${@/#/$prefix_tags}"
- set -- "${@/%/.html}"
- sed -n '/^"
- # remove possible
'
- if [[ -z $timestamp ]]; then
- echo ""
- else
- echo ""
- fi
- if [[ -z $timestamp ]]; then
- echo -n ""
+ # remove possible
'
+ if [[ -z $timestamp ]]; then
+ echo ""
+ else
+ echo ""
+ fi
+ if [[ -z $timestamp ]]; then
+ echo -n "$template_archive_title
"
- prev_month=""
- while IFS='' read -r i; do
- is_boilerplate_file "$i" && continue
- echo -n "." 1>&3
- # Month headers
- month=$(LC_ALL=$date_locale date -r "$i" +"$date_allposts_header")
- if [[ $month != "$prev_month" ]]; then
- [[ -n $prev_month ]] && echo "" # Don't close ul before first header
- echo "$month
"
- echo ""
- prev_month=$month
- fi
- # Title
- title=$(get_post_title "$i")
- echo -n "
"
- echo ""
- } 3>&1 >"$contentfile"
+ {
+ echo "$template_archive_title
"
+ prev_month=""
+ while IFS='' read -r i; do
+ is_boilerplate_file "$i" && continue
+ echo -n "." 1>&3
+ # Month headers
+ month=$(LC_ALL=$date_locale date -r "$i" +"$date_allposts_header")
+ if [[ $month != "$prev_month" ]]; then
+ [[ -n $prev_month ]] && echo "" # Don't close ul before first header
+ echo "$month
"
+ echo ""
+ prev_month=$month
+ fi
+ # Title
+ title=$(get_post_title "$i")
+ echo -n "
"
+ echo ""
+ } 3>&1 >"$contentfile"
- 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"
+ 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"
}
# Create an index page with all the tags
all_tags() {
- echo -n "Creating an index page with all the tags "
- contentfile=$tags_index.$RANDOM
- while [[ -f $contentfile ]]; do
- contentfile=$tags_index.$RANDOM
- done
+ echo -n "Creating an index page with all the tags "
+ contentfile=$tags_index.$RANDOM
+ while [[ -f $contentfile ]]; do
+ contentfile=$tags_index.$RANDOM
+ done
- {
- echo "$template_tags_title
"
- echo ""
+ {
+ echo "
"
+ echo ""
+ } 3>&1 > "$contentfile"
- 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"
+ 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"
}
# Generate the index.html with the content of the latest posts
rebuild_index() {
- echo -n "Rebuilding the index "
- newindexfile=$index_file.$RANDOM
- contentfile=$newindexfile.content
- while [[ -f $newindexfile ]]; do
- newindexfile=$index_file.$RANDOM
- contentfile=$newindexfile.content
- done
+ echo -n "Rebuilding the index "
+ newindexfile=$index_file.$RANDOM
+ contentfile=$newindexfile.content
+ while [[ -f $newindexfile ]]; do
+ newindexfile=$index_file.$RANDOM
+ contentfile=$newindexfile.content
+ done
- # Create the content file
- {
- n=0
- while IFS='' read -r i; do
- is_boilerplate_file "$i" && continue;
- if ((n >= number_of_index_articles)); then break; fi
- if [[ -n $cut_do ]]; then
- get_html_file_content 'entry' 'entry' 'cut' <"$i" | awk "/$cut_line/ { print \"\" ; next } 1"
- else
- get_html_file_content 'entry' 'entry' <"$i"
- fi
- echo -n "." 1>&3
- n=$(( n + 1 ))
- done < <(ls -t ./*.html) # sort by date, newest first
+ # Create the content file
+ {
+ n=0
+ while IFS='' read -r i; do
+ is_boilerplate_file "$i" && continue;
+ if ((n >= number_of_index_articles)); then break; fi
+ if [[ -n $cut_do ]]; then
+ get_html_file_content 'entry' 'entry' 'cut' <"$i" | awk "/$cut_line/ { print \"\" ; next } 1"
+ else
+ get_html_file_content 'entry' 'entry' <"$i"
+ fi
+ echo -n "." 1>&3
+ n=$(( n + 1 ))
+ done < <(ls -t ./*.html) # sort by date, newest first
- feed=$blog_feed
- if [[ -n $global_feedburner ]]; then feed=$global_feedburner; fi
- echo ""
- } 3>&1 >"$contentfile"
+ feed=$blog_feed
+ if [[ -n $global_feedburner ]]; then feed=$global_feedburner; fi
+ echo ""
+ } 3>&1 >"$contentfile"
- echo ""
+ echo ""
- create_html_page "$contentfile" "$newindexfile" yes "$global_title" "$global_author"
- rm "$contentfile"
- mv "$newindexfile" "$index_file"
- chmod 644 "$index_file"
+ create_html_page "$contentfile" "$newindexfile" yes "$global_title" "$global_author"
+ rm "$contentfile"
+ mv "$newindexfile" "$index_file"
+ chmod 644 "$index_file"
}
# Finds all tags referenced in one post.
# Accepts either filename as first argument, or post content at stdin
# Prints one line with space-separated tags to stdout
tags_in_post() {
- sed -n "/^$template_tags_title
"
+ echo ""
# shellcheck disable=SC2231 # Intended splitting of $prefix_tags
- for i in $prefix_tags*.html; do
- [[ -f "$i" ]] || break
- echo -n "." 1>&3
- nposts=$(grep -c "<\!-- text begin -->" "$i")
- tagname=${i#"$prefix_tags"}
- tagname=${tagname%.html}
- case $nposts in
- 1) word=$template_tags_posts_singular;;
- 2|3|4) word=$template_tags_posts_2_4;;
- *) word=$template_tags_posts;;
- esac
- echo "
"
- echo ""
- } 3>&1 > "$contentfile"
+ for i in $prefix_tags*.html; do
+ [[ -f "$i" ]] || break
+ echo -n "." 1>&3
+ nposts=$(grep -c "<\!-- text begin -->" "$i")
+ tagname=${i#"$prefix_tags"}
+ tagname=${tagname%.html}
+ case $nposts in
+ 1) word=$template_tags_posts_singular;;
+ 2|3|4) word=$template_tags_posts_2_4;;
+ *) word=$template_tags_posts;;
+ esac
+ echo "/{s/.*href="\([^"]*\)">.*/\1/;p;}' "$@" 2> /dev/null
+ (($# < 1)) && return
+ set -- "${@/#/$prefix_tags}"
+ set -- "${@/%/.html}"
+ sed -n '/^
/{s/.*href="\([^"]*\)">.*/\1/;p;}' "$@" 2> /dev/null
}
# Rebuilds tag_*.html files
@@ -706,387 +705,391 @@ posts_with_tags() {
# rebuild_tags "one_post.html another_article.html" "example-tag another-tag"
# mind the quotes!
rebuild_tags() {
- if (($# < 2)); then
- # will process all files and tags
- files=$(ls -t ./*.html)
- all_tags=yes
- else
- # will process only given files and tags
- files=$(printf '%s\n' "$1" | sort -u)
+ if (($# < 2)); then
+ # will process all files and tags
+ files=$(ls -t ./*.html)
+ all_tags=yes
+ else
+ # will process only given files and tags
+ files=$(printf '%s\n' "$1" | sort -u)
# shellcheck disable=SC2086 # Intended splitting of $files
- files=$(ls -t $files)
- tags=$2
- fi
- echo -n "Rebuilding tag pages "
- n=0
- if [[ -n $all_tags ]]; then
- rm ./"$prefix_tags"*.html &> /dev/null
- else
- for i in $tags; do
- rm "./$prefix_tags$i.html" &> /dev/null
- done
- fi
- # First we will process all files and create temporal tag files
- # with just the content of the posts
- tmpfile=tmp.$RANDOM
- while [[ -f $tmpfile ]]; do tmpfile=tmp.$RANDOM; done
- while IFS='' read -r i; do
- is_boilerplate_file "$i" && continue;
- echo -n "."
- if [[ -n $cut_do ]]; then
- get_html_file_content 'entry' 'entry' 'cut' <"$i" | awk "/$cut_line/ { print \"\" ; next } 1"
- else
- get_html_file_content 'entry' 'entry' <"$i"
- fi >"$tmpfile"
- for tag in $(tags_in_post "$i"); do
- if [[ -n $all_tags || " $tags " == *" $tag "* ]]; then
- cat "$tmpfile" >> "$prefix_tags$tag".tmp.html
- fi
- done
- done <<< "$files"
- rm "$tmpfile"
- # Now generate the tag files with headers, footers, etc
- 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\"" "$global_author"
- rm "$i"
- done < <(ls -t ./"$prefix_tags"*.tmp.html 2>/dev/null)
- echo
+ files=$(ls -t $files)
+ tags=$2
+ fi
+ echo -n "Rebuilding tag pages "
+ n=0
+ if [[ -n $all_tags ]]; then
+ rm ./"$prefix_tags"*.html &> /dev/null
+ else
+ for i in $tags; do
+ rm "./$prefix_tags$i.html" &> /dev/null
+ done
+ fi
+ # First we will process all files and create temporal tag files
+ # with just the content of the posts
+ tmpfile=tmp.$RANDOM
+ while [[ -f $tmpfile ]]; do tmpfile=tmp.$RANDOM; done
+ while IFS='' read -r i; do
+ is_boilerplate_file "$i" && continue;
+ echo -n "."
+ if [[ -n $cut_do ]]; then
+ get_html_file_content 'entry' 'entry' 'cut' <"$i" | awk "/$cut_line/ { print \"\" ; next } 1"
+ else
+ get_html_file_content 'entry' 'entry' <"$i"
+ fi >"$tmpfile"
+ for tag in $(tags_in_post "$i"); do
+ if [[ -n $all_tags || " $tags " == *" $tag "* ]]; then
+ cat "$tmpfile" >> "$prefix_tags$tag".tmp.html
+ fi
+ done
+ done <<< "$files"
+ rm "$tmpfile"
+ # Now generate the tag files with headers, footers, etc
+ 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\"" "$global_author"
+ rm "$i"
+ done < <(ls -t ./"$prefix_tags"*.tmp.html 2>/dev/null)
+ echo
}
# Return the post title
#
# $1 the html file
get_post_title() {
- awk '/
/, /<\/a><\/h3>/{if (!/
/ && !/<\/a><\/h3>/) print}' "$1"
+ awk '/
/, /<\/a><\/h3>/{if (!/
/ && !/<\/a><\/h3>/) print}' "$1"
}
# Return the post author
#
# $1 the html file
get_post_author() {
- awk '/
$global_title
"
- echo "$global_title
"
+ echo "