if [[ ${globaldebug} == "true" ]]; then local debug=true else local debug=false fi _msg main "${0:t}_msg_3" if (${debug}) _msg debug "${0:t}_msg_1" _pages_cache if [[ ${no_pages_found} == "true" ]]; then _msg sub "${0:t}_msg_1" return fi if (( ${#pages_array[@]} > 0 )); then if (${debug}) _msg debug "${0:t}_msg_4" for pages_in_array in ${pages_array[@]} do if (${debug}) _msg debug "${0:t}_msg_5" local pages=${config[project_root]}/themes/${config[site_theme]}/pages.tpl if [[ ! -f ${pages} ]]; then _msg info "${0:t}_msg_6" " ${pages}" exit else if (${debug}) _msg debug "${0:t}_msg_7" local pages_tpl="$(<${pages})" fi if (${debug}) _msg debug "${0:t}_msg_9" " ${pages_in_array}" local page_content="$(<${pages_in_array})" if (${debug}) _msg debug "${0:t}_msg_10" if [[ ${config[project_generator]} == "native" ]]; then while read -r line do if [[ "$line" =~ ^#title=(.*) ]]; then local page_title=${match[1]} break fi done <<< "$page_content" elif [[ ${config[project_generator]} == "markdown" ]]; then while IFS= read -r line do if [[ "$line" == \#* ]]; then local page_title="${line#\#}" page_title="${page_title#\#}" page_title="${page_title#"${page_title%%[![:space:]]*}"}" break fi done <<< ${page_content} fi _msg std " - ${page_title}" if (${debug}) _msg debug "${0:t}_msg_11" " ${page_title}" if (${debug}) _msg debug "${0:t}_msg_12" page_content=$( echo ${page_content} | grep -v \#title ) if (${debug}) _msg debug "${0:t}_msg_13" " ${pages_in_array}" page_content=$( _run_engine "$page_content" ) if (${debug}) _msg debug "${0:t}_msg_14" if [[ $( echo ${page_content} | grep \#link ) ]]; then if (${debug}) _msg debug "${0:t}_msg_15" page_content=$( _link "${page_content}" ) fi if [[ $( echo ${page_content} | grep \#showimg ) ]]; then if (${debug}) _msg debug "${0:t}_msg_16" page_content=$( _image "${page_content}" ) fi if [[ $( echo ${page_content} | grep \#ytvideo ) ]]; then if (${debug}) _msg debug "${0:t}_msg_17" page_content=$( _youtube "${page_content}" ) fi if (${debug}) _msg debug "${0:t}_msg_18" pages_tpl=$(echo "${pages_tpl}" | perl -pe "s|#pagetitle|${page_title}|gs; s|#tagline|${config[site_tagline]}|gs; s|#sitename|${config[site_name]}|gs") if (${debug}) _msg debug "${0:t}_msg_19" pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") ) if (${debug}) _msg debug "${0:t}_msg_20" pages_tpl=$( _last_updated ${pages_tpl} ) if (${debug}) _msg debug "${0:t}_msg_21" pages_title_lower=$( _file_to_lower "${pages_in_array}" ) if (${debug}) _msg debug "${0:t}_msg_22" pages_tpl=$( _cleanup "${pages_tpl}" ) echo "${pages_tpl}" > ${config[site_root]}/${pages_title_lower%.*}.html if [[ ${pages_in_array} == "index.${file_ext}" && ${config[site_blog]} == "true" && -s "${config[project_root]}/blog/index.tmp.html" ]]; then if (${debug}) _msg sub "${0:t}_msg_23" " ${pages_in_array}" if (${debug}) _msg sub "${0:t}_msg_24" " ${config[site_blog]}" if (${debug}) _msg sub "${0:t}_msg_25" if (${debug}) ls -l ${config[project_root]}/blog/index.tmp.html _add_blog_list_to_index fi done export new_updated_pages=true else if [[ ${config[site_blog]} == "true" && -s "${config[project_root]}/blog/index.tmp.html" ]]; then _msg std "${0:t}_msg_26" if (${debug}) _msg sub "${0:t}_msg_27" " ${pages_in_array}" if (${debug}) _msg sub "${0:t}_msg_28" " ${config[site_blog]}" if (${debug}) _msg sub "${0:t}_msg_25" if (${debug}) ls -l ${config[project_root]}/blog/index.tmp.html _add_blog_list_to_index fi _msg sub "${0:t}_msg_29" export new_updated_pages=false fi