qsgen2: Updated function _msg to enable localization. en_US, es_ES and nb_NO available.

This commit is contained in:
Stig-Ørjan Smelror 2024-02-14 11:35:47 +01:00
parent 136a9644f5
commit c68dafda4f
4 changed files with 379 additions and 268 deletions

View File

@ -1,106 +1,114 @@
# Usage: _msg <type> "<message>" typeset -A localization
_msg info "Usage: qsgen2 add \"Site Name\" \"/path/to/project\"" localization=(
_msg sub "- Forced Update: Generating Everything" _msg_msg_1 "Usage: qsgen2 add \\"Site Name\\" \\"/path/to/project\\""
_msg debug "* ${0:t} cannot parse this site. Exiting. *" _msg_msg_2 "- Forced Update: Generating Everything"
_msg other "Please install Pandoc." _msg_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *"
_msg other "https://github.com/jgm/pandoc/releases" _msg_msg_4 "Please install Pandoc."
_msg debug "No valid generator found. Are you sure you've selected the correct generator in 'config'?" _msg_msg_5 "https://github.com/jgm/pandoc/releases"
if (${globaldebug}); then _msg debug "Using the ${generator} engine for files: ${file_ext}"; fi _msg_msg_6 "No valid generator found. Are you sure you\'ve selected the correct generator in \'config\'?"
if ${debug}; then _msg debug "_list_pages: No Pages found with ext ${file_ext}."; fi _msg_msg_7 "Using the ${generator} engine for files: ${file_ext}"
if ${debug}; then _msg debug "_list_pages: Adding file to array: ${file}"; fi _list_pages_msg_1 "_list_pages: No Pages found with ext ${file_ext}."
if ${debug}; then _msg debug "_list_blogs: No blog files found."; fi _list_pages_msg_2 "_list_pages: Adding file to array: ${file}"
if ${debug}; then _msg debug "_list_blogs: Adding file to array: $file"; fi _list_blogs_msg_3 "_list_blogs: No blog files found."
if (${debug}) _msg debug "_blog_cache: HASH VALUE: ${blog_cache[${name}]}" _list_blogs_msg_4 "_list_blogs: Adding file to array: $file"
if (${debug}) _msg debug "1. _blog_cache: ${blog_file}" _blog_cache_msg_1 "_blog_cache: HASH VALUE: ${blog_cache[${name}]}"
if (${debug}) _msg debug "2. _blog_cache: current_cache: ${current_hash}" _blog_cache_msg_2 "1. _blog_cache: ${blog_file}"
if (${debug}) _msg debug "3. _blog_cache: new_cache_file: ${blog_file}$" _blog_cache_msg_3 "2. _blog_cache: current_cache: ${current_hash}"
if (${debug}) _msg debug "4. _blog_cache: new_current_cache: ${current_hash}" _blog_cache_msg_4 "3. _blog_cache: new_cache_file: ${blog_file}$"
if (${debug}) _msg debug "PAGES HASH VALUE: ${pages_cache[${name}]}" _blog_cache_msg_5 "4. _blog_cache: new_current_cache: ${current_hash}"
if (${debug}) _msg debug "1. pages_cache: ${pages_cache[$file]}" _pages_cache_msg_1 "PAGES HASH VALUE: ${pages_cache[${name}]}"
if (${debug}) _msg debug "1. _pages_cache: current_cache: ${current_hash}" _pages_cache_msg_2 "1. pages_cache: ${pages_cache[$file]}"
if (${debug}) _msg debug "2. _pages_cache: pages_file: ${pages_cache[$file]}" _pages_cache_msg_3 "1. _pages_cache: current_cache: ${current_hash}"
if (${debug}) _msg debug "2. _pages_cache: current_cache: ${current_hash}" _pages_cache_msg_4 "2. _pages_cache: pages_file: ${pages_cache[$file]}"
if (${debug}); then _msg debug "_last_updated: Setting date and version in footer"; fi _pages_cache_msg_5 "2. _pages_cache: current_cache: ${current_hash}"
if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi _last_updated_msg_1 "_last_updated: Setting date and version in footer"
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>" _last_updated_msg_1 "_last_updated: ${upd_msg}"
-e "s|#updated|${upd_msg}|") _f_last_updated_msg_1 "_f_last_updated: Setting date and version in footer of file ${1}"
if (${debug}); then _msg debug "_f_last_updated: Setting date and version in footer of file ${1}"; fi _f_last_updated_msg_2 "_f_last_updated: ${upd_msg}"
if (${debug}); then _msg debug "_f_last_updated: ${upd_msg}"; fi _f_last_updated_msg_3 "_f_last_updated: File \'${1}\' not found."
local upd_msg="Last updated ${today} by <a href=\"https://blog.kekepower.com/qsgen2.html\">${QSGEN} ${VERSION}</a>" _pages_msg_1 "_pages: Running function _pages_cache"
-e "s|#updated|${upd_msg}|" \ _pages_msg_2 "* You do not have any pages *"
if (${debug}) _msg debug "_pages: Running function _pages_cache" _pages_msg_3 "Generating Pages"
_msg sub "* You do not have any pages *" _pages_msg_4 "_pages: pages_array is not empty"
_msg main "Generating Pages" _pages_msg_5 "_pages: Setting Pages template"
if (${debug}) _msg debug "_pages: pages_array is not empty" _pages_msg_6 "Unable to find the Pages template: ${pages}"
if (${debug}) _msg debug "_pages: Setting Pages template" _pages_msg_7 "_pages: Reading Pages template into pages_tpl"
_msg info "Unable to find the Pages template: ${pages}" _pages_msg_8 "- Generating Page: ${pages_in_array%.*}.html"
if (${debug}) _msg debug "_pages: Reading Pages template into pages_tpl" _pages_msg_9 "_pages: Loading page_content once - ${pages_in_array}"
_msg std "- Generating Page: ${pages_in_array%.*}.html" _pages_msg_10 "_pages: Finding page_title"
if (${debug}) _msg debug "_pages: Loading page_content once - ${pages_in_array}" _pages_msg_11 "_pages: ${page_title}"
if (${debug}) _msg debug "_pages: Grepping for page_title" _pages_msg_12 "_pages: Removing #title line from page_content"
if (${debug}) _msg debug "_pages: ${page_title}" _pages_msg_13 "_pages: Running engine on ${pages_in_array}"
if (${debug}) _msg debug "_pages: Removing #title line from page_content" _pages_msg_14 "_pages: Checking for #link, #showimg and #ytvideo in page_content"
if (${debug}) _msg debug "_pages: Running engine on ${pages_in_array}" _pages_msg_15 "_pages: #link is present, run _link: page_content"
if (${debug}) _msg debug "_pages: Checking for #link, #showimg and #ytvideo in page_content" _pages_msg_16 "_pages: #showimg is present, run _image: page_content"
if (${debug}) _msg debug "_pages: #link is present, run _link: page_content" _pages_msg_17 "_pages: #ytvideo is present, run _youtube: page_content"
if (${debug}) _msg debug "_pages: #showimg is present, run _image: page_content" _pages_msg_18 "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl"
if (${debug}) _msg debug "_pages: #ytvideo is present, run _youtube: page_content" _pages_msg_19 "_pages: Replacing BODY with page_content in pages_tpl"
if (${debug}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl" _pages_msg_20 "_pages: _last_updated in pages_tpl"
if (${debug}) _msg debug "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl" _pages_msg_21 "_pages: Lowercase filnames, always"
if (${debug}) _msg debug "_pages: _last_updated in pages_tpl" _pages_msg_22 "_pages: Running _cleanup"
if (${debug}) _msg debug "_pages: Lowercase filnames, always" _pages_msg_23 "- Parsing ${pages_in_array}"
if (${debug}) _msg debug "_pages: Running _cleanup" _pages_msg_24 "- blog_in_index = ${blog_in_index}"
# _msg std "Writing ${www_root}/${pages_title_lower%.*}.html to disk." _pages_msg_25 "- Listing blog temp file:"
if (${debug}) _msg sub "- Parsing ${pages_in_array}" _pages_msg_26 "Updating index.html with new blog posts"
if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}" _pages_msg_27 "- Parsing ${pages_in_array}"
if (${debug}) _msg sub "- Listing blog temp file:" _pages_msg_28 "- blog_in_index = ${blog_in_index}"
_msg std "Updating index.html with new blog posts" _pages_msg_29 "- Listing blog temp file:"
if (${debug}) _msg sub "- Parsing ${pages_in_array}" _pages_msg_30 "- No new or updated Pages found"
if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}" _blogs_msg_1 "_blogs: Running function _list_blogs"
if (${debug}) _msg sub "- Listing blog temp file:" _blogs_msg_2 "* You do not have any blogs *"
_msg sub "- No new or updated Pages found" _blogs_msg_3 "Generating Blogs"
if (${debug}) _msg debug "_blogs: Running function _list_blogs" _blogs_msg_4 "_blogs: Running function _blog_cache"
_msg sub "* You do not have any blogs *" _blogs_msg_5 "Unable to find theme template for Blogs."
_msg main "Generating Blogs" _blogs_msg_6 "_blogs: Processing pre-data for ${blog}"
if (${debug}) _msg debug "_blogs: Running function _blog_cache" _blogs_msg_7 "_blogs: Looking for DATE: Found"
_msg info "Unable to find theme template for Blogs." _blogs_msg_8 "_blogs: Looking for BLOG_TITLE: Found"
if (${debug}) _msg debug "_blogs: Processing pre-data for ${blog}" _blogs_msg_9 "* _blogs: DATE metadata missing in ${blog}."
_msg debug "_blogs: DATE metadata missing in ${blog}." _blogs_msg_10 "* _blogs: BLOG_TITLE metadata missing in ${blog}."
if (${debug}) _msg debug "_blogs: Adding data for ${blog} to array to export" _blogs_msg_11 "_blogs: Adding data for ${blog} to array to export"
if (${debug}) _msg debug "_blogs: Processing ${blog}" _blogs_msg_12 "_blogs: Processing ${blog}"
_msg std "- Generating Blog: ${blog_index}.html" _blogs_msg_13 "- Generating Blog: ${blog_index}.html"
if (${debug}) _msg debug "_blogs: Processing substitutes in ${blog}" _blogs_msg_14 "_blogs: Processing substitutes in ${blog}"
if (${debug}) _msg debug "_blogs: Running function $engine for ${blog}" _blogs_msg_15 "_blogs: Running function $engine for ${blog}"
if (${debug}) _msg debug "_blogs: Checking for #link, #showimg and #ytvideo in blog_content" _blogs_msg_16 "_blogs: Checking for #link, #showimg and #ytvideo in blog_content"
if (${debug}) _msg debug "_blogs: #link is present, run _link: blog_content" _blogs_msg_17 "_blogs: #link is present, run _link: blog_content"
if (${debug}) _msg debug "_blogs: #showimg is present, run _link: blog_content" _blogs_msg_18 "_blogs: #showimg is present, run _link: blog_content"
if (${debug}) _msg debug "_blogs: #ytvideo is present, run _link: blog_content" _blogs_msg_19 "_blogs: #ytvideo is present, run _link: blog_content"
if (${debug}) _msg debug "_blogs: Replacing tagline, sitename and pagetitle" _blogs_msg_20 "_blogs: Replacing tagline, sitename and pagetitle"
if (${debug}) _msg debug "_blogs: Creating directoty ${www_root}/${blog_dir}" _blogs_msg_21 "_blogs: Creating directory ${www_root}${blog_dir}"
if (${debug}) _msg debug "_blogs: Writing blog to disk: ${www_root}${blog_url}" _blogs_msg_22 "_blogs: Writing blog to disk: ${www_root}${blog_url}"
_msg sub "- No new or updated Blogs found" _blogs_msg_23 "_blogs: new_updated_blogs=true"
if (${debug}) _msg sub "* _blogs: Running _blog_idx_for_index" _blogs_msg_24 "- No new or updated Blogs found"
if (${debug}) _msg sub "* _blogs: Running _blog_index" _blogs_msg_25 "* _blogs: Running _blog_idx_for_index"
_msg sub "- Populating ${project_dir}/blog/index.tmp.html" _blogs_msg_26 "* _blogs: Running _blog_index"
if (${debug}) _msg debug "_blog_idx_for_index: Initiating function" _blog_idx_for_index_msg_1 "- Populating ${project_dir}/blog/index.tmp.html"
if (${debug}) _msg debug "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}" _blog_idx_for_index_msg_2 "_blog_idx_for_index: Initiating function"
if (${debug}) _msg debug "_blog_idx_for_index: meta_str from BLOG_META_STR_ARRAY from _blogs" _blog_idx_for_index_msg_3 "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}"
if (${debug}) _msg debug "_blog_idx_for_index: ${meta_str}" _blog_idx_for_index_msg_4 "_blog_idx_for_index: meta_str from BLOG_META_STR_ARRAY from _blogs"
if (${debug}) _msg debug "_blog_idx_for_index: Iterate over each component and extract information" _blog_idx_for_index_msg_5 "_blog_idx_for_index: ${meta_str}"
if (${debug}) _msg debug "_blog_idx_for_index: Running ${engine} on content to catch QStags in Ingress" _blog_idx_for_index_msg_6 "_blog_idx_for_index: Iterate over each component and extract information"
if (${debug}) _msg debug "_blog_idx_for_index: Writing _blog_idx_for_index to file: ${project_dir}/blog/index.tmp.html" _blog_idx_for_index_msg_7 "_blog_idx_for_index: Running ${engine} on content to catch QStags in Ingress"
if (${debug}) _msg debug "_blog_idx_for_index: blog_list_content = ${blog_list_content}" _blog_idx_for_index_msg_8 "_blog_idx_for_index: Writing _blog_idx_for_index to file: ${project_dir}/blog/index.tmp.html"
if (${debug}) _msg debug "Running function _blog_index" _blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content = ${blog_list_content}"
if (${debug}) _msg debug "_blog_index: blog_in_index = ${blog_in_index}" _blog_index_msg_1 "_blog_index: blog_in_index=${blog_in_index}"
_msg std "- Generating the Blog index file" _blog_index_msg_2 "_blog_index: new_updated_blogs=${new_updated_blogs}"
if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html" _blog_index_msg_3 "_blog_index: Running function _blog_index"
_msg main "Generating Sitemap" _blog_index_msg_4 "_blog_index: blog_in_index = ${blog_in_index}"
if (${debug}); then _msg debug "Sitemap generated at ${sitemap_file}"; fi _blog_index_msg_5 "- Generating Page: ${www_root}/blog/index.html"
if (${debug}) _msg debug "_link: URL_MAIN(line): ${line}" _blog_index_msg_6 "_blog_index: Replacing sitename and tagline"
if (${debug}) _msg debug "_link_ URL: ${url_dest}" _blog_index_msg_7 "_blog_index: Replacing BODY with content of ${project_dir}/blog/index.tmp.html"
if (${debug}) _msg debug "_link: Text: ${url_txt}" _blog_index_msg_8 "_blog_index: Writing ${www_root}/blog/index.html"
if (${debug}) _msg debug "_image: Processing line: ${line}" _blog_index_msg_9 "_blog_index: Content length of blog_index_content: ${#blog_index_content}"
if (${debug}) _msg debug "_youtube: Processing line: ${line}" _add_blog_list_to_index_msg_1 "_add_blog_list_to_index: Inserting blog list to index.html"
if (${debug}) _msg debug "_cleanup: Cleaning up tags in content" _sitemap_msg_1 "Generating Sitemap"
_msg debug "_html: Converting QStags in content" _sitemap_msg_2 "Sitemap generated at ${sitemap_file}"
_msg debug "_html: Converting QStags in content" _link_msg_1 "_link: URL_MAIN(line): ${line}"
_link_msg_2 "_link_ URL: ${url_dest}"
_link_msg_3 "_link: Text: ${url_txt}"
_image_msg_1 "_image: Processing line: ${line}"
_youtube_msg_1 "_youtube: Processing line: ${line}"
_cleanup_msg_1 "_cleanup: Cleaning up tags in content"
_html_msg_1 "_html: Converting QStags in content"
_zhtml_msg_1 "_zhtml: Converting QStags in content"
)

View File

@ -1,68 +1,112 @@
typeset -A localization
localization=(
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ _msg_msg_1 "Uso: qsgen2 add \"Nombre del Sitio\" \"ruta/al/proyecto\""
┃ Uso: _msg "" ┃ _msg_msg_2 "- Actualización forzada: Generando todo"
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ _msg_msg_3 "* %SCRIPT_NAME% no puede analizar este sitio. Saliendo. *"
_msg_msg_4 "Por favor instala Pandoc."
_msg_msg_5 "No se encontró un generador válido. ¿Estás seguro de haber seleccionado el generador correcto en 'config'?"
_msg info "Uso: qsgen2 add \"Nombre del Sitio\" \"/ruta/al/proyecto\"" _msg_msg_6 "Usando el motor ${generator} para archivos: ${file_ext}"
_msg sub "- Actualización Forzada: Generando Todo" _list_pages_msg_1 "_list_pages: No se encontraron páginas con extensión ${file_ext}."
_msg debug "* ${0:t} no puede analizar este sitio. Saliendo. *" _list_pages_msg_2 "_list_pages: Añadiendo archivo al array: ${file}"
_msg other "Por favor, instale Pandoc." _list_blogs_msg_3 "_list_blogs: No se encontraron blogs."
_msg other "https://github.com/jgm/pandoc/releases" _list_blogs_msg_4 "_list_blogs: Añadiendo archivo al array: $file"
_blog_cache_msg_1 "_blog_cache: VALOR HASH: ${blog_cache[${name}]}"
_blog_cache_msg_2 "1. _blog_cache: ${blog_file}"
_blog_cache_msg_3 "2. _blog_cache: caché actual: ${current_hash}"
_blog_cache_msg_4 "3. _blog_cache: nuevo archivo en caché: ${blog_file}$"
_msg debug "No se encontró ningún generador válido. ¿Estás seguro de haber seleccionado el generador correcto en 'config'?" _blog_cache_msg_5 "4. _blog_cache: nuevo caché actual: ${current_hash}"
if (${globaldebug}); then _msg debug "Usando el motor ${generator} para archivos: ${file_ext}"; fi if ${debug}; then _msg _pages_cache_msg_1 "VALOR HASH DE PÁGINAS: ${pages_cache[${name}]}"
debug "_list_pages: No se encontraron páginas con extensión ${file_ext}."; fi if ${debug}; then _msg debug "_list_pages: _pages_cache_msg_2 "1. pages_cache: ${pages_cache[$file]}"
Agregando archivo al array: ${file}"; fi if ${debug}; then _msg debug "_list_blogs: No se encontraron archivos de blogs."; _pages_cache_msg_3 "1. _pages_cache: caché actual: ${current_hash}"
fi if ${debug}; then _msg debug "_list_blogs: Agregando archivo al array: $file"; fi if (${debug}) _msg debug "_blog_cache: _pages_cache_msg_4 "2. _pages_cache: archivo de páginas: ${pages_cache[$file]}"
VALOR HASH: ${blog_cache[${name}]}" if (${debug}) _msg debug "1. _blog_cache: ${blog_file}" if (${debug}) _msg debug "2. _pages_cache_msg_5 "2. _pages_cache: caché actual: ${current_hash}"
_blog_cache: current_cache: ${current_hash}" if (${debug}) _msg debug "3. _blog_cache: new_cache_file: ${blog_file}$" if _last_updated_msg_1 "_last_updated: Estableciendo fecha y versión en el pie de página"
(${debug}) _msg debug "4. _blog_cache: new_current_cache: ${current_hash}" if (${debug}) _msg debug "VALOR HASH DE PÁGINAS: _last_updated_msg_1 "_last_updated: ${upd_msg}"
${pages_cache[${name}]}" if (${debug}) _msg debug "1. pages_cache: ${pages_cache[$file]}" if (${debug}) _msg debug "1. _f_last_updated_msg_1 "_f_last_updated: Estableciendo fecha y versión en el pie de página del archivo ${1}"
_pages_cache: current_cache: ${current_hash}" if (${debug}) _msg debug "2. _pages_cache: pages_file: ${pages_cache[$file]}" _f_last_updated_msg_2 "_f_last_updated: ${upd_msg}"
if (${debug}) _msg debug "2. _pages_cache: current_cache: ${current_hash}" if (${debug}); then _msg debug "_last_updated: _f_last_updated_msg_3 "_f_last_updated: Archivo '${1}' no encontrado."
Estableciendo fecha y versión en el pie de página"; fi if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi local _pages_msg_1 "_pages: Ejecutando función _pages_cache"
upd_msg="Última actualización ${today} por <a href="https://blog.kekepower.com/qsgen2.html">${QSGEN} ${VERSION}" -e _pages_msg_2 "* No tienes ninguna página *"
"s|#updated|${upd_msg}|") if (${debug}); then _msg debug "_f_last_updated: Estableciendo fecha y versión en el pie de página _pages_msg_3 "Generando Páginas"
del archivo ${1}"; fi if (${debug}); then _msg debug "_f_last_updated: ${upd_msg}"; fi local upd_msg="Última actualización _pages_msg_4 "_pages: el array de páginas no está vacío"
${today} por <a href="https://blog.kekepower.com/qsgen2.html">${QSGEN} ${VERSION}" -e "s|#updated|${upd_msg}|" _pages_msg_5 "_pages: Estableciendo plantilla de Páginas"
if (${debug}) _msg debug "_pages: Ejecutando función _pages_cache" _msg sub "* No tienes ninguna página " _msg main _pages_msg_6 "No se pudo encontrar la plantilla de Páginas: ${pages}"
"Generando Páginas" if (${debug}) _msg debug "_pages: pages_array no está vacío" if (${debug}) _msg debug "_pages: _pages_msg_7 "_pages: Leyendo la plantilla de Páginas en pages_tpl"
Estableciendo plantilla de Páginas" _msg info "No se pudo encontrar la plantilla de Páginas: ${pages}" if (${debug}) _msg _pages_msg_8 "- Generando Página: ${pages_in_array%.*}.html"
debug "_pages: Leyendo plantilla de Páginas en pages_tpl" _msg std "- Generando Página: ${pages_in_array%.}.html" if _pages_msg_9 "_pages: Cargando contenido de página una vez - ${pages_in_array}"
(${debug}) _msg debug "_pages: Cargando page_content una vez - ${pages_in_array}" if (${debug}) _msg debug "_pages: Buscando _pages_msg_10 "_pages: Encontrando título de página"
page_title en page_content" if (${debug}) _msg debug "_pages: ${page_title}" if (${debug}) _msg debug "_pages: Eliminando _pages_msg_11 "_pages: ${page_title}"
línea #title de page_content" if (${debug}) _msg debug "_pages: Ejecutando motor en ${pages_in_array}" if (${debug}) _msg _pages_msg_12 "_pages: Eliminando línea #title del contenido de página"
debug "_pages: Comprobando #link, #showimg y #ytvideo en page_content" if (${debug}) _msg debug "_pages: #link está _pages_msg_13 "_pages: Ejecutando motor en ${pages_in_array}"
presente, ejecutar _link: page_content" if (${debug}) _msg debug "_pages: #showimg está presente, ejecutar _image: _pages_msg_14 "_pages: Comprobando #link, #showimg y #ytvideo en contenido de página"
page_content" if (${debug}) _msg debug "_pages: #ytvideo está presente, ejecutar _youtube: page_content" if (${debug}) _msg _pages_msg_15 "_pages: #link presente, ejecutar _link: contenido de página"
debug "_pages: Reemplazando BODY con page_content en pages_tpl" if (${debug}) _msg debug "_pages: Reemplazando #pagetitle, _pages_msg_16 "_pages: #showimg presente, ejecutar _image: contenido de página"
#tagline y #sitename en pages_tpl" if (${debug}) _msg debug "_pages: _last_updated en pages_tpl" if (${debug}) _msg debug _pages_msg_17 "_pages: #ytvideo presente, ejecutar _youtube: contenido de página"
"_pages: Nombres de archivo en minúsculas, siempre" if (${debug}) _msg debug "_pages: Ejecutando _cleanup" # _msg std _pages_msg_18 "_pages: Reemplazando #pagetitle, #tagline y #sitename en pages_tpl"
"Escribiendo ${www_root}/${pages_title_lower%.}.html en el disco." if (${debug}) _msg sub "- Analizando ${pages_in_array}" _pages_msg_19 "_pages: Reemplazando BODY con contenido de página en pages_tpl"
if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}" if (${debug}) _msg sub "- Listando archivo temporal de blog:" _pages_msg_20 "_pages: _last_updated en pages_tpl"
_msg std "Actualizando index.html con nuevas entradas de blog" if (${debug}) _msg sub "- Analizando ${pages_in_array}" if _pages_msg_21 "_pages: Nombres de archivos en minúsculas, siempre"
(${debug}) _msg sub "- blog_in_index = ${blog_in_index}" if (${debug}) _msg sub "- Listando archivo temporal de blog:" _msg _pages_msg_22 "_pages: Ejecutando _cleanup"
sub "- No se encontraron Páginas nuevas o actualizadas" if (${debug}) _msg debug "_blogs: Ejecutando función _list_blogs" _pages_msg_23 "- Analizando ${pages_in_array}"
_msg sub " No tienes ningún blog " _msg main "Generando Blogs" if (${debug}) _msg debug "_blogs: Ejecutando función _pages_msg_24 "- blog_in_index = ${blog_in_index}"
_blog_cache" _msg info "No se pudo encontrar la plantilla de tema para Blogs." if (${debug}) _msg debug "_blogs: Procesando _pages_msg_25 "- Listando archivo temporal de blog:"
pre-datos para ${blog}" _msg debug "_blogs: Falta metadatos de FECHA en ${blog}." if (${debug}) _msg debug "_blogs: _pages_msg_26 "Actualizando index.html con nuevas publicaciones de blog"
Agregando datos para ${blog} al array para exportar" if (${debug}) _msg debug "_blogs: Procesando ${blog}" _msg std "- _pages_msg_27 "- Analizando ${pages_in_array}"
Generando Blog: ${blog_index}.html" if (${debug}) _msg debug "_blogs: Procesando sustituciones en ${blog}" if (${debug}) _pages_msg_28 "- blog_in_index = ${blog_in_index}"
_msg debug "_blogs: Ejecutando función $engine para ${blog}" if (${debug}) _msg debug "_blogs: Comprobando #link, #showimg y _pages_msg_29 "- Listando archivo temporal de blog:"
#ytvideo en blog_content" if (${debug}) _msg debug "_blogs: #link está presente, ejecutar _link: blog_content" if (${debug}) _pages_msg_30 "- No se encontraron Páginas nuevas o actualizadas"
_msg debug "_blogs: #showimg está presente, ejecutar _link: blog_content" if (${debug}) _msg debug "_blogs: #ytvideo está _blogs_msg_1 "_blogs: Ejecutando función _list_blogs"
presente, ejecutar _link: blog_content" if (${debug}) _msg debug "_blogs: Reemplazando tagline, sitename y pagetitle" if _blogs_msg_2 "* No tienes ningún blog *"
(${debug}) _msg debug "_blogs: Creando directorio ${www_root}/${blog_dir}" if (${debug}) _msg debug "_blogs: Escribiendo _blogs_msg_3 "Generando Blogs"
blog en disco: ${www_root}${blog_url}" _msg sub "- No se encontraron Blogs nuevos o actualizados" if (${debug}) _msg sub " _blogs_msg_4 "_blogs: Ejecutando función _blog_cache"
_blogs: Ejecutando _blog_idx_for_index" if (${debug}) _msg sub "* _blogs: Ejecutando _blog_index" _msg sub "- Poblando _blogs_msg_5 "No se pudo encontrar la plantilla temática para Blogs."
${project_dir}/blog/index.tmp.html" if (${debug}) _msg debug "_blog_idx_for_index: Iniciando función" if (${debug}) _msg _blogs_msg_6 "_blogs: Procesando datos previos para ${blog}"
debug "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}" if (${debug}) _msg debug "_blog_idx_for_index: _blogs_msg_7 "_blogs: Buscando FECHA: Encontrada"
meta_str de BLOG_META_STR_ARRAY de _blogs" if (${debug}) _msg debug "_blog_idx_for_index: ${meta_str}" if (${debug}) _msg _blogs_msg_8 "_blogs: Buscando TÍTULO DEL BLOG: Encontrado"
debug "_blog_idx_for_index: Iterar sobre cada componente y extraer información" if (${debug}) _msg debug _blogs_msg_9 "* _blogs: Falta metadatos de FECHA en ${blog}."
"_blog_idx_for_index: Ejecutando ${engine} en contenido para capturar QStags en Ingress" if (${debug}) _msg debug _blogs_msg_10 "* _blogs: Falta metadatos de TÍTULO DEL BLOG en ${blog}."
"_blog_idx_for_index _blogs_msg_11 "_blogs: Añadiendo datos para ${blog} al array para exportar"
_blogs_msg_12 "_blogs: Procesando ${blog}"
_blogs_msg_13 "- Generando Blog: ${blog_index}.html"
_blogs_msg_14 "_blogs: Procesando sustituciones en ${blog}"
_blogs_msg_15 "_blogs: Ejecutando función $engine para ${blog}"
_blogs_msg_16 "_blogs: Comprobando #link, #showimg y #ytvideo en contenido del blog"
_blogs_msg_17 "_blogs: #link presente, ejecutar _link: contenido del blog"
_blogs_msg_18 "_blogs: #showimg presente, ejecutar _link: contenido del blog"
_blogs_msg_19 "_blogs: #ytvideo presente, ejecutar _link: contenido del blog"
_blogs_msg_20 "_blogs: Reemplazando tagline, sitename y pagetitle"
_blogs_msg_21 "_blogs: Creando directorio ${www_root}${blog_dir}"
_blogs_msg_22 "_blogs: Escribiendo blog en disco: ${www_root}${blog_url}"
_blogs_msg_23 "_blogs: new_updated_blogs=true"
_blogs_msg_24 "- No se encontraron Blogs nuevos o actualizados"
_blogs_msg_25 "* _blogs: Ejecutando _blog_idx_for_index"
_blogs_msg_26 "* _blogs: Ejecutando _blog_index"
_blog_idx_for_index_msg_1 "- Poblando ${project_dir}/blog/index.tmp.html"
_blog_idx_for_index_msg_2 "_blog_idx_for_index: Iniciando función"
BODY_blog_idx_for_index_msg_3 "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}"
_blog_idx_for_index_msg_4 "_blog_idx_for_index: meta_str de BLOG_META_STR_ARRAY de _blogs"
_blog_idx_for_index_msg_5 "_blog_idx_for_index: ${meta_str}"
_blog_idx_for_index_msg_6 "_blog_idx_for_index: Iterando sobre cada componente y extrayendo información"
_blog_idx_for_index_msg_7 "_blog_idx_for_index: Ejecutando ${engine} en contenido para capturar QStags en Ingress"
_blog_idx_for_index_msg_8 "_blog_idx_for_index: Escribiendo _blog_idx_for_index en archivo: ${project_dir}/blog/index.tmp.html"
_blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content = ${blog_list_content}"
_blog_index_msg_1 "_blog_index: blog_in_index=${blog_in_index}"
_blog_index_msg_2 "_blog_index: new_updated_blogs=${new_updated_blogs}"
_blog_index_msg_3 "_blog_index: Ejecutando función _blog_index"
_blog_index_msg_4 "_blog_index: blog_in_index = ${blog_in_index}"
_blog_index_msg_5 "- Generando Página: ${www_root}/blog/index.html"
_blog_index_msg_6 "_blog_index: Reemplazando sitename y tagline"
_blog_index_msg_7 "_blog_index: Reemplazando BODY con contenido de ${project_dir}/blog/index.tmp.html"
_blog_index_msg_8 "_blog_index: Escribiendo ${www_root}/blog/index.html"
_add_blog_list_to_index_msg_1 "_add_blog_list_to_index: Insertando lista de blogs en index.html"
_sitemap_msg_1 "Generando Sitemap"
_sitemap_msg_2 "Sitemap generado en ${sitemap_file}"
_link_msg_1 "_link: LÍNEA PRINCIPAL DE URL: ${line}"
_link_msg_2 "_link_ URL: ${url_dest}"
_link_msg_3 "_link: Texto: ${url_txt}"
_image_msg_1 "_image: Procesando línea: ${line}"
_youtube_msg_1 "_youtube: Procesando línea: ${line}"
_cleanup_msg_1 "_cleanup: Limpiando etiquetas en contenido"
_html_msg_1 "_html: Convirtiendo QStags en contenido"
_zhtml_msg_1 "_zhtml: Convirtiendo QStags en contenido"
)

View File

@ -1,65 +1,113 @@
typeset -A localization
localization=(
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ _msg_msg_1 "Bruk: qsgen2 add \"Nettstedsnavn\" \"sti/til/prosjekt\""
┃ Usage: _msg "" ┃ _msg_msg_2 "- Tvungen oppdatering: Genererer alt"
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ _msg_msg_3 "* %SCRIPT_NAME% kan ikke analysere dette nettstedet. Avslutter. *"
_msg_msg_4 "Vennligst installer Pandoc."
_msg_msg_5 "https://github.com/jgm/pandoc/releases"
_msg info "Bruk: qsgen2 add \"Nettstednavn\" \"/sti/til/prosjekt\"" _msg_msg_6 "Ingen gyldig generator funnet. Er du sikker på at du har valgt riktig generator i 'config'?"
_msg sub "- Tvungen oppdatering: Genererer alt" _msg_msg_7 "Bruker ${generator}-motoren for filer: ${file_ext}"
_msg debug "* ${0:t} kan ikke analysere dette nettstedet. Avslutter. *" _list_pages_msg_1 "_list_pages: Ingen sider funnet med utvidelse ${file_ext}."
_msg other "Vennligst installer Pandoc." _list_pages_msg_2 "_list_pages: Legger til fil i array: ${file}"
_msg other "https://github.com/jgm/pandoc/releases" _list_blogs_msg_3 "_list_blogs: Ingen blogginnlegg funnet."
_list_blogs_msg_4 "_list_blogs: Legger til fil i array: $file"
_blog_cache_msg_1 "_blog_cache: HASH VERDI: ${blog_cache[${name}]}"
_blog_cache_msg_2 "1. _blog_cache: ${blog_file}"
_blog_cache_msg_3 "2. _blog_cache: nåværende cache: ${current_hash}"
_msg debug "Ingen gyldig generator funnet. Er du sikker på at du har valgt riktig generator i 'config'?" if _blog_cache_msg_4 "3. _blog_cache: ny cache-fil: ${blog_file}$"
(${globaldebug}); then _msg debug "Bruker ${generator}-motoren for filer: ${file_ext}"; fi if ${debug}; then _msg debug _blog_cache_msg_5 "4. _blog_cache: ny nåværende cache: ${current_hash}"
"_list_pages: Ingen sider funnet med filtype ${file_ext}."; fi if ${debug}; then _msg debug "_list_pages: Legger til fil i _pages_cache_msg_1 "SIDERS HASH VERDI: ${pages_cache[${name}]}"
array: ${file}"; fi if ${debug}; then _msg debug "_list_blogs: Ingen bloggfiler funnet."; fi if ${debug}; then _msg debug _pages_cache_msg_2 "1. pages_cache: ${pages_cache[$file]}"
"_list_blogs: Legger til fil i array: $file"; fi if (${debug}) _msg debug "_blog_cache: HASH-VERDI: ${blog_cache[${name}]}" _pages_cache_msg_3 "1. _pages_cache: nåværende cache: ${current_hash}"
if (${debug}) _msg debug "1. _blog_cache: ${blog_file}" if (${debug}) _msg debug "2. _blog_cache: current_cache: _pages_cache_msg_4 "2. _pages_cache: sidefil: ${pages_cache[$file]}"
${current_hash}" if (${debug}) _msg debug "3. _blog_cache: new_cache_file: ${blog_file}$" if (${debug}) _msg debug "4. _pages_cache_msg_5 "2. _pages_cache: nåværende cache: ${current_hash}"
_blog_cache: new_current_cache: ${current_hash}" if (${debug}) _msg debug "SIDER HASH-VERDI: ${pages_cache[${name}]}" if _last_updated_msg_1 "_last_updated: Setter dato og versjon i bunntekst"
(${debug}) _msg debug "1. pages_cache: ${pages_cache[$file]}" if (${debug}) _msg debug "1. _pages_cache: current_cache: _last_updated_msg_1 "_last_updated: ${upd_msg}"
${current_hash}" if (${debug}) _msg debug "2. _pages_cache: pages_file: ${pages_cache[$file]}" if (${debug}) _msg debug "2. _f_last_updated_msg_1 "_f_last_updated: Setter dato og versjon i bunntekst for fil ${1}"
_pages_cache: current_cache: ${current_hash}" if (${debug}); then _msg debug "_last_updated: Setter dato og versjon i _f_last_updated_msg_2 "_f_last_updated: ${upd_msg}"
bunnteksten"; fi if (${debug}); then _msg debug "_last_updated: ${upd_msg}"; fi local upd_msg="Sist oppdatert ${today} av <a _f_last_updated_msg_3 "_f_last_updated: Filen '${1}' ble ikke funnet."
href="https://blog.kekepower.com/qsgen2.html">${QSGEN} ${VERSION}" -e "s|#updated|${upd_msg}|") if (${debug}); then _msg _pages_msg_1 "_pages: Kjører funksjon _pages_cache"
debug "_f_last_updated: Setter dato og versjon i bunnteksten til filen ${1}"; fi if (${debug}); then _msg debug _pages_msg_2 "* Du har ingen sider *"
"_f_last_updated: ${upd_msg}"; fi local upd_msg="Sist oppdatert ${today} av <a _pages_msg_3 "Genererer Sider"
href="https://blog.kekepower.com/qsgen2.html">${QSGEN} ${VERSION}" -e "s|#updated|${upd_msg}|" _pages_msg_4 "_pages: sidearray er ikke tom"
if (${debug}) _msg debug "_pages: Kjører funksjonen _pages_cache" _msg sub "* Du har ingen sider " _msg main "Genererer _pages_msg_5 "_pages: Setter Opp Sider-mal"
Sider" if (${debug}) _msg debug "_pages: pages_array er ikke tom" if (${debug}) _msg debug "_pages: Setter Sider-malen" _msg _pages_msg_6 "Kan ikke finne Sidemalen: ${pages}"
info "Kan ikke finne Sider-malen: ${pages}" if (${debug}) _msg debug "_pages: Leser inn Sider-malen i pages_tpl" _msg std "- _pages_msg_7 "_pages: Leser Sidemalen inn i pages_tpl"
Genererer Side: ${pages_in_array%.}.html" if (${debug}) _msg debug "_pages: Laster inn sideinnhold én gang - _pages_msg_8 "- Genererer Side: ${pages_in_array%.*}.html"
${pages_in_array}" if (${debug}) _msg debug "_pages: Grep etter side_tittel" if (${debug}) _msg debug "_pages: _pages_msg_9 "_pages: Laster sideinnhold en gang - ${pages_in_array}"
${page_title}" if (${debug}) _msg debug "_pages: Fjerner #tittel-linjen fra sideinnholdet" if (${debug}) _msg debug "_pages: _pages_msg_10 "_pages: Finne sidetittel"
Kjører motoren på ${pages_in_array}" if (${debug}) _msg debug "_pages: Sjekker etter #link, #showimg og #ytvideo i _pages_msg_11 "_pages: ${page_title}"
sideinnholdet" if (${debug}) _msg debug "_pages: #link er tilstede, kjør _link: sideinnholdet" if (${debug}) _msg debug _pages_msg_12 "_pages: Fjerner #tittel linje fra sideinnhold"
"_pages: #showimg er tilstede, kjør _image: sideinnholdet" if (${debug}) _msg debug "_pages: #ytvideo er tilstede, kjør _pages_msg_13 "_pages: Kjører motor på ${pages_in_array}"
_youtube: sideinnholdet" if (${debug}) _msg debug "_pages: Erstatter BODY med sideinnholdet i pages_tpl" if (${debug}) _msg _pages_msg_14 "_pages: Sjekker for #link, #showimg og #ytvideo i sideinnhold"
debug "_pages: Erstatter #sidetittel, #tagline og #nettstednavn i pages_tpl" if (${debug}) _msg debug "_pages: _last_updated _pages_msg_15 "_pages: #link er til stede, kjør _link: sideinnhold"
i pages_tpl" if (${debug}) _msg debug "_pages: Filnavn i små bokstaver, alltid" if (${debug}) _msg debug "_pages: Kjører _pages_msg_16 "_pages: #showimg er til stede, kjør _image: sideinnhold"
_cleanup" # _msg std "Skriver ${www_root}/${pages_title_lower%.}.html til disk." if (${debug}) _msg sub "- Analyserer _pages_msg_17 "_pages: #ytvideo er til stede, kjør _youtube: sideinnhold"
${pages_in_array}" if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}" if (${debug}) _msg sub "- List opp _pages_msg_18 "_pages: Erstatter #sidetittel, #tagline og #sidenavn i pages_tpl"
midlertidig bloggfil:" _msg std "Oppdaterer index.html med nye blogginnlegg" if (${debug}) _msg sub "- Analyserer _pages_msg_19 "_pages: Erstatter BODY med sideinnhold i pages_tpl"
${pages_in_array}" if (${debug}) _msg sub "- blog_in_index = ${blog_in_index}" if (${debug}) _msg sub "- List opp _pages_msg_20 "_pages: _last_updated i pages_tpl"
midlertidig bloggfil:" _msg sub "- Ingen nye eller oppdaterte Sider funnet" if (${debug}) _msg debug "_blogs: Kjører _pages_msg_21 "_pages: Filnavn i små bokstaver, alltid"
funksjonen _list_blogs" _msg sub " Du har ingen blogger " _msg main "Genererer Blogger" if (${debug}) _msg debug "_blogs: _pages_msg_22 "_pages: Kjører _cleanup"
Kjører funksjonen _blog_cache" _msg info "Kan ikke finne temamalen for Blogger." if (${debug}) _msg debug "_blogs: Behandler _pages_msg_23 "- Analyserer ${pages_in_array}"
pre-data for ${blog}" _msg debug "_blogs: DATO-metadata mangler i ${blog}." if (${debug}) _msg debug "_blogs: Legger til _pages_msg_24 "- blog_in_index = ${blog_in_index}"
data for ${blog} i array for eksport" if (${debug}) _msg debug "_blogs: Behandler ${blog}" _msg std "- Genererer Blogg: _pages_msg_25 "- Lister opp blogg midlertidig fil:"
${blog_index}.html" if (${debug}) _msg debug "_blogs: Behandler erstatninger i ${blog}" if (${debug}) _msg debug "_blogs: _pages_msg_26 "Oppdaterer index.html med nye blogginnlegg"
Kjører funksjonen $engine for ${blog}" if (${debug}) _msg debug "_blogs: Sjekker etter #link, #showimg og #ytvideo i _pages_msg_27 "- Analyserer ${pages_in_array}"
blogginnholdet" if (${debug}) _msg debug "_blogs: #link er tilstede, kjør _link: blogginnholdet" if (${debug}) _msg debug _pages_msg_28 "- blog_in_index = ${blog_in_index}"
"_blogs: #showimg er tilstede, kjør _link: blogginnholdet" if (${debug}) _msg debug "_blogs: #ytvideo er tilstede, kjør _pages_msg_29 "- Lister opp blogg midlertidig fil:"
_link: blogginnholdet" if (${debug}) _msg debug "_blogs: Erstatter tagline, nettstednavn og sidetittel" if (${debug}) _msg _pages_msg_30 "- Ingen nye eller oppdaterte Sider funnet"
debug "_blogs: Oppretter katalogen ${www_root}/${blog_dir}" if (${debug}) _msg debug "_blogs: Skriver blogg til disk: _blogs_msg_1 "_blogs: Kjører funksjon _list_blogs"
${www_root}${blog_url}" _msg sub "- Ingen nye eller oppdaterte Blogger funnet" if (${debug}) _msg sub " _blogs: Kjører _blogs_msg_2 "* Du har ingen blogger *"
_blog_idx_for_index" if (${debug}) _msg sub "* _blogs: Kjører _blog_index" _msg sub "- Fyller _blogs_msg_3 "Genererer Blogger"
${project_dir}/blog/index.tmp.html" if (${debug}) _msg debug "_blog_idx_for_index: Starter funksjonen" if (${debug}) _msg _blogs_msg_4 "_blogs: Kjører funksjon _blog_cache"
debug "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}" if (${debug}) _msg debug "_blog_idx_for_index: _blogs_msg_5 "Kan ikke finne tema mal for Blogger."
meta_str fra BLOG_META_STR_ARRAY fra _blogs" if (${debug}) _msg debug "_blog_idx_for_index: ${meta_str}" if (${debug}) _msg _blogs_msg_6 "_blogs: Behandler forhåndsdata for ${blog}"
debug "_blog_idx_for_index: Gå gjenn _blogs_msg_7 "_blogs: Leter etter DATO: Funnet"
_blogs_msg_8 "_blogs: Leter etter BLOGGTITTEL: Funnet"
_blogs_msg_9 "* _blogs: DATO-metadata mangler i ${blog}."
_blogs_msg_10 "* _blogs: BLOGGTITTEL-metadata mangler i ${blog}."
_blogs_msg_11 "_blogs: Legger til data for ${blog} til array for eksport"
_blogs_msg_12 "_blogs: Behandler ${blog}"
_blogs_msg_13 "- Genererer Blogg: ${blog_index}.html"
_blogs_msg_14 "_blogs: Behandler erstatninger i ${blog}"
_blogs_msg_15 "_blogs: Kjører funksjon $engine for ${blog}"
_blogs_msg_16 "_blogs: Sjekker for #link, #showimg og #ytvideo i blogginnhold"
_blogs_msg_17 "_blogs: #link er til stede, kjør _link: blogginnhold"
_blogs_msg_18 "_blogs: #showimg er til stede, kjør _link: blogginnhold"
_blogs_msg_19 "_blogs: #ytvideo er til stede, kjør _link: blogginnhold"
_blogs_msg_20 "_blogs: Erstatter tagline, sitenavn og sidetittel"
_blogs_msg_21 "_blogs: Oppretter katalog ${www_root}${blog_dir}"
_blogs_msg_22 "_blogs: Skriver blogg til disk: ${www_root}${blog_url}"
_blogs_msg_23 "_blogs: new_updated_blogs=true"
_blogs_msg_24 "- Ingen nye eller oppdaterte Blogger funnet"
_blogs_msg_25 "* _blogs: Kjører _blog_idx_for_index"
_blogs_msg_26 "* _blogs: Kjører _blog_index"
_blog_idx_for_index_msg_1 "- Fyller ${project_dir}/blog/index.tmp.html"
_blog_idx_for_index_msg_2 "_blog_idx_for_index: Starter funksjon"
_blog_idx_for_index_msg_3 "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}"
_blog_idx_for_index_msg_4 "_blog_idx_for_index: meta_str fra BLOG_META_STR_ARRAY fra _blogs"
_blog_idx_for_index_msg_5 "_blog_idx_for_index: ${meta_str}"
_blog_idx_for_index_msg_6 "_blog_idx_for_index: Går gjennom hver komponent og trekker ut informasjon"
_blog_idx_for_index_msg_7 "_blog_idx_for_index: Kjører ${engine} på innhold for å fange QStags i Ingress"
_blog_idx_for_index_msg_8 "_blog_idx_for_index: Skriver _blog_idx_for_index til fil: ${project_dir}/blog/index.tmp.html"
_blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content = ${blog_list_content}"
_blog_index_msg_1 "_blog_index: blog_in_index=${blog_in_index}"
_blog_index_msg_2 "_blog_index: new_updated_blogs=${new_updated_blogs}"
_blog_index_msg_3 "_blog_index: Kjører funksjon _blog_index"
_blog_index_msg_4 "_blog_index: blog_in_index = ${blog_in_index}"
_blog_index_msg_5 "- Genererer Side: ${www_root}/blog/index.html"
_blog_index_msg_6 "_blog_index: Erstatter sitenavn og tagline"
_blog_index_msg_7 "_blog_index: Erstatter BODY med innhold fra ${project_dir}/blog/index.tmp.html"
_blog_index_msg_8 "_blog_index: Skriver ${www_root}/blog/index.html"
_add_blog_list_to_index_msg_1 "_add_blog_list_to_index: Setter inn bloggliste i index.html"
_sitemap_msg_1 "Genererer Nettsidekart"
_sitemap_msg_2 "Nettsidekart generert på ${sitemap_file}"
_link_msg_1 "_link: HOVED URL-LINJE: ${line}"
_link_msg_2 "_link_ URL: ${url_dest}"
_link_msg_3 "_link: Tekst: ${url_txt}"
_image_msg_1 "_image: Behandler linje: ${line}"
_youtube_msg_1 "_youtube: Behandler linje: ${line}"
_cleanup_msg_1 "_cleanup: Renser opp i merker i innhold"
_html_msg_1 "_html: Konverterer QStags i innhold"
_zhtml_msg_1 "_zhtml: Konverterer QStags i innhold"
)

65
qsgen2
View File

@ -19,9 +19,10 @@ QSGEN="Quick Site Generator 2"
globaldebug=false globaldebug=false
# Use Zsh fpath to set the path to some extra functions # Use Zsh fpath to set the path to some extra functions
fpath=(${HOME}/bin/include/common ${HOME}/.config/qsgen2/plugins $fpath) fpath=(${HOME}/bin/include/common ${HOME}/.config/qsgen2/lang $fpath)
# In this case, let's load the 'include' function # In this case, let's load the 'include' function
autoload include autoload include
autoload ${language}
# Including some colors to the script # Including some colors to the script
include common/colors include common/colors
@ -126,34 +127,44 @@ blog_cache_file="${project_dir}/.blog_cache"
pages_cache_file="${project_dir}/.pages_cache" pages_cache_file="${project_dir}/.pages_cache"
function _msg() { function _msg() {
# Use this function to write out messages based on their type # Usage: _msg <type> "key"
# Types are: std=green - info=yellow - debug=red other=bold_yellow local type=$1
# Usage: _msg <type> "<message>" local key=$2
local msg=${localization[$key]}
case ${1} in # Check if message exists for the key
std) if [[ -z "$msg" ]]; then
echo "${yellow}${2}${end}" echo "Localization key '$key' not found."
;; return
info) fi
echo "${green}${2}${end}"
;;
debug)
echo "${red}${2}${end}"
;;
other)
echo "${bold_yellow}${2}${end}"
;;
sub)
echo "${magenta}${2}${end}"
;;
main)
echo "${white}${green_bg} ${2} ${end}"
;;
*)
echo "${2}"
;;
esac
# Dynamic replacement for known placeholders
msg=${msg//"%SCRIPT_NAME%"/${0:t}}
# Apply color formatting based on type
case ${type} in
std)
echo -e "${green}${msg}${end}"
;;
info)
echo -e "${yellow}${msg}${end}"
;;
debug)
echo -e "${red}${msg}${end}"
;;
other)
echo -e "${bold_yellow}${msg}${end}"
;;
sub)
echo -e "${magenta}${msg}${end}"
;;
main)
echo -e "${white}${green_bg} ${msg} ${end}"
;;
*)
echo -e "${msg}"
;;
esac
} }
case ${1} in case ${1} in