From 3caae5c274ba4f08468d5047ceeb91c8c3edce55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Wed, 14 Feb 2024 17:32:49 +0100 Subject: [PATCH] qsgen2: Updates towards complete localization. Update to version 0.4.0 beta 1. --- include/qsgen2/lang/en_US | 6 +- include/qsgen2/lang/es_ES | 174 ++++++++++++++++++----------------- include/qsgen2/lang/nb_NO | 5 +- qsgen2 | 189 +++++++++++++++++++------------------- 4 files changed, 186 insertions(+), 188 deletions(-) diff --git a/include/qsgen2/lang/en_US b/include/qsgen2/lang/en_US index 4a99f05..5e3e531 100644 --- a/include/qsgen2/lang/en_US +++ b/include/qsgen2/lang/en_US @@ -1,4 +1,3 @@ -typeset -A qsgenlang qsgenlang=( _qsgen2_msg_2 "- Forced Update: Generating Everything" _qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *" @@ -54,12 +53,11 @@ _pages_msg_21 "_pages: Lowercase filnames, always" _pages_msg_22 "_pages: Running _cleanup" _pages_msg_23 "- Parsing" _pages_msg_24 "- blog_in_index =" -_pages_msg_25 "- Listing blog temp file:" +_pages_msg_25 "- Printing blog temp file:" _pages_msg_26 "Updating index.html with new blog posts" _pages_msg_27 "- Parsing" _pages_msg_28 "- blog_in_index =" -_pages_msg_29 "- Listing blog temp file:" -_pages_msg_30 "- No new or updated Pages found" +_pages_msg_29 "- No new or updated Pages found" _blogs_msg_1 "_blogs: Running function _list_blogs" _blogs_msg_2 "* You do not have any blogs *" _blogs_msg_3 "Generating Blogs" diff --git a/include/qsgen2/lang/es_ES b/include/qsgen2/lang/es_ES index 91cf5cc..b129b2f 100644 --- a/include/qsgen2/lang/es_ES +++ b/include/qsgen2/lang/es_ES @@ -1,114 +1,118 @@ -typeset -A qsgenlang qsgenlang=( _qsgen2_msg_2 "- Actualización forzada: Generando todo" _qsgen2_msg_3 "* %SCRIPT_NAME% no puede analizar este sitio. Saliendo. *" -_qsgen2_msg_4 "Por favor instala Pandoc." -_qsgen2_msg_5 "No se encontró un generador válido. ¿Estás seguro de haber seleccionado el generador correcto en 'config'?" -_qsgen2_msg_6 "Usando el motor ${generator} para archivos: ${file_ext}" +_qsgen2_msg_4 "Por favor, instala Pandoc." +_qsgen2_msg_5 "No se encontró un generador válido. ¿Estás seguro de que has seleccionado el generador correcto en 'config'?" +_qsgen2_msg_6 "Usando el" +_qsgen2_msg_6.1 "-motor para archivos:" _qsgen2_msg_7 "- Creado por kekePower - 2018-" -_qsgen2_msg_8 "- Consulta '${1} help' para más información." -_qsgen2_msg_9 "Contenido del archivo de configuración:" -_list_pages_msg_1 "_list_pages: No se encontraron páginas con extensión ${file_ext}." -_list_pages_msg_2 "_list_pages: Añadiendo archivo al array: ${file}" -_list_blogs_msg_3 "_list_blogs: No se encontraron blogs." -_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}$" -_blog_cache_msg_5 "4. _blog_cache: nuevo caché actual: ${current_hash}" -_pages_cache_msg_1 "VALOR HASH DE PÁGINAS: ${pages_cache[${name}]}" -_pages_cache_msg_2 "1. pages_cache: ${pages_cache[$file]}" -_pages_cache_msg_3 "1. _pages_cache: caché actual: ${current_hash}" -_pages_cache_msg_4 "2. _pages_cache: archivo de páginas: ${pages_cache[$file]}" -_pages_cache_msg_5 "2. _pages_cache: caché actual: ${current_hash}" +_qsgen2_msg_8 "- Ver" +_qsgen2_msg_8.1 "para más información." +_qsgen2_msg_9 "Contenidos del archivo Config:" +_list_pages_msg_1 "_list_pages: No se encontraron páginas con ext" +_list_pages_msg_2 "_list_pages: Añadiendo archivo al array:" +_list_blogs_msg_1 "_list_blogs: No se encontraron archivos de blog." +_list_blogs_msg_2 "_list_blogs: Añadiendo archivo al array:" +_blog_cache_msg_1 "_blog_cache: VALOR HASH:" +_blog_cache_msg_2 "1. _blog_cache:" +_blog_cache_msg_3 "2. _blog_cache: cache_actual:" +_blog_cache_msg_4 "3. _blog_cache: nuevo_archivo_cache:" +_blog_cache_msg_5 "4. _blog_cache: nueva_cache_actual:" +_pages_cache_msg_1 "VALOR HASH PÁGINAS:" +_pages_cache_msg_2 "1. pages_cache:" +_pages_cache_msg_3 "1. _pages_cache: cache_actual:" +_pages_cache_msg_4 "2. _pages_cache: archivo_páginas:" +_pages_cache_msg_5 "2. _pages_cache: cache_actual:" _last_updated_msg_1 "_last_updated: Estableciendo fecha y versión en el pie de página" -_last_updated_msg_1 "_last_updated: ${upd_msg}" -_f_last_updated_msg_1 "_f_last_updated: Estableciendo fecha y versión en el pie de página del archivo ${1}" -_f_last_updated_msg_2 "_f_last_updated: ${upd_msg}" -_f_last_updated_msg_3 "_f_last_updated: Archivo '${1}' no encontrado." +_last_updated_msg_1 "_last_updated:" +_f_last_updated_msg_1 "_f_last_updated: Estableciendo fecha y versión en el pie de página del archivo" +_f_last_updated_msg_2 "_f_last_updated:" +_f_last_updated_msg_3 "_f_last_updated: Archivo" +_f_last_updated_msg_3.1 "no encontrado." _pages_msg_1 "_pages: Ejecutando función _pages_cache" _pages_msg_2 "* No tienes ninguna página *" _pages_msg_3 "Generando Páginas" -_pages_msg_4 "_pages: el array de páginas no está vacío" +_pages_msg_4 "_pages: array_de_páginas no está vacío" _pages_msg_5 "_pages: Estableciendo plantilla de Páginas" -_pages_msg_6 "No se pudo encontrar la plantilla de Páginas: ${pages}" -_pages_msg_7 "_pages: Leyendo la plantilla de Páginas en pages_tpl" -_pages_msg_8 "- Generando Página: ${pages_in_array%.*}.html" -_pages_msg_9 "_pages: Cargando contenido de página una vez - ${pages_in_array}" -_pages_msg_10 "_pages: Encontrando título de página" -_pages_msg_11 "_pages: ${page_title}" -_pages_msg_12 "_pages: Eliminando línea #title del contenido de página" -_pages_msg_13 "_pages: Ejecutando motor en ${pages_in_array}" -_pages_msg_14 "_pages: Comprobando #link, #showimg y #ytvideo en contenido de página" -_pages_msg_15 "_pages: #link presente, ejecutar _link: contenido de página" -_pages_msg_16 "_pages: #showimg presente, ejecutar _image: contenido de página" -_pages_msg_17 "_pages: #ytvideo presente, ejecutar _youtube: contenido de página" -_pages_msg_18 "_pages: Reemplazando #pagetitle, #tagline y #sitename en pages_tpl" -_pages_msg_19 "_pages: Reemplazando BODY con contenido de página en pages_tpl" +_pages_msg_6 "No se puede encontrar la plantilla de Páginas:" +_pages_msg_7 "_pages: Leyendo plantilla de Páginas en pages_tpl" +_pages_msg_8 "- Generando Página:" +_pages_msg_9 "_pages: Cargando contenido de la página una vez -" +_pages_msg_10 "_pages: Buscando título de página" +_pages_msg_11 "_pages:" +_pages_msg_12 "_pages: Eliminando línea #título del contenido de la página" +_pages_msg_13 "_pages: Ejecutando motor en" +_pages_msg_14 "_pages: Verificando #link, #showimg y #ytvideo en contenido de la página" +_pages_msg_15 "_pages: #link presente, ejecutar _link: contenido de la página" +_pages_msg_16 "_pages: #showimg presente, ejecutar _image: contenido de la página" +_pages_msg_17 "_pages: #ytvideo presente, ejecutar _youtube: contenido de la página" +_pages_msg_18 "_pages: Reemplazando #tituloDePagina, #tagline y #nombreDeSitio en pages_tpl" +_pages_msg_19 "_pages: Reemplazando CUERPO con contenido de la página en pages_tpl" _pages_msg_20 "_pages: _last_updated en pages_tpl" -_pages_msg_21 "_pages: Nombres de archivos en minúsculas, siempre" +_pages_msg_21 "_pages: Nombres de archivo en minúsculas, siempre" _pages_msg_22 "_pages: Ejecutando _cleanup" -_pages_msg_23 "- Analizando ${pages_in_array}" -_pages_msg_24 "- blog_in_index = ${blog_in_index}" -_pages_msg_25 "- Listando archivo temporal de blog:" +_pages_msg_23 "- Analizando" +_pages_msg_24 "- blog_en_indice =" +_pages_msg_25 "- Imprimiendo archivo temporal del blog:" _pages_msg_26 "Actualizando index.html con nuevas publicaciones de blog" -_pages_msg_27 "- Analizando ${pages_in_array}" -_pages_msg_28 "- blog_in_index = ${blog_in_index}" -_pages_msg_29 "- Listando archivo temporal de blog:" -_pages_msg_30 "- No se encontraron Páginas nuevas o actualizadas" +_pages_msg_27 "- Analizando" +_pages_msg_28 "- blog_en_indice =" +_pages_msg_29 "- No se encontraron nuevas o actualizadas Páginas" _blogs_msg_1 "_blogs: Ejecutando función _list_blogs" _blogs_msg_2 "* No tienes ningún blog *" _blogs_msg_3 "Generando Blogs" _blogs_msg_4 "_blogs: Ejecutando función _blog_cache" -_blogs_msg_5 "No se pudo encontrar la plantilla temática para Blogs." -_blogs_msg_6 "_blogs: Procesando datos previos para ${blog}" -_blogs_msg_7 "_blogs: Buscando FECHA: Encontrada" +_blogs_msg_5 "No se puede encontrar la plantilla de tema para Blogs." +_blogs_msg_6 "_blogs: Procesando datos previos para" +_blogs_msg_7 "_blogs: Buscando FECHA: Encontrado" _blogs_msg_8 "_blogs: Buscando TÍTULO DEL BLOG: Encontrado" -_blogs_msg_9 "* _blogs: Falta metadatos de FECHA en ${blog}." -_blogs_msg_10 "* _blogs: Falta metadatos de TÍTULO DEL BLOG en ${blog}." -_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_9 "* _blogs: Falta metadatos de FECHA en" +_blogs_msg_10 "* _blogs: Falta metadatos de TÍTULO DEL BLOG en" +_blogs_msg_11 "_blogs: Añadiendo datos para" +_blogs_msg_11.1 "al array para exportar" +_blogs_msg_12 "_blogs: Procesando" +_blogs_msg_13 "- Generando Blog:" +_blogs_msg_14 "_blogs: Procesando sustitutos en" +_blogs_msg_15 "_blogs: Ejecutando función $engine para" +_blogs_msg_16 "_blogs: Verificando #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_20 "_blogs: Reemplazando tagline, nombreDeSitio y tituloDePagina" +_blogs_msg_21 "_blogs: Creando directorio" +_blogs_msg_22 "_blogs: Escribiendo blog en disco:" +_blogs_msg_23 "_blogs: blogs_actualizados=true" +_blogs_msg_24 "- No se encontraron nuevos o actualizados Blogs" _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_1 "- Llenando" _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_3 "_blog_idx_for_index: 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_idx_for_index_msg_5 "_blog_idx_for_index:" +_blog_idx_for_index_msg_6 "_blog_idx_for_index: Iterar sobre cada componente y extraer información" +_blog_idx_for_index_msg_7 "_blog_idx_for_index: Ejecutando" +_blog_idx_for_index_msg_7.1 "en contenido para capturar QStags en Ingress" +_blog_idx_for_index_msg_8 "_blog_idx_for_index: Escribiendo _blog_idx_for_index en archivo:" +_blog_idx_for_index_msg_9 "_blog_idx_for_index: contenido_de_lista_de_blogs =" +_blog_index_msg_1 "_blog_index: blog_en_indice=" +_blog_index_msg_2 "_blog_index: blogs_actualizados=" _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" +_blog_index_msg_4 "_blog_index: blog_en_indice =" +_blog_index_msg_5 "- Generando Página:" +_blog_index_msg_6 "_blog_index: Reemplazando nombreDeSitio y tagline" +_blog_index_msg_7 "_blog_index: Reemplazando CUERPO con contenido de" +_blog_index_msg_8 "_blog_index: Escribiendo" +_blog_index_msg_9 "_blog_index: Longitud de contenido de blog_index_content:" _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}" +_sitemap_msg_1 "Generando Mapa del Sitio" +_sitemap_msg_2 "Mapa del sitio generado en" +_link_msg_1 "_link: LÍNEA URL_PRINCIPAL:" +_link_msg_2 "_link_ URL:" +_link_msg_3 "_link: Texto:" +_image_msg_1 "_image: Procesando línea:" +_youtube_msg_1 "_youtube: Procesando línea:" _cleanup_msg_1 "_cleanup: Limpiando etiquetas en contenido" _html_msg_1 "_html: Convirtiendo QStags en contenido" _zhtml_msg_1 "_zhtml: Convirtiendo QStags en contenido" -) +) \ No newline at end of file diff --git a/include/qsgen2/lang/nb_NO b/include/qsgen2/lang/nb_NO index 0c4c33f..6542344 100644 --- a/include/qsgen2/lang/nb_NO +++ b/include/qsgen2/lang/nb_NO @@ -52,12 +52,11 @@ _pages_msg_21 "_pages: Filnavn i små bokstaver, alltid" _pages_msg_22 "_pages: Kjører _cleanup" _pages_msg_23 "- Analyserer" _pages_msg_24 "- blog_in_index =" -_pages_msg_25 "- Lister opp blogg midlertidig fil:" +_pages_msg_25 "- Skriver ut blogg midlertidig fil:" _pages_msg_26 "Oppdaterer index.html med nye blogginnlegg" _pages_msg_27 "- Analyserer" _pages_msg_28 "- blog_in_index =" -_pages_msg_29 "- Lister opp blogg midlertidig fil:" -_pages_msg_30 "- Ingen nye eller oppdaterte Sider funnet" +_pages_msg_29 "- Ingen nye eller oppdaterte Sider funnet" _blogs_msg_1 "_blogs: Kjører funksjon _list_blogs" _blogs_msg_2 "* Du har ingen blogger *" _blogs_msg_3 "Genererer Blogger" diff --git a/qsgen2 b/qsgen2 index 59d497c..16d6f2b 100755 --- a/qsgen2 +++ b/qsgen2 @@ -10,7 +10,7 @@ # https://github.com/kekePower/qsgen2/ # -VERSION="0.4.0 beta" # Wed-2024-02-14 +VERSION="0.4.0 beta 1" # Wed-2024-02-14 QSGEN="Quick Site Generator 2" # Set to true or false @@ -120,6 +120,7 @@ function _version() { } function _help() { + # This will also be translated some time in the future echo "This is where I'll write the Help documentation." exit } @@ -345,10 +346,10 @@ function _last_updated() { local debug=${globaldebug:-false} - 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 ${QSGEN} ${VERSION}" + + if (${debug}); then _msg debug "${0:t}_msg_1"; fi + if (${debug}); then _msg debug "${0:t}_msg_2" " ${upd_msg}"; fi local content="${1}" @@ -370,8 +371,8 @@ function _f_last_updated() { local upd_msg="Last updated ${today} by ${QSGEN} ${VERSION}" if ${debug}; then - _msg debug "_f_last_updated: Setting date and version in footer of file ${1}" - _msg debug "_f_last_updated: ${upd_msg}" + _msg debug "${0:t}_msg_1" " ${1}" + _msg debug "${0:t}_msg_2" " ${upd_msg}" fi # Read the file content into a variable @@ -383,7 +384,7 @@ function _f_last_updated() { if [[ -f "${1}" ]]; then sed -i -e "s|#updated|${upd_msg}|" "${1}" else - _msg debug "_f_last_updated: File '${1}' not found." + _msg debug "${0:t}_msg_3" " '${1}' " "${0:t}_msg_3.1" fi } @@ -409,44 +410,44 @@ function _pages() { local debug=${globaldebug:-false} # Load the cache for Pages - if (${debug}) _msg debug "_pages: Running function _pages_cache" + if (${debug}) _msg debug "${0:t}_msg_1" _pages_cache if [[ ${no_pages_found} == "true" ]]; then - _msg sub "* You do not have any pages *" + _msg sub "${0:t}_msg_1" return fi - _msg main "Generating Pages" + _msg main "${0:t}_msg_3" if (( ${#pages_array[@]} > 0 )); then # If pages_array is not empty, we do work - if (${debug}) _msg debug "_pages: pages_array is not empty" + if (${debug}) _msg debug "${0:t}_msg_4" for pages_in_array in ${pages_array[@]} do - if (${debug}) _msg debug "_pages: Setting Pages template" + if (${debug}) _msg debug "${0:t}_msg_5" local pages=${project_dir}/themes/${theme}/pages.tpl # Let's check if we can access the pages.tpl file. # It not, exit script. if [[ ! -f ${pages} ]]; then - _msg info "Unable to find the Pages template: ${pages}" + _msg info "${0:t}_msg_6" " ${pages}" exit else # Read template once - if (${debug}) _msg debug "_pages: Reading Pages template into pages_tpl" + if (${debug}) _msg debug "${0:t}_msg_7" local pages_tpl="$(<${pages})" fi - _msg std "- Generating Page: ${pages_in_array%.*}.html" + _msg std "${0:t}_msg_8" " ${pages_in_array%.*}.html" # Read the file once - if (${debug}) _msg debug "_pages: Loading page_content once - ${pages_in_array}" + if (${debug}) _msg debug "${0:t}_msg_9" " ${pages_in_array}" local page_content="$(<${pages_in_array})" # Grab the title from the Page - if (${debug}) _msg debug "_pages: Finding page_title" + if (${debug}) _msg debug "${0:t}_msg_10" if [[ ${generator} == "native" ]]; then while read -r line do @@ -469,28 +470,28 @@ function _pages() { fi done <<< ${page_content} fi - if (${debug}) _msg debug "_pages: ${page_title}" + if (${debug}) _msg debug "${0:t}_msg_11" " ${page_title}" # Remove the #title line from the buffer. No longer needed. - if (${debug}) _msg debug "_pages: Removing #title line from page_content" + if (${debug}) _msg debug "${0:t}_msg_12" page_content=$( echo ${page_content} | grep -v \#title ) # HTML'ify the page content - if (${debug}) _msg debug "_pages: Running engine on ${pages_in_array}" + if (${debug}) _msg debug "${0:t}_msg_13" " ${pages_in_array}" if [[ ${generator} == "native" ]]; then page_content=$( ${engine} "$page_content" ) # Look for links, images and videos and convert them if present. - if (${debug}) _msg debug "_pages: Checking for #link, #showimg and #ytvideo in page_content" + if (${debug}) _msg debug "${0:t}_msg_14" if [[ $( echo ${page_content} | grep \#link ) ]]; then - if (${debug}) _msg debug "_pages: #link is present, run _link: page_content" + 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 "_pages: #showimg is present, run _image: page_content" + 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 "_pages: #ytvideo is present, run _youtube: page_content" + if (${debug}) _msg debug "${0:t}_msg_17" page_content=$( _youtube "${page_content}" ) fi elif [[ ${generator} == "markdown" ]]; then @@ -498,23 +499,23 @@ function _pages() { fi # Replace every #pagetitle in pages_tpl - if (${debug}) _msg debug "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl" + if (${debug}) _msg debug "${0:t}_msg_18" pages_tpl=$(echo "${pages_tpl}" | perl -pe "s|#pagetitle|${page_title}|gs; s|#tagline|${site_tagline}|gs; s|#sitename|${site_name}|gs") - if (${debug}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl" + if (${debug}) _msg debug "${0:t}_msg_19" # Use awk for multi-line and special character handling pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") ) # Replace #updated with today's date and #version with Name and Version to footer - if (${debug}) _msg debug "_pages: _last_updated in pages_tpl" + if (${debug}) _msg debug "${0:t}_msg_20" pages_tpl=$( _last_updated ${pages_tpl} ) # Always use lowercase for file names - if (${debug}) _msg debug "_pages: Lowercase filnames, always" + if (${debug}) _msg debug "${0:t}_msg_21" pages_title_lower=$( _file_to_lower "${pages_in_array}" ) # Clean up unused tags, if any - if (${debug}) _msg debug "_pages: Running _cleanup" + if (${debug}) _msg debug "${0:t}_msg_22" pages_tpl=$( _cleanup "${pages_tpl}" ) # Write pages_tpl to disk @@ -524,9 +525,9 @@ function _pages() { # Insert the blog to the front page is blog_in_index is true and the file in the array is index.file_ext # and if index.tmp.html exist and is not empty if [[ ${pages_in_array} == "index.${file_ext}" && ${blog_in_index} == "true" && -s "${project_dir}/blog/index.tmp.html" ]]; then - 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:" + if (${debug}) _msg sub "${0:t}_msg_23" " ${pages_in_array}" + if (${debug}) _msg sub "${0:t}_msg_24" " ${blog_in_index}" + if (${debug}) _msg sub "${0:t}_msg_25" if (${debug}) ls -l ${project_dir}/blog/index.tmp.html _add_blog_list_to_index fi @@ -539,15 +540,15 @@ function _pages() { # Insert the blog to the front page is blog_in_index is true and the file in the array is index.file_ext # and if index.tmp.html exist and is not empty if [[ ${blog_in_index} == "true" && -s "${project_dir}/blog/index.tmp.html" ]]; then - _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 std "${0:t}_msg_26" + if (${debug}) _msg sub "${0:t}_msg_27" " ${pages_in_array}" + if (${debug}) _msg sub "${0:t}_msg_28" " ${blog_in_index}" + if (${debug}) _msg sub "${0:t}_msg_25" if (${debug}) ls -l ${project_dir}/blog/index.tmp.html _add_blog_list_to_index fi - _msg sub "- No new or updated Pages found" + _msg sub "${0:t}_msg_29" export new_updated_pages=false fi @@ -560,18 +561,18 @@ function _blogs() { local debug=${globaldebug:-false} # Running function _list_blogs - if (${debug}) _msg debug "_blogs: Running function _list_blogs" + if (${debug}) _msg debug "${0:t}_msg_1" _list_blogs if [[ ${no_blogs_found} == "true" ]]; then - _msg sub "* You do not have any blogs *" + _msg sub "${0:t}_msg_2" return fi - _msg main "Generating Blogs" + _msg main "${0:t}_msg_3" # Running function _blog_cache - if (${debug}) _msg debug "_blogs: Running function _blog_cache" + if (${debug}) _msg debug "${0:t}_msg_4" _blog_cache if (( ${#make_blog_array[@]} > 0 )); then @@ -584,13 +585,13 @@ function _blogs() { if [[ -f ${project_dir}/themes/${theme}/blogs.tpl ]]; then local blog_tpl=$(<"${project_dir}/themes/${theme}/blogs.tpl") else - _msg info "Unable to find theme template for Blogs." + _msg info "${0:t}_msg_5" exit fi for blog in "${make_blog_array[@]}"; do - if (${debug}) _msg debug "_blogs: Processing pre-data for ${blog}" + if (${debug}) _msg debug "${0:t}_msg_6" " ${blog}" local content="$(<"${blog}")" local sdate btitle ingress body blog_index blog_dir blog_url @@ -604,12 +605,12 @@ function _blogs() { do # Check for the DATE line if [[ "${line}" == "DATE "* ]]; then - if (${debug}) _msg debug "_blogs: Looking for DATE: Found" + if (${debug}) _msg debug "${0:t}_msg_7" date_found=true fi # Check for the BLOG_TITLE line if [[ "${line}" == "BLOG_TITLE "* ]]; then - if (${debug}) _msg debug "_blogs: Looking for BLOG_TITLE: Found" + if (${debug}) _msg debug "${0:t}_msg_8" title_found=true fi # If both DATE and BLOG_TITLE are found, no need to continue checking @@ -620,17 +621,15 @@ function _blogs() { # Check if DATE or BLOG_TITLE metadata is missing and log message if [[ "${date_found}" == false ]]; then - _msg debug "* _blogs: DATE metadata missing in ${blog}." + _msg debug "${0:t}_msg_9" " ${blog}." continue # Skip this file and move to the next fi if [[ "${title_found}" == false ]]; then - _msg debug "* _blogs: BLOG_TITLE metadata missing in ${blog}." + _msg debug "${0:t}_msg_10" " ${blog}." continue # Skip this file and move to the next fi # Extract blog information - # sed -i "s/GETDATE/${blogdate}/" ${blog} - # Array sdate = Name day=1, Year=2, Month=3, Number day=4 sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) ) if [[ ${generator} == "native" ]]; then while IFS= read -r line; do @@ -657,19 +656,19 @@ function _blogs() { blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" blog_url="${blog_dir}/${blog_index}.html" - if (${debug}) _msg debug "_blogs: Adding data for ${blog} to array to export" + if (${debug}) _msg debug "${0:t}_msg_11" " ${blog} " "${0:t}_msg_11.1" # Concatenate all metadata into a single string for the current blog local metadata_str="SDATE: ${sdate[@]}||BTITLE: ${btitle}||INGRESS: ${ingress}||URL: ${blog_url}" # Append this metadata string to the array BLOG_META_STR_ARRAY+=("${metadata_str}") - if (${debug}) _msg debug "_blogs: Processing ${blog}" + if (${debug}) _msg debug "${0:t}_msg_12" " ${blog}" - _msg std "- Generating Blog: ${blog_index}.html" + _msg std "${0:t}_msg_13" " ${blog_index}.html" # Prepare the blog template - if (${debug}) _msg debug "_blogs: Processing substitutes in ${blog}" + if (${debug}) _msg debug "${0:t}_msg_14" " ${blog}" local blog_content=$( echo "${blog_tpl}" | \ perl -pe "\ @@ -683,21 +682,21 @@ function _blogs() { blog_content="${blog_content//CALMONTH/${sdate[3]}}" blog_content="${blog_content//CALADAY/${sdate[1]}}" - if (${debug}) _msg debug "_blogs: Running function $engine for ${blog}" + if (${debug}) _msg debug "${0:t}_msg_15" " ${blog}" if [[ ${generator} == "native" ]]; then blog_content=$( ${engine} "${blog_content}" ) # Look for links, images and videos and convert them if present. - if (${debug}) _msg debug "_blogs: Checking for #link, #showimg and #ytvideo in blog_content" + if (${debug}) _msg debug "${0:t}_msg_16" if [[ $( echo ${blog_content} | grep \#link ) ]]; then - if (${debug}) _msg debug "_blogs: #link is present, run _link: blog_content" + if (${debug}) _msg debug "${0:t}_msg_17" blog_content=$(_link "${blog_content}") fi if [[ $( echo ${blog_content} | grep \#showimg ) ]]; then - if (${debug}) _msg debug "_blogs: #showimg is present, run _link: blog_content" + if (${debug}) _msg debug "${0:t}_msg_18" blog_content=$(_image "${blog_content}") fi if [[ $( echo ${blog_content} | grep \#ytvideo ) ]]; then - if (${debug}) _msg debug "_blogs: #ytvideo is present, run _link: blog_content" + if (${debug}) _msg debug "${0:t}_msg_19" blog_content=$(_youtube "${blog_content}") fi elif [[ ${generator} == "markdown" ]]; then @@ -705,18 +704,18 @@ function _blogs() { fi # Replace every #tagline in blog_content - if (${debug}) _msg debug "_blogs: Replacing tagline, sitename and pagetitle" + if (${debug}) _msg debug "${0:t}_msg_20" blog_content=$( echo ${blog_content} | perl -pe "s|#tagline|${site_tagline}|gs; s|#sitename|${site_name}|gs; s|#pagetitle|${page_title}|gs" ) blog_content=$(_last_updated "${blog_content}") blog_content=$(_cleanup "${blog_content}") # Create directory if it doesn't exist - if (${debug}) _msg debug "_blogs: Creating directory ${www_root}${blog_dir}" + if (${debug}) _msg debug "${0:t}_msg_21" " ${www_root}${blog_dir}" [[ ! -d "${www_root}/${blog_dir}" ]] && mkdir -p "${www_root}/${blog_dir}" # Write to file - if (${debug}) _msg debug "_blogs: Writing blog to disk: ${www_root}${blog_url}" + if (${debug}) _msg debug "${0:t}_msg_22" " ${www_root}${blog_url}" echo "${blog_content}" > "${www_root}${blog_url}" unset sdate btitle ingress body blog_index blog_dir blog_url @@ -724,18 +723,18 @@ function _blogs() { done # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post export BLOG_META_STR_ARRAY - if (${debug}) _msg debug "_blogs: new_updated_blogs=true" + if (${debug}) _msg debug "${0:t}_msg_23" export new_updated_blogs=true else - _msg sub "- No new or updated Blogs found" + _msg sub "${0:t}_msg_24" export new_updated_blogs=false fi if [[ ${new_updated_blogs} == "true" ]]; then - if (${debug}) _msg sub "* _blogs: Running _blog_idx_for_index" + if (${debug}) _msg sub "${0:t}_msg_25" _blog_idx_for_index - if (${debug}) _msg sub "* _blogs: Running _blog_index" + if (${debug}) _msg sub "${0:t}_msg_26" _blog_index fi @@ -746,21 +745,21 @@ function _blog_idx_for_index() { local debug=${globaldebug:-false} - _msg sub "- Populating ${project_dir}/blog/index.tmp.html" + _msg sub "${0:t}_msg_1" " ${project_dir}/blog/index.tmp.html" - if (${debug}) _msg debug "_blog_idx_for_index: Initiating function" + if (${debug}) _msg debug "${0:t}_msg_2" local blog_list_tpl=$(<${project_dir}/themes/${theme}/blog_list.tpl) # Truncate file before writing new one : >| "${project_dir}/blog/index.tmp.html" - if (${debug}) _msg debug "_blog_idx_for_index: BLOG_META_STR_ARRAY: ${BLOG_META_STR_ARRAY[@]}" + if (${debug}) _msg debug "${0:t}_msg_3" " ${BLOG_META_STR_ARRAY[@]}" for meta_str in ${BLOG_META_STR_ARRAY[@]} do - 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 "${0:t}_msg_4" + if (${debug}) _msg debug "${0:t}_msg_5" " ${meta_str}" # Split meta_str into individual metadata components local -a meta_array=("${(@s/||/)meta_str}") @@ -769,7 +768,7 @@ function _blog_idx_for_index() { local sdate btitle ingress url # Iterate over each component and extract information - if (${debug}) _msg debug "_blog_idx_for_index: Iterate over each component and extract information" + if (${debug}) _msg debug "${0:t}_msg_6" for component in "${meta_array[@]}" do case "${component}" in @@ -803,11 +802,11 @@ function _blog_idx_for_index() { unset sdate btitle ingress url - if (${debug}) _msg debug "_blog_idx_for_index: Running ${engine} on content to catch QStags in Ingress" + if (${debug}) _msg debug "${0:t}_msg_7" " ${engine} " "${0:t}_msg_7.1" blog_list_content=$( ${engine} ${blog_list_content} ) - 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 "${0:t}_msg_8" " ${project_dir}/blog/index.tmp.html" + if (${debug}) _msg debug "${0:t}_msg_9" " ${blog_list_content}" echo ${blog_list_content} >> ${project_dir}/blog/index.tmp.html done @@ -822,26 +821,24 @@ 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 "_blog_index: blog_in_index=${blog_in_index}" - if (${debug}) _msg debug "_blog_index: new_updated_blogs=${new_updated_blogs}" - if (${debug}) _msg debug "_blog_index: Running function _blog_index" - if (${debug}) _msg debug "_blog_index: blog_in_index = ${blog_in_index}" + if (${debug}) _msg debug "${0:t}_msg_1" "${blog_in_index}" + if (${debug}) _msg debug "${0:t}_msg_2" "${new_updated_blogs}" + if (${debug}) _msg debug "${0:t}_msg_3" + if (${debug}) _msg debug "${0:t}_msg_4" " ${blog_in_index}" - _msg std "- Generating Page: ${www_root}/blog/index.html" + _msg std "${0:t}_msg_5" " ${www_root}/blog/index.html" local blog_index_tpl=$(<${project_dir}/themes/${theme}/blog_index.tpl) local blog_index_list=$(<${project_dir}/blog/index.tmp.html) - if (${debug}) _msg debug "_blog_index: Replacing sitename and tagline" + if (${debug}) _msg debug "${0:t}_msg_6" local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${site_name}|gs; s|#tagline|${site_tagline}|gs") - if (${debug}) _msg debug "_blog_index: Replacing BODY with content of ${project_dir}/blog/index.tmp.html" + if (${debug}) _msg debug "${0:t}_msg_7" " ${project_dir}/blog/index.tmp.html" blog_index_content=$( awk -v new_body="$blog_index_list" '{sub(/BODY/, new_body)} 1' <(echo "${blog_index_content}") ) if (${debug}); then - _msg debug "_blog_index: Writing ${www_root}/blog/index.html" - _msg debug "_blog_index: Content length of blog_index_content: ${#blog_index_content}" - #_msg debug "_blog_index: Content of blog_index_content" - #_msg sub "${blog_index_content}" + _msg debug "${0:t}_msg_8" " ${www_root}/blog/index.html" + _msg debug "${0:t}_msg_9" " ${#blog_index_content}" fi echo "$blog_index_content" > ${www_root}/blog/index.html _f_last_updated ${www_root}/blog/index.html @@ -855,7 +852,7 @@ function _add_blog_list_to_index() { local debug=${globaldebug:-false} # Let's find the file 'index.qst' and add the blog if blog_in_index is true - if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html" + if (${debug}) _msg debug "${0:t}_msg_1" local blog_index_list=$(<${project_dir}/blog/index.tmp.html) local site_index_file=$(<${www_root}/index.html) echo "${site_index_file}" | awk -v new_body="${blog_index_list}" '{sub(/BLOGINDEX/, new_body)} 1' > "${www_root}/index.html" @@ -869,7 +866,7 @@ function _sitemap() { # Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file. if [[ ${sitemap} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] ); then - _msg main "Generating Sitemap" + _msg main "${0:t}_msg_1" local sitemap_file="${www_root}/sitemap.xml" @@ -904,7 +901,7 @@ function _sitemap() { # End of the XML file echo '' >> "${sitemap_file}" - if (${debug}); then _msg debug "Sitemap generated at ${sitemap_file}"; fi + if (${debug}); then _msg debug "${0:t}_msg_2" " ${sitemap_file}"; fi fi @@ -921,15 +918,15 @@ function _link() { # Process the content line by line echo "${content}" | while IFS= read -r line; do if [[ ${line} == *"#link"* ]]; then - if (${debug}) _msg debug "_link: URL_MAIN(line): ${line}" + if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" # Extract the URL and the link text local url_full=$(echo "${line}" | awk -F'#link ' '{print $2}' | awk -F'¤' '{print $1 "¤" $2}') local url_dest=$(echo "${url_full}" | awk -F'¤' '{print $1}') local url_txt=$(echo "${url_full}" | awk -F'¤' '{print $2}') - if (${debug}) _msg debug "_link_ URL: ${url_dest}" - if (${debug}) _msg debug "_link: Text: ${url_txt}" + if (${debug}) _msg debug "${0:t}_msg_2" " ${url_dest}" + if (${debug}) _msg debug "${0:t}_msg_3" " ${url_txt}" # Form the replacement HTML link local modified_link="${url_txt}" @@ -959,7 +956,7 @@ function _image() { # Process the content line by line echo "${content}" | while IFS= read -r line; do if [[ ${line} == *"#showimg"* ]]; then - if (${debug}) _msg debug "_image: Processing line: ${line}" + if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" # Extract image link and alt text local img_link=$(echo "${line}" | awk -F'#showimg ' '{print $2}') @@ -999,7 +996,7 @@ function _youtube() { # Process the content line by line echo "${content}" | while IFS= read -r line; do if [[ ${line} == *"#ytvideo"* ]]; then - if (${debug}) _msg debug "_youtube: Processing line: ${line}" + if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" # Extract YouTube video ID local yt_id=$(echo "${line}" | awk -F'#ytvideo ' '{print $2}') @@ -1023,7 +1020,7 @@ function _cleanup() { local content="${1}" - if (${debug}) _msg debug "_cleanup: Cleaning up tags in content" + if (${debug}) _msg debug "${0:t}_msg_1" # Perform the cleanup # -e "s|BLOGINDEX\ ||g" @@ -1046,7 +1043,7 @@ function _html() { local content="${1}" if ${debug}; then - _msg debug "_html: Converting QStags in content" + _msg debug "${0:t}_msg_1" fi # Use perl to convert QStags to HTML @@ -1106,7 +1103,7 @@ function _zhtml() { local content="${1}" if ${debug}; then - _msg debug "_html: Converting QStags in content" + _msg debug "${0:t}_msg_1" fi # Load regex module