diff --git a/qsgen2 b/qsgen2 index 9b375a5..b198dee 100755 --- a/qsgen2 +++ b/qsgen2 @@ -533,9 +533,11 @@ function _blogs() { done # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post export BLOG_META_STR_ARRAY + export new_updated_blogs=true else _msg info "No new or updated Blogs detected." + export new_updated_blogs=false fi } @@ -598,21 +600,23 @@ function _blog_idx_for_index() { function _blog_index() { # This function generates the /blog/index.html file that gets its data from _blog_list_for_index() - if [[ ${blog_in_index} == "false" ]]; then - - _msg info "Running function _blog_index" + # ${new_updated_blogs} comes from the function _blogs if anything new or updated is detected + if [[ ${blog_in_index} == "false" ]] && [[ ${new_updated_blogs} = "true" ]]; then + + if (${debug}) _msg debug "Running function _blog_index" if (${debug}) _msg debug "_blog_index: blog_in_index = ${blog_in_index}" - + + _msg std "Updating the Blog Index file" + local debug=false local blog_index=$(<${project_dir}/themes/${theme}/blog_index.tpl) local blog_index_list=$(<${project_dir}/blog/index.tmp.html) - _msg std "Updating the Blog Index file" blog_index_content=$(echo "${blog_index}" | perl -pe "s|BODY|${blog_index_list}|g") echo "${blog_index_content}" > ${www_root}/blog/index.html _f_last_updated ${www_root}/blog/index.html fi - + } function _sitemap() { @@ -779,54 +783,77 @@ function _cleanup() { } function _html() { + # This function converts formatting tags into their HTML equivalents in a provided string - + # using QStags (QS-tags) + local content="${1}" local debug=false - if (${debug}) _msg debug "_html: Generating HTML from content" + if (${debug}); then _msg debug "_html: Converting QStags in content"; fi - # Perform HTML tag substitutions + # Perform HTML tag substitutions handling both lowercase and uppercase QStags local html_content=$(echo "${content}" | sed \ - -e "s|#BR|
|g" \ - -e "s|#BD||g" \ - -e "s|#EBD||g" \ - -e "s|#UN||g" \ - -e "s|#EUN||g" \ - -e "s|#P|

|g" \ - -e "s|#EP|

|g" \ - -e "s|#Q|
|g" \ - -e "s|#EQ|
|g" \ - -e "s|#STRONG||g" \ - -e "s|#ESTRONG||g" \ - -e "s|#I||g" \ - -e "s|#EI||g" \ - -e "s|#C||g" \ - -e "s|#EC||g" \ - -e "s|#EM||g" \ - -e "s|#SEM||g" \ - -e "s|#OT|"|g" \ - -e "s|#UL||g" \ - -e "s|#EOL||g" \ - -e "s|#H1|

|g" \ - -e "s|#H2|

|g" \ - -e "s|#H3|

|g" \ - -e "s|#H4|

|g" \ - -e "s|#H5|

|g" \ - -e "s|#H6|
|g" \ - -e "s|#EH1|
|g" \ - -e "s|#EH2||g" \ - -e "s|#EH3||g" \ - -e "s|#EH4||g" \ - -e "s|#EH5||g" \ - -e "s|#EH6||g" \ - -e "s|#LT|<|g" \ - -e "s|#GT|>|g" \ - -e "s|#NUM|#|g") + -e "s|#[bB]||g" \ + -e "s|#[eE][bB]||g" \ + -e "s|#[iI]||g" \ + -e "s|#[eE][iI]||g" \ + -e "s|#[uU]||g" \ + -e "s|#[eE][uU]||g" \ + -e "s|#[pP]|

|g" \ + -e "s|#[eE][pP]|

|g" \ + -e "s|#[hH]1|

|g" \ + -e "s|#[hH]2|

|g" \ + -e "s|#[hH]3|

|g" \ + -e "s|#[hH]4|

|g" \ + -e "s|#[hH]5|

|g" \ + -e "s|#[hH]6|
|g" \ + -e "s|#[eE][hH]1|

|g" \ + -e "s|#[eE][hH]2|

|g" \ + -e "s|#[eE][hH]3|

|g" \ + -e "s|#[eE][hH]4|

|g" \ + -e "s|#[eE][hH]5|

|g" \ + -e "s|#[eE][hH]6|
|g" \ + -e "s|#[sS][tT][rR][oO][nN][gG]||g" \ + -e "s|#[eE][sS][tT][rR][oO][nN][gG]||g" \ + -e "s|#[eE][mM]||g" \ + -e "s|#[eE][eE][mM]||g" \ + -e "s|#[bB][rR]|
|g" \ + -e "s|#[aA]||g" \ + -e "s|#[eE][aA]||g" \ + -e "s|#[dD][iI][vV]|
|g" \ + -e "s|#[eE][dD][iI][vV]|
|g" \ + -e "s|#[sS][pP][aA][nN]||g" \ + -e "s|#[eE][sS][pP][aA][nN]||g" \ + -e "s|#[uU][lL]|