Stig-Ørjan Smelror
12f36071df
- Update to version 0.3.5 - Updated the link to Zsh in the README file. - Made changes to the _pages function in the qsgen2 script to use Zsh built-in functions for finding the page title. - Added support for finding the page title in markdown files in the _pages function. - Added support for finding the blog title in markdown files in the _blogs function.
107 lines
7.6 KiB
Plaintext
107 lines
7.6 KiB
Plaintext
# Usage: _msg <type> "<message>"
|
|
_msg info "Usage: qsgen2 add \"Site Name\" \"/path/to/project\""
|
|
_msg sub "- Forced Update: Generating Everything"
|
|
_msg debug "* ${0:t} cannot parse this site. Exiting. *"
|
|
_msg other "Please install Pandoc."
|
|
_msg other "https://github.com/jgm/pandoc/releases"
|
|
_msg debug "No valid generator found. Are you sure you've selected the correct generator in 'config'?"
|
|
if (${globaldebug}); then _msg debug "Using the ${generator} engine for files: ${file_ext}"; fi
|
|
if ${debug}; then _msg debug "_list_pages: No Pages found with ext ${file_ext}."; fi
|
|
if ${debug}; then _msg debug "_list_pages: Adding file to array: ${file}"; fi
|
|
if ${debug}; then _msg debug "_list_blogs: No blog files found."; fi
|
|
if ${debug}; then _msg debug "_list_blogs: Adding file to array: $file"; fi
|
|
if (${debug}) _msg debug "_blog_cache: HASH VALUE: ${blog_cache[${name}]}"
|
|
if (${debug}) _msg debug "1. _blog_cache: ${blog_file}"
|
|
if (${debug}) _msg debug "2. _blog_cache: current_cache: ${current_hash}"
|
|
if (${debug}) _msg debug "3. _blog_cache: new_cache_file: ${blog_file}$"
|
|
if (${debug}) _msg debug "4. _blog_cache: new_current_cache: ${current_hash}"
|
|
if (${debug}) _msg debug "PAGES HASH VALUE: ${pages_cache[${name}]}"
|
|
if (${debug}) _msg debug "1. pages_cache: ${pages_cache[$file]}"
|
|
if (${debug}) _msg debug "1. _pages_cache: current_cache: ${current_hash}"
|
|
if (${debug}) _msg debug "2. _pages_cache: pages_file: ${pages_cache[$file]}"
|
|
if (${debug}) _msg debug "2. _pages_cache: current_cache: ${current_hash}"
|
|
if (${debug}); then _msg debug "_last_updated: Setting date and version in footer"; fi
|
|
if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi
|
|
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>"
|
|
-e "s|#updated|${upd_msg}|")
|
|
if (${debug}); then _msg debug "_f_last_updated: Setting date and version in footer of file ${1}"; fi
|
|
if (${debug}); then _msg debug "_f_last_updated: ${upd_msg}"; fi
|
|
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>"
|
|
-e "s|#updated|${upd_msg}|" \
|
|
if (${debug}) _msg debug "_pages: Running function _pages_cache"
|
|
_msg sub "* You do not have any pages *"
|
|
_msg main "Generating Pages"
|
|
if (${debug}) _msg debug "_pages: pages_array is not empty"
|
|
if (${debug}) _msg debug "_pages: Setting Pages template"
|
|
_msg info "Unable to find the Pages template: ${pages}"
|
|
if (${debug}) _msg debug "_pages: Reading Pages template into pages_tpl"
|
|
_msg std "- Generating Page: ${pages_in_array%.*}.html"
|
|
if (${debug}) _msg debug "_pages: Loading page_content once - ${pages_in_array}"
|
|
if (${debug}) _msg debug "_pages: Grepping for page_title"
|
|
if (${debug}) _msg debug "_pages: ${page_title}"
|
|
if (${debug}) _msg debug "_pages: Removing #title line from page_content"
|
|
if (${debug}) _msg debug "_pages: Running engine on ${pages_in_array}"
|
|
if (${debug}) _msg debug "_pages: Checking for #link, #showimg and #ytvideo in page_content"
|
|
if (${debug}) _msg debug "_pages: #link is present, run _link: page_content"
|
|
if (${debug}) _msg debug "_pages: #showimg is present, run _image: page_content"
|
|
if (${debug}) _msg debug "_pages: #ytvideo is present, run _youtube: page_content"
|
|
if (${debug}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl"
|
|
if (${debug}) _msg debug "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl"
|
|
if (${debug}) _msg debug "_pages: _last_updated in pages_tpl"
|
|
if (${debug}) _msg debug "_pages: Lowercase filnames, always"
|
|
if (${debug}) _msg debug "_pages: Running _cleanup"
|
|
# _msg std "Writing ${www_root}/${pages_title_lower%.*}.html to disk."
|
|
if (${debug}) _msg sub "- Parsing ${pages_in_array}"
|
|
if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}"
|
|
if (${debug}) _msg sub "- Listing blog temp file:"
|
|
_msg std "Updating index.html with new blog posts"
|
|
if (${debug}) _msg sub "- Parsing ${pages_in_array}"
|
|
if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}"
|
|
if (${debug}) _msg sub "- Listing blog temp file:"
|
|
_msg sub "- No new or updated Pages found"
|
|
if (${debug}) _msg debug "_blogs: Running function _list_blogs"
|
|
_msg sub "* You do not have any blogs *"
|
|
_msg main "Generating Blogs"
|
|
if (${debug}) _msg debug "_blogs: Running function _blog_cache"
|
|
_msg info "Unable to find theme template for Blogs."
|
|
if (${debug}) _msg debug "_blogs: Processing pre-data for ${blog}"
|
|
_msg debug "_blogs: DATE metadata missing in ${blog}."
|
|
if (${debug}) _msg debug "_blogs: Adding data for ${blog} to array to export"
|
|
if (${debug}) _msg debug "_blogs: Processing ${blog}"
|
|
_msg std "- Generating Blog: ${blog_index}.html"
|
|
if (${debug}) _msg debug "_blogs: Processing substitutes in ${blog}"
|
|
if (${debug}) _msg debug "_blogs: Running function $engine for ${blog}"
|
|
if (${debug}) _msg debug "_blogs: Checking for #link, #showimg and #ytvideo in blog_content"
|
|
if (${debug}) _msg debug "_blogs: #link is present, run _link: blog_content"
|
|
if (${debug}) _msg debug "_blogs: #showimg is present, run _link: blog_content"
|
|
if (${debug}) _msg debug "_blogs: #ytvideo is present, run _link: blog_content"
|
|
if (${debug}) _msg debug "_blogs: Replacing tagline, sitename and pagetitle"
|
|
if (${debug}) _msg debug "_blogs: Creating directoty ${www_root}/${blog_dir}"
|
|
if (${debug}) _msg debug "_blogs: Writing blog to disk: ${www_root}${blog_url}"
|
|
_msg sub "- No new or updated Blogs found"
|
|
if (${debug}) _msg sub "* _blogs: Running _blog_idx_for_index"
|
|
if (${debug}) _msg sub "* _blogs: Running _blog_index"
|
|
_msg sub "- Populating ${project_dir}/blog/index.tmp.html"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: Initiating function"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: meta_str from BLOG_META_STR_ARRAY from _blogs"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: ${meta_str}"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: Iterate over each component and extract information"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: Running ${engine} on content to catch QStags in Ingress"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: Writing _blog_idx_for_index to file: ${project_dir}/blog/index.tmp.html"
|
|
if (${debug}) _msg debug "_blog_idx_for_index: blog_list_content = ${blog_list_content}"
|
|
if (${debug}) _msg debug "Running function _blog_index"
|
|
if (${debug}) _msg debug "_blog_index: blog_in_index = ${blog_in_index}"
|
|
_msg std "- Generating the Blog index file"
|
|
if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html"
|
|
_msg main "Generating Sitemap"
|
|
if (${debug}); then _msg debug "Sitemap generated at ${sitemap_file}"; fi
|
|
if (${debug}) _msg debug "_link: URL_MAIN(line): ${line}"
|
|
if (${debug}) _msg debug "_link_ URL: ${url_dest}"
|
|
if (${debug}) _msg debug "_link: Text: ${url_txt}"
|
|
if (${debug}) _msg debug "_image: Processing line: ${line}"
|
|
if (${debug}) _msg debug "_youtube: Processing line: ${line}"
|
|
if (${debug}) _msg debug "_cleanup: Cleaning up tags in content"
|
|
_msg debug "_html: Converting QStags in content"
|
|
_msg debug "_html: Converting QStags in content"
|