From c14e943f2b075f1db39ae9fd77b3ace6eef83174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Fri, 30 May 2025 21:06:09 +0200 Subject: [PATCH] [WIP] Use the correct version of qsgen2 --- .gitignore | 59 + HOWTO.md | 220 +++ LICENSE | 674 +++++++ README.md | 116 +- THEME-HOWTO.md | 194 ++ docs/zsdoc/data/bodies/qsgen2 | 101 - docs/zsdoc/data/bodies/qsgen2.comments | 142 -- docs/zsdoc/data/call_tree.zsd | 16 - .../qsgen2/_add_blog_list_to_index | 2 - .../data/descriptions/qsgen2/_blog_cache | 2 - .../descriptions/qsgen2/_blog_idx_for_index | 2 - .../data/descriptions/qsgen2/_blog_index | 2 - docs/zsdoc/data/descriptions/qsgen2/_blogs | 2 - docs/zsdoc/data/descriptions/qsgen2/_cleanup | 4 - .../data/descriptions/qsgen2/_f_last_updated | 3 - .../data/descriptions/qsgen2/_file_to_lower | 4 - docs/zsdoc/data/descriptions/qsgen2/_help | 3 - docs/zsdoc/data/descriptions/qsgen2/_image | 4 - .../data/descriptions/qsgen2/_last_updated | 4 - docs/zsdoc/data/descriptions/qsgen2/_link | 4 - .../data/descriptions/qsgen2/_list_blogs | 2 - .../data/descriptions/qsgen2/_list_pages | 2 - docs/zsdoc/data/descriptions/qsgen2/_msg | 4 - docs/zsdoc/data/descriptions/qsgen2/_p_qstags | 4 - docs/zsdoc/data/descriptions/qsgen2/_pages | 2 - .../data/descriptions/qsgen2/_pages_cache | 3 - docs/zsdoc/data/descriptions/qsgen2/_qstags | 4 - .../data/descriptions/qsgen2/_run_engine | 3 - docs/zsdoc/data/descriptions/qsgen2/_sitemap | 2 - docs/zsdoc/data/descriptions/qsgen2/_version | 3 - docs/zsdoc/data/descriptions/qsgen2/_youtube | 4 - .../qsgen2/_blogs/BLOG_META_STR_ARRAY | 0 .../qsgen2/_blogs/new_updated_blogs | 0 .../_blogs/qsgen2/_blogs/new_updated_blogs | 0 .../_blogs/qsgen2/_list_blogs/no_blogs_found | 0 .../_f_last_updated/qsgen2/Script_Body_/today | 0 .../_last_updated/qsgen2/Script_Body_/today | 0 .../_list_pages/qsgen2/Script_Body_/file_ext | 0 .../_pages/qsgen2/Script_Body_/file_ext | 0 .../_pages/qsgen2/_list_pages/no_pages_found | 0 .../qsgen2/Script_Body_/sitemap_force | 0 .../_sitemap/qsgen2/_blogs/new_updated_blogs | 0 .../_sitemap/qsgen2/_pages/new_updated_pages | 0 .../data/exports/qsgen2/Script_Body_/blogdate | 1 - .../data/exports/qsgen2/Script_Body_/file_ext | 1 - .../exports/qsgen2/Script_Body_/sitemap_force | 1 - .../data/exports/qsgen2/Script_Body_/today | 1 - .../exports/qsgen2/_blogs/BLOG_META_STR_ARRAY | 1 - .../exports/qsgen2/_blogs/new_updated_blogs | 1 - .../exports/qsgen2/_list_blogs/no_blogs_found | 1 - .../exports/qsgen2/_list_pages/no_pages_found | 1 - .../exports/qsgen2/_pages/new_updated_pages | 1 - docs/zsdoc/data/extended/qsgen2 | 1393 -------------- .../features/qsgen2/Script_Body_/autoload | 1 - .../data/features/qsgen2/Script_Body_/export | 1 - .../data/features/qsgen2/Script_Body_/source | 1 - .../features/qsgen2/Script_Body_/zmodload | 1 - docs/zsdoc/data/features/qsgen2/_blogs/export | 1 - .../data/features/qsgen2/_list_blogs/export | 1 - .../data/features/qsgen2/_list_blogs/setopt | 1 - .../data/features/qsgen2/_list_pages/export | 1 - .../data/features/qsgen2/_list_pages/setopt | 1 - docs/zsdoc/data/features/qsgen2/_pages/export | 1 - docs/zsdoc/data/features/qsgen2/_pages/read | 1 - .../data/features/qsgen2/_sitemap/setopt | 1 - .../functions/qsgen2/_add_blog_list_to_index | 9 - docs/zsdoc/data/functions/qsgen2/_blog_cache | 31 - .../data/functions/qsgen2/_blog_idx_for_index | 59 - docs/zsdoc/data/functions/qsgen2/_blog_index | 30 - docs/zsdoc/data/functions/qsgen2/_blogs | 155 -- docs/zsdoc/data/functions/qsgen2/_cleanup | 16 - .../data/functions/qsgen2/_f_last_updated | 19 - .../data/functions/qsgen2/_file_to_lower | 5 - docs/zsdoc/data/functions/qsgen2/_help | 2 - docs/zsdoc/data/functions/qsgen2/_image | 28 - .../zsdoc/data/functions/qsgen2/_last_updated | 15 - docs/zsdoc/data/functions/qsgen2/_link | 27 - docs/zsdoc/data/functions/qsgen2/_list_blogs | 22 - docs/zsdoc/data/functions/qsgen2/_list_pages | 21 - docs/zsdoc/data/functions/qsgen2/_msg | 21 - docs/zsdoc/data/functions/qsgen2/_p_qstags | 55 - docs/zsdoc/data/functions/qsgen2/_pages | 108 -- docs/zsdoc/data/functions/qsgen2/_pages_cache | 31 - docs/zsdoc/data/functions/qsgen2/_qstags | 50 - docs/zsdoc/data/functions/qsgen2/_run_engine | 11 - docs/zsdoc/data/functions/qsgen2/_sitemap | 92 - docs/zsdoc/data/functions/qsgen2/_version | 4 - docs/zsdoc/data/functions/qsgen2/_youtube | 18 - docs/zsdoc/data/rev_call_tree.zsd | 14 - .../zsdoc/data/trees/qsgen2/Script_Body_.tree | 28 - docs/zsdoc/data/trees/qsgen2/_blog_cache.tree | 5 - .../trees/qsgen2/_blog_idx_for_index.tree | 4 - docs/zsdoc/data/trees/qsgen2/_blog_index.tree | 6 - docs/zsdoc/data/trees/qsgen2/_blogs.tree | 15 - .../data/trees/qsgen2/_f_last_updated.tree | 4 - .../data/trees/qsgen2/_last_updated.tree | 4 - docs/zsdoc/data/trees/qsgen2/_list_blogs.tree | 4 - docs/zsdoc/data/trees/qsgen2/_list_pages.tree | 4 - docs/zsdoc/data/trees/qsgen2/_p_qstags.tree | 4 - docs/zsdoc/data/trees/qsgen2/_pages.tree | 8 - .../zsdoc/data/trees/qsgen2/_pages_cache.tree | 5 - docs/zsdoc/data/trees/qsgen2/_qstags.tree | 4 - docs/zsdoc/data/trees/qsgen2/_run_engine.tree | 4 - docs/zsdoc/data/trees/qsgen2/_sitemap.tree | 4 - docs/zsdoc/data/trees/qsgen2/_version.tree | 4 - docs/zsdoc/qsgen2.adoc | 517 ------ docs/zsdoc/qsgen2.html | 1381 -------------- include/qsgen2/lang/en_UK | 334 ++-- include/qsgen2/lang/en_US | 334 ++-- include/qsgen2/lang/es_ES | 324 ++-- include/qsgen2/lang/fr_FR | 326 ++-- include/qsgen2/lang/nb_NO | 332 ++-- qsgen3 | 1620 +++++++++++++---- config.example => site.conf.example | 0 114 files changed, 3511 insertions(+), 5612 deletions(-) create mode 100644 .gitignore create mode 100644 HOWTO.md create mode 100644 LICENSE create mode 100644 THEME-HOWTO.md delete mode 100644 docs/zsdoc/data/bodies/qsgen2 delete mode 100644 docs/zsdoc/data/bodies/qsgen2.comments delete mode 100644 docs/zsdoc/data/call_tree.zsd delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_add_blog_list_to_index delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_blog_cache delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_blog_idx_for_index delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_blog_index delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_blogs delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_cleanup delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_f_last_updated delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_file_to_lower delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_help delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_image delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_last_updated delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_link delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_list_blogs delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_list_pages delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_msg delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_p_qstags delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_pages delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_pages_cache delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_qstags delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_run_engine delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_sitemap delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_version delete mode 100644 docs/zsdoc/data/descriptions/qsgen2/_youtube delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_blog_idx_for_index/qsgen2/_blogs/BLOG_META_STR_ARRAY delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_blog_index/qsgen2/_blogs/new_updated_blogs delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_blogs/new_updated_blogs delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_list_blogs/no_blogs_found delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_f_last_updated/qsgen2/Script_Body_/today delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_last_updated/qsgen2/Script_Body_/today delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_list_pages/qsgen2/Script_Body_/file_ext delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/Script_Body_/file_ext delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/_list_pages/no_pages_found delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/Script_Body_/sitemap_force delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_blogs/new_updated_blogs delete mode 100644 docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_pages/new_updated_pages delete mode 100644 docs/zsdoc/data/exports/qsgen2/Script_Body_/blogdate delete mode 100644 docs/zsdoc/data/exports/qsgen2/Script_Body_/file_ext delete mode 100644 docs/zsdoc/data/exports/qsgen2/Script_Body_/sitemap_force delete mode 100644 docs/zsdoc/data/exports/qsgen2/Script_Body_/today delete mode 100644 docs/zsdoc/data/exports/qsgen2/_blogs/BLOG_META_STR_ARRAY delete mode 100644 docs/zsdoc/data/exports/qsgen2/_blogs/new_updated_blogs delete mode 100644 docs/zsdoc/data/exports/qsgen2/_list_blogs/no_blogs_found delete mode 100644 docs/zsdoc/data/exports/qsgen2/_list_pages/no_pages_found delete mode 100644 docs/zsdoc/data/exports/qsgen2/_pages/new_updated_pages delete mode 100644 docs/zsdoc/data/extended/qsgen2 delete mode 100644 docs/zsdoc/data/features/qsgen2/Script_Body_/autoload delete mode 100644 docs/zsdoc/data/features/qsgen2/Script_Body_/export delete mode 100644 docs/zsdoc/data/features/qsgen2/Script_Body_/source delete mode 100644 docs/zsdoc/data/features/qsgen2/Script_Body_/zmodload delete mode 100644 docs/zsdoc/data/features/qsgen2/_blogs/export delete mode 100644 docs/zsdoc/data/features/qsgen2/_list_blogs/export delete mode 100644 docs/zsdoc/data/features/qsgen2/_list_blogs/setopt delete mode 100644 docs/zsdoc/data/features/qsgen2/_list_pages/export delete mode 100644 docs/zsdoc/data/features/qsgen2/_list_pages/setopt delete mode 100644 docs/zsdoc/data/features/qsgen2/_pages/export delete mode 100644 docs/zsdoc/data/features/qsgen2/_pages/read delete mode 100644 docs/zsdoc/data/features/qsgen2/_sitemap/setopt delete mode 100644 docs/zsdoc/data/functions/qsgen2/_add_blog_list_to_index delete mode 100644 docs/zsdoc/data/functions/qsgen2/_blog_cache delete mode 100644 docs/zsdoc/data/functions/qsgen2/_blog_idx_for_index delete mode 100644 docs/zsdoc/data/functions/qsgen2/_blog_index delete mode 100644 docs/zsdoc/data/functions/qsgen2/_blogs delete mode 100644 docs/zsdoc/data/functions/qsgen2/_cleanup delete mode 100644 docs/zsdoc/data/functions/qsgen2/_f_last_updated delete mode 100644 docs/zsdoc/data/functions/qsgen2/_file_to_lower delete mode 100644 docs/zsdoc/data/functions/qsgen2/_help delete mode 100644 docs/zsdoc/data/functions/qsgen2/_image delete mode 100644 docs/zsdoc/data/functions/qsgen2/_last_updated delete mode 100644 docs/zsdoc/data/functions/qsgen2/_link delete mode 100644 docs/zsdoc/data/functions/qsgen2/_list_blogs delete mode 100644 docs/zsdoc/data/functions/qsgen2/_list_pages delete mode 100644 docs/zsdoc/data/functions/qsgen2/_msg delete mode 100644 docs/zsdoc/data/functions/qsgen2/_p_qstags delete mode 100644 docs/zsdoc/data/functions/qsgen2/_pages delete mode 100644 docs/zsdoc/data/functions/qsgen2/_pages_cache delete mode 100644 docs/zsdoc/data/functions/qsgen2/_qstags delete mode 100644 docs/zsdoc/data/functions/qsgen2/_run_engine delete mode 100644 docs/zsdoc/data/functions/qsgen2/_sitemap delete mode 100644 docs/zsdoc/data/functions/qsgen2/_version delete mode 100644 docs/zsdoc/data/functions/qsgen2/_youtube delete mode 100644 docs/zsdoc/data/rev_call_tree.zsd delete mode 100644 docs/zsdoc/data/trees/qsgen2/Script_Body_.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_blog_cache.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_blog_idx_for_index.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_blog_index.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_blogs.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_f_last_updated.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_last_updated.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_list_blogs.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_list_pages.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_p_qstags.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_pages.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_pages_cache.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_qstags.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_run_engine.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_sitemap.tree delete mode 100644 docs/zsdoc/data/trees/qsgen2/_version.tree delete mode 100644 docs/zsdoc/qsgen2.adoc delete mode 100644 docs/zsdoc/qsgen2.html rename config.example => site.conf.example (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c82c7f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +# Temporary files +*.tmp +*.bak +*.backup +*.swp +*.swo +*~ +*.new +*.en +.DS_Store +.idea/ +.vscode/ + +# Language directory temporary files +include/qsgen2/lang/*.backup +include/qsgen2/lang/*.bak +include/qsgen2/lang/*.new +include/qsgen2/lang/*.txt +include/qsgen2/lang/*.en + +# Scripts directory (temporary/conversion scripts) +/scripts/ +/tools/ + +# Build output +/build/ +/dist/ +*.o + +# Python cache +__pycache__/ +*.py[cod] +*$py.class + +# Node modules +node_modules/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Local development files +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/HOWTO.md b/HOWTO.md new file mode 100644 index 0000000..99b18ff --- /dev/null +++ b/HOWTO.md @@ -0,0 +1,220 @@ +# Quick Site Generator 2 (qsgen2) - User Guide + +## Table of Contents +1. [Introduction](#introduction) +2. [Installation](#installation) +3. [Quick Start](#quick-start) +4. [Project Structure](#project-structure) +5. [Content Creation](#content-creation) + - [Pages](#pages) + - [Blog Posts](#blog-posts) +6. [Markup Languages](#markup-languages) + - [QSTags](#qstags) + - [Markdown](#markdown) + - [Conversion Between Formats](#conversion-between-formats) +7. [Themes and Templates](#themes-and-templates) +8. [Configuration](#configuration) +9. [Command Reference](#command-reference) +10. [Advanced Usage](#advanced-usage) +11. [Troubleshooting](#troubleshooting) +12. [Contributing](#contributing) + +## Introduction + +Quick Site Generator 2 (qsgen2) is a powerful static site generator written in Zsh. It's designed to be fast, flexible, and easy to use, with support for both custom QSTags and standard Markdown syntax. + +## Installation + +1. Clone the repository: + ```bash + git clone https://github.com/kekePower/qsgen2.git + cd qsgen2 + ``` + +2. Make the script executable: + ```bash + chmod +x qsgen2 + ``` + +3. Add to your PATH (optional): + ```bash + echo 'export PATH="$PATH:'$(pwd)'"' >> ~/.zshrc + source ~/.zshrc + ``` + +## Quick Start + +1. Create a new site: + ```bash + ./qsgen2 new my-site + cd my-site + ``` + +2. Build the site: + ```bash + ./qsgen2 build + ``` + +3. Preview the site: + ```bash + ./qsgen2 serve + ``` + +## Project Structure + +``` +my-site/ +├── config # Site configuration +├── content/ # Source content +│ ├── pages/ # Static pages +│ └── blog/ # Blog posts +├── themes/ # Site themes +├── static/ # Static files (images, CSS, JS) +└── output/ # Generated site (created on build) +``` + +## Content Creation + +### Pages + +Create a new page: +```bash +./qsgen2 new page about +``` + +Pages use the `.qst` extension and can include QSTags or Markdown. + +### Blog Posts + +Create a new blog post: +```bash +./qsgen2 new post my-first-post +``` + +Blog posts use the `.blog` extension and support the same markup as pages. + +## Markup Languages + +### QSTags + +QSTags is a simple markup language used by qsgen2. Example: + +``` +#H1 Welcome to My Site#EH1 +#P This is a paragraph with #BDbold#EBD and #Iitalic#EI text.#EP +``` + +### Markdown + +Markdown is also supported: + +```markdown +# Welcome to My Site + +This is a paragraph with **bold** and *italic* text. +``` + +### Conversion Between Formats + +Convert a single file to Markdown: +```bash +./qsgen2 convert --to-markdown content/pages/about.qst content/pages/about.md +``` + +Convert all files to Markdown: +```bash +./qsgen2 convert --to-markdown --all +``` + +Convert back to QSTags: +```bash +./qsgen2 convert --to-qstags --all +``` + +## Themes and Templates + +Themes are stored in the `themes` directory. Each theme can include: +- Page templates +- Blog post templates +- CSS/JavaScript +- Assets + +## Configuration + +Edit `config/site.conf` to customize your site: + +```ini +site_name = "My Awesome Site" +site_url = "https://example.com" +site_author = "Your Name" +theme = "default" +``` + +## Command Reference + +### Build Commands +- `build`: Build the site +- `clean`: Remove generated files +- `serve`: Start a local server + +### Content Management +- `new page `: Create a new page +- `new post `: Create a new blog post +- `convert`: Convert between markup formats + +### Utility Commands +- `version`: Show version information +- `help`: Show help message + +## Advanced Usage + +### Custom Build Scripts +Create a `build.zsh` file in your project root: + +```bash +#!/usr/bin/env zsh +# Custom build script + +# Clean previous build +./qsgen2 clean + +# Convert all content to Markdown for editing +./qsgen2 convert --to-markdown --all + +# Build the site +./qsgen2 build + +# Optimize images +find output -name "*.jpg" -exec jpegoptim --strip-all {} \; +``` + +## Troubleshooting + +### Common Issues + +1. **Permission Denied** + ```bash + chmod +x qsgen2 + ``` + +2. **Command Not Found** + Add qsgen2 to your PATH or use `./qsgen2` + +3. **Build Errors** + Check for syntax errors in your content files + +## Contributing + +1. Fork the repository +2. Create a feature branch +3. Commit your changes +4. Push to the branch +5. Create a Pull Request + +## License + +MIT License - See LICENSE for details. + +--- + +*Quick Site Generator 2 - A fast, flexible static site generator* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/README.md b/README.md index d8bbd0d..cddb738 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,70 @@ <img src="qsg2-square.png" width="150" align="left"> # Quick Site Generator 2 -Quick Site Generator 2 is a static website generator inspired by [Nikola](https://github.com/getnikola/nikola) and written for [Zsh](https://zsh.sourceforge.io/). -<br><br> +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) -## Why? +Quick Site Generator 2 is a powerful static website generator written in Zsh, inspired by [Nikola](https://github.com/getnikola/nikola). It's designed to be fast, flexible, and easy to use, with support for both custom QSTags and standard Markdown syntax. -Well, I wanted something that worked for me and wasn't too complicated and I also like a challenge. +## Features -It all started with a simple script I wrote that I called ```myjourney``` to write about a journey I was on. It worked well enough, but soon I wanted to create something else and something more complex. +- 🚀 Blazing fast static site generation +- 📝 Supports both QSTags and Markdown content +- 🌍 Multi-language support (en_US, en_UK, es_ES, fr_FR, nb_NO) +- 🎨 Themeable with custom templates (see [THEME-HOWTO.md](THEME-HOWTO.md)) +- 📱 Responsive design ready +- 🔍 SEO friendly +- 🔄 Automatic rebuild on file changes -So I started to write another script I aptly called ```generate```.This also worked really great. It was, however, very limited and not very portable. +## Quick Start -Then this script was born. It has the same ideas as the first two, but is an almost complete rewrite of ```generate```. It does, however, use some of the same functions and is also more portable. The next steps is to try to use more of the Zsh modules instead of always relying on external tools like Perl, sed and awk. In other words, a work in progress. +1. **Installation** + ```bash + git clone https://github.com/kekePower/qsgen2.git + cd qsgen2 + chmod +x qsgen2 + ``` -## What is qsgen2? +2. **Create a new site** + ```bash + ./qsgen2 new my-site + cd my-site + ``` -```qsgen2``` is capable of creating static HTML pages using the native ```_html``` engine that uses ```QStags``` (that I'll describe in detail later) or by writing your pages and blogs in Markdown. It uses [Pandoc](https://github.com/jgm/pandoc/releases), mostly because it's the most compete tool for the job. Not all Linux distributions have it, so you can just download the binaries and place them where it suits you the best. +3. **Build and serve** + ```bash + ./qsgen2 build + ./qsgen2 serve + ``` -You cannot mix native and Markdown when creating your projects. +For detailed documentation, see the [HOWTO.md](HOWTO.md) guide. -## What it's not! +## Recent Changes -```Quick Site Generator 2``` is not easy. It's not bug free. It's not a professional product. It's not really production ready, although it works great for me. +- Added Norwegian (nb_NO) language support +- Improved internationalization (i18n) system +- Cleaned up temporary and backup files +- Updated documentation +- Added comprehensive HOWTO guide -## Configuration +## Requirements -Copy ```qsgen2``` and the directory ```include``` to ${HOME}/bin/. +- Zsh 5.8 or later +- Pandoc (for Markdown support) +- Basic Unix tools (sed, grep, etc.) -Then create you project directory, for example ```${HOME}/sites/new-site```. -Copy the file ```config``` and the directory ```themes``` to your project directory. +## License -You first have to configure your site and this is done in the file [config](config). -Do the necessary changes. +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -Create a directory named ```blog``` if you want to have blogs on your site. +## Contributing -Create your index file with either ```tpl``` to use the native engine or ```md``` to use Markdown. -I will, as mentioned, create a how-to on ```QStags```. +Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) before submitting pull requests. -I am considering adding a command line, ```init```, that will guide you through this process in an interactive manner. +## Support -## Themes +For support, please [open an issue](https://github.com/kekePower/qsgen2/issues) on GitHub. -```qsgen``` uses templates that reside in ```$project_dir/themes/<theme name>```. -The theme consists of 4 files: +--- -* blogs.tpl -* pages.tpl -* blog_index.tpl -* blog_list.tpl - -### Blogs - -The file ```blogs.tpl``` is used to create the blog posts that will reside in ```$www_root/blogs/year/mon/date/title-of-blog-post.html```. -```qsgen2``` will list all the files in ```blog/*.blog``` and do its magic before the word/tag ```BODY``` in the blogs.tpl file is replaced with the HTML formatted content and then the file will be written to disk. - -Other tags/words that are replaced are: - -* BLOGTITLE -* CALADAY -* CALNDAY -* CALMONTH -* CALYEAR -* INGRESS - -Then the footer of the document is updated with today's date and the name and version of the script. - -The themes engine is not 100% complete because there still are some static text that could or should be replaced. It is, however, quite easy. - -#### Blog Index - -There is an option in the file ```config``` if you want to show the blog on the front page or not. If set to false, it will write a file in ```$www_root/blog/index.html``` that contains, in reverse order, the blogs written. - -To do this it uses the file ```blog_list.tpl``` as a template for how to format this list and then it inserts this into the file ```blog_index.tpl``` which then is written to disk. - -### Pages - -The process of creating pages is almost the same as with blogs, but with fewer, and other, replacements. - -Tags replaced are: - -* #pagetitle -* #tagline -* BODY - -And then the footer gets the same touch as the blog posts. - -### Knows bugs - -* Sometimes it doesn't write the Blog Index file (/blog/index.html) with all the blogs, only the latest. - * The problem is that when a new blog post is added, it doesn't get added to the list of posts +*Created with ❤️ by kekePower* diff --git a/THEME-HOWTO.md b/THEME-HOWTO.md new file mode 100644 index 0000000..02050c0 --- /dev/null +++ b/THEME-HOWTO.md @@ -0,0 +1,194 @@ +# Creating Themes for Quick Site Generator 2 + +This guide explains how to create and customize themes for Quick Site Generator 2 (qsgen2). The theming system is designed to be simple yet flexible, allowing you to create beautiful, responsive websites with minimal effort. + +## Table of Contents + +1. [Theme Structure](#theme-structure) +2. [Template Files](#template-files) + - [pages.tpl](#pagestpl) + - [blogs.tpl](#blogstpl) + - [blog_index.tpl](#blog_indextpl) + - [blog_list.tpl](#blog_listtpl) +3. [Template Variables](#template-variables) +4. [Creating a New Theme](#creating-a-new-theme) +5. [Best Practices](#best-practices) +6. [Example Theme](#example-theme) + +## Theme Structure + +A qsgen2 theme consists of the following files: + +``` +theme-name/ +├── pages.tpl # Template for regular pages +├── blogs.tpl # Template for blog posts +├── blog_index.tpl # Template for blog index page +├── blog_list.tpl # Template for blog post listings +└── css/ # Stylesheets and assets + ├── style.css # Main stylesheet + └── webfont.js # Web font loader (optional) +``` + +## Template Files + +### pages.tpl + +This template is used for regular static pages. It should include the basic HTML structure, head section, and placeholders for dynamic content. + +Key placeholders: +- `#sitename` - Site name from configuration +- `#pagetitle` - Title of the current page +- `#tagline` - Site tagline from configuration +- `BODY` - Main content area + +### blogs.tpl + +This template is used for individual blog posts. It includes placeholders for blog-specific content. + +Key placeholders: +- `BLOGTITLE` - Title of the blog post +- `CALADAY` - Day of the month (numeric) +- `CALNDAY` - Day of the week (name) +- `CALMONTH` - Month name +- `CALYEAR` - Year +- `INGRESS` - Blog post excerpt/intro +- `BODY` - Main blog post content + +### blog_index.tpl + +This template is used for the blog index/archive page that lists all blog posts. + +Key placeholders: +- `#sitename` - Site name from configuration +- `#tagline` - Site tagline from configuration +- `BODY` - Contains the list of blog posts (generated from blog_list.tpl) + +### blog_list.tpl + +This template defines how individual blog posts are displayed in the blog index. + +Key placeholders: +- `BLOGURL` - URL of the blog post +- `BLOGTITLE` - Title of the blog post +- `INGRESS` - Blog post excerpt/intro +- `BLOGDATE` - Formatted date of the blog post + +## Template Variables + +These variables can be used in any template: + +- `#sitename` - Site name from configuration +- `#tagline` - Site tagline from configuration +- `#pagetitle` - Current page title +- `#siteurl` - Base URL of the site +- `#currentyear` - Current year (for copyright notices) + +## Creating a New Theme + +1. **Create a new directory** in the `themes` folder with your theme name. + +2. **Copy the template files** from the `minimal` theme as a starting point: + ```bash + cp -r themes/minimal/* themes/your-theme-name/ + ``` + +3. **Customize the templates**: + - Edit the HTML structure in the `.tpl` files + - Update the CSS in the `css` directory + - Replace placeholder images with your own + +4. **Test your theme** by setting it in your `site.conf`: + ```ini + theme = "your-theme-name" + ``` + +5. **Build your site** to see the changes: + ```bash + ./qsgen2 build + ``` + +## Best Practices + +1. **Responsive Design** + - Use responsive CSS frameworks or media queries + - Test on different screen sizes + +2. **Performance** + - Minify CSS and JavaScript + - Optimize images + - Use web fonts sparingly + +3. **Accessibility** + - Use semantic HTML5 elements + - Include alt text for images + - Ensure sufficient color contrast + +4. **Browser Compatibility** + - Test in multiple browsers + - Use vendor prefixes for CSS properties + +## Example Theme + +Here's a minimal example of a theme structure: + +``` +my-theme/ +├── pages.tpl +├── blogs.tpl +├── blog_index.tpl +├── blog_list.tpl +└── css/ + └── style.css +``` + +### pages.tpl (example) +```html +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>#sitename - #pagetitle + + + + +
+

#sitename

+

#tagline

+ +
+ +
+ BODY +
+ +
+

© #currentyear #sitename. All rights reserved.

+
+ + +``` + +### blog_list.tpl (example) +```html + +``` + +## Conclusion + +Creating themes for qsgen2 is straightforward once you understand the template system. Start with the minimal theme as a base, and customize it to match your design. Remember to test your theme thoroughly and follow web development best practices for the best results. + +For more advanced theming options, refer to the official documentation or check out the source code of existing themes. diff --git a/docs/zsdoc/data/bodies/qsgen2 b/docs/zsdoc/data/bodies/qsgen2 deleted file mode 100644 index 8dbfc5b..0000000 --- a/docs/zsdoc/data/bodies/qsgen2 +++ /dev/null @@ -1,101 +0,0 @@ - - -VERSION="0.4.3" -QSGEN="Quick Site Generator 2" -globaldebug=false -fpath=(${HOME}/bin/include/common ${HOME}/bin/include/qsgen2/lang $fpath) -autoload include -autoload zini -include common/colors - -echo "${magenta}${blue_bg} ${QSGEN} ${end}${bold_white}${blue_bg}${VERSION} ${end}" -if [[ -f $(pwd)/config ]]; then - if (${globaldebug}); then echo "${red}Config file found and sourced${end}\n${yellow} - $(pwd)/config${end}"; fi - zini $(pwd)/config -else - echo "${red}Cannot find configuration file.${end}" - echo "${yellow} - Please create the file 'config' in your project directory.${end}" - echo "${yellow} - See 'config.example' in the git source tree.${end}" - exit -fi -typeset -A qsgenlang -lang_found=false -for dir in $fpath; do - if [[ -f "${dir}/${config[project_lang]}" ]]; then - source "${dir}/${config[project_lang]}" - lang_found=true - break - fi -done -if [[ ${lang_found} == "false" ]]; then - echo "Defined language, ${config[project_lang]}, not found. Using en_US." - source "${HOME}/bin/include/qsgen2/lang/en_US" - fi - -if (${globaldebug}); then - qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' ) - echo "Content of Config file" - for qslines in ${qsconfig} - do - echo "${yellow}${qslines}${end}" - done -fi - -if [[ "$1" == "version" || "$1" == "-v" || "$1" == "--version" ]]; then - _version ${0:t} -elif [[ "$1" == "help" || "$1" == "-h" || "$1" == "--help" ]]; then - _help ${0:t} -fi -blog_cache_file="${config[project_root]}/.blog_cache" -pages_cache_file="${config[project_root]}/.pages_cache" -if [[ ! ${config[project_generator]} ]] || [[ -d $(pwd)/.git ]]; then - _msg debug "_qsgen2_msg_3" - exit -fi -if [[ ${config[project_generator]} == "native" ]]; then - engine=_qstags - export file_ext="qst" -elif [[ ${config[project_generator]} == "markdown" ]]; then - if [[ ! -f /usr/local/bin/pandoc ]]; then - _msg other "_qsgen2_msg_4" - _msg other "https://github.com/jgm/pandoc/releases" - exit - else - engine="/usr/local/bin/pandoc" - engine_opts= - export file_ext="md" - fi -else - _msg debug "_qsgen2_msg_5" - exit -fi - -if (${globaldebug}); then _msg debug "_qsgen2_msg_6"; fi - -builtin cd ${config[project_root]} -zmodload zsh/files -zmodload zsh/datetime -zmodload zsh/regex -export today=$(strftime "%Y-%m-%d - %T") -export blogdate=$(strftime "%a-%Y-%b-%d") - - -case ${1} in - force) - _msg sub "_qsgen2_msg_2" - : >| "$blog_cache_file" - : >| "$pages_cache_file" - ;; - sitemap) - _msg sub "Updating sitemaps" - export sitemap_force=true - _sitemap - exit - ;; - *) - ;; -esac - -_blogs -_pages -_sitemap diff --git a/docs/zsdoc/data/bodies/qsgen2.comments b/docs/zsdoc/data/bodies/qsgen2.comments deleted file mode 100644 index 8c572da..0000000 --- a/docs/zsdoc/data/bodies/qsgen2.comments +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/zsh - -############################################################################### -############################################################################### -# -# Quick Site Generator 2 is a static website generator inspired by Nikola. -# It is written for the Z shell (zsh) because that's what I use and also because -# I like it better than Bash. -# -# This script is an almost complete rewrite of my old script because it became -# overly complicated and had way too many bugs, even though it worked on simple -# sites. -# -# https://github.com/kekePower/qsgen2/ -# -############################################################################### -############################################################################### # Sat-2024-02-24 - -# Set to true or false -# This will show debug information from every function in this script -# You can also set debug=true in a single function if you want to debug only that specific one. - -# Use Zsh fpath to set the path to some extra functions -# In this case, let's load the 'include' function - -# Including some colors to the script - -# Check for, and source, the config file for this specific website - -# Load language as defined in config - # echo "Language file: ${dir}/${config[project_lang]}" - # Fall back to en_US if defined language isn't found - -## -# @brief Display a message with specific formatting based on message type. -# @param type The type of message (e.g., std, info, debug, etc.) -# @param ... The keys or additional strings to be formatted and displayed. - -## -# @brief Display the version information of the script. -# @param ... Additional arguments (unused in this function). - -## -# @brief Display help information for the script. -# @param ... Additional arguments (unused in this function). - -# Define cache files for blogs and pages - -# Let's check if qsgen2 can generate this site by checking if 'generator' is available - -# We define the variable 'engine' based on what's in the 'config' file. - # Usage: ${engine} ${1} - Where 1 is the file you want to convert - # Usage: ${engine} ${1} - Where 1 is the file you want parsed - -## -# @brief Run the configured engine to process the input file. -# @param input The input file to be processed. - -# Loading Zsh modules - -# Let's put these here for now. - -# Let's create arrays of all the files we'll be working on - -## -# @brief List all page files and store them in an array. - -## -# @brief List all blog files and store them in an array. - - -## -# @brief Cache the state of blog files and identify changes. - - -## -# @brief Cache the state of page files and identify changes. -# @return Array of pages to be processed. - -## -# @brief Update #updated and #version tags in the provided content. -# @param content The content to be updated. -# @return The updated content. - -## -# @brief Update #updated and #version tags in the provided file. -# @param file_path The path to the file to be updated. - -## -# @brief Convert the filename to lowercase and replace spaces with dashes. -# @param filename The original filename. -# @return The modified filename. - - -## -# @brief Generate all new and updated pages. - -## -# @brief Generate or update blog files or export metadata based on argument. - -## -# @brief Generate the file blog/index.tmp.html. - -## -# @brief Generate the www_root/blog/index.html file. - -## -# @brief Add the blog list to the index file if blog_in_index is true. - -## -# @brief Generate the sitemap files if conditions are met. - -## -# @brief Convert #link tags to clickable HTML links. -# @param content The content containing #link tags. -# @return The content with #link tags replaced by HTML links. - -## -# @brief Convert #showimg tags to HTML img tags. -# @param content The content containing #showimg tags. -# @return The content with #showimg tags replaced by HTML img tags. - -## -# @brief Embed a YouTube video in the provided content. -# @param content The content containing #ytvideo tags. -# @return The content with #ytvideo tags replaced by YouTube iframe embeds. - -## -# @brief Remove leftover tags from the content. -# @param content The content to be cleaned. -# @return The cleaned content. - -## -# @brief Convert QStags to HTML using Perl. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. - -## -# @brief Convert QStags to HTML using Zsh regex module. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. # Truncate the blog cache before doing update # Truncate the page cache before doing update - # Nothing diff --git a/docs/zsdoc/data/call_tree.zsd b/docs/zsdoc/data/call_tree.zsd deleted file mode 100644 index 4b21842..0000000 --- a/docs/zsdoc/data/call_tree.zsd +++ /dev/null @@ -1,16 +0,0 @@ -qsgen2/_blog_cache: qsgen2/_list_blogs -qsgen2/_blog_idx_for_index: qsgen2/_msg -qsgen2/_blog_index: qsgen2/_msg qsgen2/_f_last_updated -qsgen2/_blogs: qsgen2/_msg qsgen2/_list_blogs qsgen2/_blog_cache qsgen2/_blog_idx_for_index qsgen2/_blog_index -qsgen2/_f_last_updated: qsgen2/_msg -qsgen2/_last_updated: qsgen2/_msg -qsgen2/_list_blogs: qsgen2/_msg -qsgen2/_list_pages: qsgen2/_msg -qsgen2/_pages: qsgen2/_msg qsgen2/_pages_cache qsgen2/_add_blog_list_to_index -qsgen2/_pages_cache: qsgen2/_list_pages -qsgen2/_p_qstags: qsgen2/_msg -qsgen2/_qstags: qsgen2/_msg -qsgen2/_run_engine: qsgen2/_msg -qsgen2/_sitemap: qsgen2/_msg -qsgen2/_version: qsgen2/_msg -qsgen2/zsd_script_body: qsgen2/_version qsgen2/_help qsgen2/_msg qsgen2/_sitemap qsgen2/_blogs qsgen2/_pages diff --git a/docs/zsdoc/data/descriptions/qsgen2/_add_blog_list_to_index b/docs/zsdoc/data/descriptions/qsgen2/_add_blog_list_to_index deleted file mode 100644 index c6c2f6e..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_add_blog_list_to_index +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Add the blog list to the index file if blog_in_index is true. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_blog_cache b/docs/zsdoc/data/descriptions/qsgen2/_blog_cache deleted file mode 100644 index 53fb2a1..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_blog_cache +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Cache the state of blog files and identify changes. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_blog_idx_for_index b/docs/zsdoc/data/descriptions/qsgen2/_blog_idx_for_index deleted file mode 100644 index f43fe3f..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_blog_idx_for_index +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Generate the file blog/index.tmp.html. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_blog_index b/docs/zsdoc/data/descriptions/qsgen2/_blog_index deleted file mode 100644 index 8ae3087..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_blog_index +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Generate the www_root/blog/index.html file. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_blogs b/docs/zsdoc/data/descriptions/qsgen2/_blogs deleted file mode 100644 index c933b0f..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_blogs +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Generate or update blog files or export metadata based on argument. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_cleanup b/docs/zsdoc/data/descriptions/qsgen2/_cleanup deleted file mode 100644 index ce36a5a..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_cleanup +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Remove leftover tags from the content. -# @param content The content to be cleaned. -# @return The cleaned content. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_f_last_updated b/docs/zsdoc/data/descriptions/qsgen2/_f_last_updated deleted file mode 100644 index 113dc68..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_f_last_updated +++ /dev/null @@ -1,3 +0,0 @@ -## -# @brief Update #updated and #version tags in the provided file. -# @param file_path The path to the file to be updated. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_file_to_lower b/docs/zsdoc/data/descriptions/qsgen2/_file_to_lower deleted file mode 100644 index 1038420..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_file_to_lower +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Convert the filename to lowercase and replace spaces with dashes. -# @param filename The original filename. -# @return The modified filename. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_help b/docs/zsdoc/data/descriptions/qsgen2/_help deleted file mode 100644 index d7e817d..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_help +++ /dev/null @@ -1,3 +0,0 @@ -## -# @brief Display help information for the script. -# @param ... Additional arguments (unused in this function). diff --git a/docs/zsdoc/data/descriptions/qsgen2/_image b/docs/zsdoc/data/descriptions/qsgen2/_image deleted file mode 100644 index 9c9b86c..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_image +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Convert #showimg tags to HTML img tags. -# @param content The content containing #showimg tags. -# @return The content with #showimg tags replaced by HTML img tags. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_last_updated b/docs/zsdoc/data/descriptions/qsgen2/_last_updated deleted file mode 100644 index 8c86298..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_last_updated +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Update #updated and #version tags in the provided content. -# @param content The content to be updated. -# @return The updated content. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_link b/docs/zsdoc/data/descriptions/qsgen2/_link deleted file mode 100644 index 449b7c8..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_link +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Convert #link tags to clickable HTML links. -# @param content The content containing #link tags. -# @return The content with #link tags replaced by HTML links. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_list_blogs b/docs/zsdoc/data/descriptions/qsgen2/_list_blogs deleted file mode 100644 index 4c2666e..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_list_blogs +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief List all blog files and store them in an array. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_list_pages b/docs/zsdoc/data/descriptions/qsgen2/_list_pages deleted file mode 100644 index 9a788ef..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_list_pages +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief List all page files and store them in an array. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_msg b/docs/zsdoc/data/descriptions/qsgen2/_msg deleted file mode 100644 index d51ae3b..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_msg +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Display a message with specific formatting based on message type. -# @param type The type of message (e.g., std, info, debug, etc.) -# @param ... The keys or additional strings to be formatted and displayed. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_p_qstags b/docs/zsdoc/data/descriptions/qsgen2/_p_qstags deleted file mode 100644 index 01a97e0..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_p_qstags +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Convert QStags to HTML using Perl. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_pages b/docs/zsdoc/data/descriptions/qsgen2/_pages deleted file mode 100644 index 1d427c4..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_pages +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Generate all new and updated pages. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_pages_cache b/docs/zsdoc/data/descriptions/qsgen2/_pages_cache deleted file mode 100644 index 738add5..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_pages_cache +++ /dev/null @@ -1,3 +0,0 @@ -## -# @brief Cache the state of page files and identify changes. -# @return Array of pages to be processed. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_qstags b/docs/zsdoc/data/descriptions/qsgen2/_qstags deleted file mode 100644 index 9b36ebc..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_qstags +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Convert QStags to HTML using Zsh regex module. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_run_engine b/docs/zsdoc/data/descriptions/qsgen2/_run_engine deleted file mode 100644 index acf8c43..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_run_engine +++ /dev/null @@ -1,3 +0,0 @@ -## -# @brief Run the configured engine to process the input file. -# @param input The input file to be processed. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_sitemap b/docs/zsdoc/data/descriptions/qsgen2/_sitemap deleted file mode 100644 index 9d86df7..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_sitemap +++ /dev/null @@ -1,2 +0,0 @@ -## -# @brief Generate the sitemap files if conditions are met. diff --git a/docs/zsdoc/data/descriptions/qsgen2/_version b/docs/zsdoc/data/descriptions/qsgen2/_version deleted file mode 100644 index 36a721c..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_version +++ /dev/null @@ -1,3 +0,0 @@ -## -# @brief Display the version information of the script. -# @param ... Additional arguments (unused in this function). diff --git a/docs/zsdoc/data/descriptions/qsgen2/_youtube b/docs/zsdoc/data/descriptions/qsgen2/_youtube deleted file mode 100644 index 1d46b93..0000000 --- a/docs/zsdoc/data/descriptions/qsgen2/_youtube +++ /dev/null @@ -1,4 +0,0 @@ -## -# @brief Embed a YouTube video in the provided content. -# @param content The content containing #ytvideo tags. -# @return The content with #ytvideo tags replaced by YouTube iframe embeds. diff --git a/docs/zsdoc/data/env-use/qsgen2/_blog_idx_for_index/qsgen2/_blogs/BLOG_META_STR_ARRAY b/docs/zsdoc/data/env-use/qsgen2/_blog_idx_for_index/qsgen2/_blogs/BLOG_META_STR_ARRAY deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_blog_index/qsgen2/_blogs/new_updated_blogs b/docs/zsdoc/data/env-use/qsgen2/_blog_index/qsgen2/_blogs/new_updated_blogs deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_blogs/new_updated_blogs b/docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_blogs/new_updated_blogs deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_list_blogs/no_blogs_found b/docs/zsdoc/data/env-use/qsgen2/_blogs/qsgen2/_list_blogs/no_blogs_found deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_f_last_updated/qsgen2/Script_Body_/today b/docs/zsdoc/data/env-use/qsgen2/_f_last_updated/qsgen2/Script_Body_/today deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_last_updated/qsgen2/Script_Body_/today b/docs/zsdoc/data/env-use/qsgen2/_last_updated/qsgen2/Script_Body_/today deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_list_pages/qsgen2/Script_Body_/file_ext b/docs/zsdoc/data/env-use/qsgen2/_list_pages/qsgen2/Script_Body_/file_ext deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/Script_Body_/file_ext b/docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/Script_Body_/file_ext deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/_list_pages/no_pages_found b/docs/zsdoc/data/env-use/qsgen2/_pages/qsgen2/_list_pages/no_pages_found deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/Script_Body_/sitemap_force b/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/Script_Body_/sitemap_force deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_blogs/new_updated_blogs b/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_blogs/new_updated_blogs deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_pages/new_updated_pages b/docs/zsdoc/data/env-use/qsgen2/_sitemap/qsgen2/_pages/new_updated_pages deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zsdoc/data/exports/qsgen2/Script_Body_/blogdate b/docs/zsdoc/data/exports/qsgen2/Script_Body_/blogdate deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/Script_Body_/blogdate +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/Script_Body_/file_ext b/docs/zsdoc/data/exports/qsgen2/Script_Body_/file_ext deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/Script_Body_/file_ext +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/Script_Body_/sitemap_force b/docs/zsdoc/data/exports/qsgen2/Script_Body_/sitemap_force deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/Script_Body_/sitemap_force +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/Script_Body_/today b/docs/zsdoc/data/exports/qsgen2/Script_Body_/today deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/Script_Body_/today +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/_blogs/BLOG_META_STR_ARRAY b/docs/zsdoc/data/exports/qsgen2/_blogs/BLOG_META_STR_ARRAY deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/_blogs/BLOG_META_STR_ARRAY +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/_blogs/new_updated_blogs b/docs/zsdoc/data/exports/qsgen2/_blogs/new_updated_blogs deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/_blogs/new_updated_blogs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/_list_blogs/no_blogs_found b/docs/zsdoc/data/exports/qsgen2/_list_blogs/no_blogs_found deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/_list_blogs/no_blogs_found +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/_list_pages/no_pages_found b/docs/zsdoc/data/exports/qsgen2/_list_pages/no_pages_found deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/_list_pages/no_pages_found +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/exports/qsgen2/_pages/new_updated_pages b/docs/zsdoc/data/exports/qsgen2/_pages/new_updated_pages deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/exports/qsgen2/_pages/new_updated_pages +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/extended/qsgen2 b/docs/zsdoc/data/extended/qsgen2 deleted file mode 100644 index 8b53d6d..0000000 --- a/docs/zsdoc/data/extended/qsgen2 +++ /dev/null @@ -1,1393 +0,0 @@ -#!/usr/bin/zsh - -############################################################################### -############################################################################### -# -# Quick Site Generator 2 is a static website generator inspired by Nikola. -# It is written for the Z shell (zsh) because that's what I use and also because -# I like it better than Bash. -# -# This script is an almost complete rewrite of my old script because it became -# overly complicated and had way too many bugs, even though it worked on simple -# sites. -# -# https://github.com/kekePower/qsgen2/ -# -############################################################################### -############################################################################### - -VERSION="0.4.3" # Sat-2024-02-24 -QSGEN="Quick Site Generator 2" - -# Set to true or false -# This will show debug information from every function in this script -# You can also set debug=true in a single function if you want to debug only that specific one. -globaldebug=false - -# Use Zsh fpath to set the path to some extra functions -fpath=(${HOME}/bin/include/common ${HOME}/bin/include/qsgen2/lang $fpath) -# In this case, let's load the 'include' function -autoload include -autoload zini - -# Including some colors to the script -include common/colors - -echo "${magenta}${blue_bg} ${QSGEN} ${end}${bold_white}${blue_bg}${VERSION} ${end}" - -# Check for, and source, the config file for this specific website -if [[ -f $(pwd)/config ]]; then - if (${globaldebug}); then echo "${red}Config file found and sourced${end}\n${yellow} - $(pwd)/config${end}"; fi - zini $(pwd)/config -else - echo "${red}Cannot find configuration file.${end}" - echo "${yellow} - Please create the file 'config' in your project directory.${end}" - echo "${yellow} - See 'config.example' in the git source tree.${end}" - exit -fi - -# Load language as defined in config -typeset -A qsgenlang -lang_found=false -for dir in $fpath; do - if [[ -f "${dir}/${config[project_lang]}" ]]; then - # echo "Language file: ${dir}/${config[project_lang]}" - source "${dir}/${config[project_lang]}" - lang_found=true - break - fi -done -if [[ ${lang_found} == "false" ]]; then - # Fall back to en_US if defined language isn't found - echo "Defined language, ${config[project_lang]}, not found. Using en_US." - source "${HOME}/bin/include/qsgen2/lang/en_US" - fi - -if (${globaldebug}); then - qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' ) - echo "Content of Config file" - for qslines in ${qsconfig} - do - echo "${yellow}${qslines}${end}" - done -fi - -## -# @brief Display a message with specific formatting based on message type. -# @param type The type of message (e.g., std, info, debug, etc.) -# @param ... The keys or additional strings to be formatted and displayed. -function _msg() { - local type=$1 - shift # Remove the first argument so $@ now contains only keys or additional strings - - local full_msg="" - for arg in "$@"; do - if [[ -n "${qsgenlang[$arg]}" ]]; then - full_msg+="${qsgenlang[$arg]}" - else - full_msg+="$arg" - fi - done - - # Determine the color based on the type - local color="${end}" # Default to no color if type is unrecognized - case $type in - std) color="${green}" ;; - info) color="${yellow}" ;; - debug) color="${red}" ;; - other) color="${bold_yellow}" ;; - sub) color="${magenta}" ;; - main) color="${white}${green_bg}" ;; - esac - - # Use printf with %b to allow backslash escape interpretation - printf "${color}%b${end}\n" "${full_msg}" -} - -## -# @brief Display the version information of the script. -# @param ... Additional arguments (unused in this function). -function _version() { - _msg info "_qsgen2_msg_7" "-$(strftime "%Y")" - echo "${yellow}- https://github.com/kekePower/qsgen2/${end}" - _msg info "_qsgen2_msg_8" " '${1} help' " "_qsgen2_msg_8.1" - exit -} - -## -# @brief Display help information for the script. -# @param ... Additional arguments (unused in this function). -function _help() { - # This will also be translated some time in the future - echo "This is where I'll write the Help documentation." - exit -} - -if [[ "$1" == "version" || "$1" == "-v" || "$1" == "--version" ]]; then - _version ${0:t} -elif [[ "$1" == "help" || "$1" == "-h" || "$1" == "--help" ]]; then - _help ${0:t} -fi - -# Define cache files for blogs and pages -blog_cache_file="${config[project_root]}/.blog_cache" -pages_cache_file="${config[project_root]}/.pages_cache" - -# Let's check if qsgen2 can generate this site by checking if 'generator' is available -if [[ ! ${config[project_generator]} ]] || [[ -d $(pwd)/.git ]]; then - _msg debug "_qsgen2_msg_3" - exit -fi - -# We define the variable 'engine' based on what's in the 'config' file. -if [[ ${config[project_generator]} == "native" ]]; then - # Usage: ${engine} ${1} - Where 1 is the file you want to convert - engine=_qstags - export file_ext="qst" -elif [[ ${config[project_generator]} == "markdown" ]]; then - if [[ ! -f /usr/local/bin/pandoc ]]; then - _msg other "_qsgen2_msg_4" - _msg other "https://github.com/jgm/pandoc/releases" - exit - else - # Usage: ${engine} ${1} - Where 1 is the file you want parsed - engine="/usr/local/bin/pandoc" - engine_opts= - export file_ext="md" - fi -else - _msg debug "_qsgen2_msg_5" - exit -fi - -## -# @brief Run the configured engine to process the input file. -# @param input The input file to be processed. -function _run_engine() { - # Usage: _run_engine - local debug=false - - if [[ ${config[project_generator]} == "native" ]]; then - ${engine} ${1} - elif [[ ${config[project_generator]} == "markdown" ]]; then - echo "${1} | ${engine} ${engine_opts}" - else - _msg debug "ERROR running engine: ${engine}!" - _msg info "Usage: _run_engine " - exit - fi -} - -if (${globaldebug}); then _msg debug "_qsgen2_msg_6"; fi - -builtin cd ${config[project_root]} - -# Loading Zsh modules -zmodload zsh/files -zmodload zsh/datetime -zmodload zsh/regex - -# Let's put these here for now. -export today=$(strftime "%Y-%m-%d - %T") -export blogdate=$(strftime "%a-%Y-%b-%d") - -# Let's create arrays of all the files we'll be working on - -## -# @brief List all page files and store them in an array. -function _list_pages() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # Initialize or clear the array to ensure it's empty before adding files - pages_file_array=() - - export no_pages_found=false - - # Temporarily set null_glob for this function - setopt local_options null_glob - - # Using an array to directly capture matching files - local -a pages_files=(*.${file_ext}) - - if (( ${#pages_files} == 0 )); then - if ${debug}; then _msg debug "${0:t}_msg_1" " ${file_ext}."; fi - export no_pages_found=true - return - else - for file in "${pages_files[@]}"; do - if ${debug}; then _msg debug "${0:t}_msg_2" " ${file}"; fi - pages_file_array+=("$file") - done - fi - -} - -## -# @brief List all blog files and store them in an array. -function _list_blogs() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # Initialize or clear the blogs array to ensure it's empty before adding files - blogs_file_array=() - - export no_blogs_found=false - - # Temporarily set null_glob for this function - setopt local_options null_glob - - # Directly capture matching blog files into an array - local -a blog_files=(blog/*.blog(On)) - - if (( ${#blog_files[@]} == 0 )); then - if ${debug}; then _msg debug "${0:t}_msg_1"; fi - export no_blogs_found=true - return - else - for file in "${blog_files[@]}" - do - if ${debug}; then _msg debug "${0:t}_msg_2" " $file"; fi - blogs_file_array+=("$file") - done - fi - -} - - -## -# @brief Cache the state of blog files and identify changes. -function _blog_cache() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - _list_blogs - - # Create an associative array for the blog cache - typeset -A blog_cache - - # Load the existing blog cache - if [[ -f $blog_cache_file ]]; then - while IFS=':' read -r name hash; do - blog_cache[$name]=$hash - if (${debug}) _msg debug "${0:t}_msg_1" " ${blog_cache[${name}]}" - done < "$blog_cache_file" - fi - - # Initialize the array for storing blog files to process - make_blog_array=() - - # Process blog files - for blog_file in ${blogs_file_array[@]}; do - # Compute the current blog file hash - current_hash=$(md5sum "$blog_file" | awk '{print $1}') - - if (${debug}) _msg debug "${0:t}_msg_2" " ${blog_file}" - if (${debug}) _msg debug "${0:t}_msg_3" " ${current_hash}" - - # Check if the blog file is new or has changed - if [[ ${blog_cache[$blog_file]} != "$current_hash" ]]; then - if (${debug}) _msg debug "${0:t}_msg_4" " ${blog_file}" - if (${debug}) _msg debug "${0:t}_msg_5" " ${current_hash}" - # Blog file is new or has changed; add it to the processing array - make_blog_array+=("$blog_file") - - # Update the blog cache with the new hash - blog_cache[$blog_file]=$current_hash - fi - done - - # Rebuild the blog cache file from scratch - : >| "$blog_cache_file" # Truncate the file before writing - for name in "${(@k)blog_cache}"; do - echo "$name:${blog_cache[$name]}" >> "$blog_cache_file" - done - -} - - -## -# @brief Cache the state of page files and identify changes. -# @return Array of pages to be processed. -function _pages_cache() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # Create an associative array for the pages cache - typeset -A pages_cache - - _list_pages - - # Load the existing pages cache - if [[ -f $pages_cache_file ]]; then - while IFS=':' read -r name hash; do - pages_cache[$name]=$hash - if (${debug}) _msg debug "${0:t}_msg_1" " ${pages_cache[${name}]}" - done < "$pages_cache_file" - fi - - # Initialize the array for storing pages files to process - pages_array=() - - # Process pages files - for file in ${pages_file_array[@]}; do - # Compute the current blog file hash - current_hash=$(md5sum "$file" | awk '{print $1}') - - if (${debug}) _msg debug "${0:t}_msg_2" " ${pages_cache[$file]}" - if (${debug}) _msg debug "${0:t}_msg_3" " current_cache: ${current_hash}" - - # Check if the pages file is new or has changed - if [[ ${pages_cache[$file]} != "$current_hash" ]]; then - if (${debug}) _msg debug "${0:t}_msg_4" " ${pages_cache[$file]}" - if (${debug}) _msg debug "${0:t}_msg_5" " current_cache: ${current_hash}" - - # Pages file is new or has changed; add it to the processing array - pages_array+=("$file") - - # Update the pages cache with the new hash - pages_cache[$file]=$current_hash - fi - done - - # Rebuild the pages cache file from scratch - : >| "$pages_cache_file" # Truncate the file before writing - for name in "${(@k)pages_cache}"; do - echo "$name:${pages_cache[$name]}" >> "$pages_cache_file" - done - -} - -## -# @brief Update #updated and #version tags in the provided content. -# @param content The content to be updated. -# @return The updated content. -function _last_updated() { - # This function updates #updated and #version tags in the provided string for buffers - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - 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}" - - # Perform the replacements - local updated_content=$(echo "${content}" | sed \ - -e "s|#updated|${upd_msg}|") - - # Return the updated content - echo "${updated_content}" - -} - -## -# @brief Update #updated and #version tags in the provided file. -# @param file_path The path to the file to be updated. -function _f_last_updated() { - # Updates #updated and #version tags in the provided file using Zsh - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # local file_path="${1}" - local upd_msg="Last updated ${today} by ${QSGEN} ${VERSION}" - - if ${debug}; then - _msg debug "${0:t}_msg_1" " ${1}" - _msg debug "${0:t}_msg_2" " ${upd_msg}" - fi - - # Read the file content into a variable - local content="$(<${1})" - - # Perform the replacement - content="${content//#updated/${upd_msg}}" - - if [[ -f "${1}" ]]; then - sed -i -e "s|#updated|${upd_msg}|" "${1}" - else - _msg debug "${0:t}_msg_3" " '${1}' " "${0:t}_msg_3.1" - fi - -} - -## -# @brief Convert the filename to lowercase and replace spaces with dashes. -# @param filename The original filename. -# @return The modified filename. -function _file_to_lower() { - - local filename="${1}" - - # Replace spaces with dashes - filename="${filename// /-}" - - # Convert to lowercase and remove invalid characters - filename=$(echo "${filename}" | sed -e 's/^[^a-zA-Z0-9_.]+//g' -e 's/[^a-zA-Z0-9_-]+/-/g') - - echo ${filename} - -} - - -## -# @brief Generate all new and updated pages. -function _pages() { - # This function generates all the new and updated Pages - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - _msg main "${0:t}_msg_3" - - # Load the cache for Pages - 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 pages_array is not empty, we do work - 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 - - # Let's check if we can access the pages.tpl file. - # It not, exit script. - if [[ ! -f ${pages} ]]; then - _msg info "${0:t}_msg_6" " ${pages}" - exit - else - # Read template once - if (${debug}) _msg debug "${0:t}_msg_7" - local pages_tpl="$(<${pages})" - fi - - # _msg std " - ${pages_in_array%.*}.html" - # Read the file once - 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 "${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 - #local page_title=$( echo ${page_content} | head -2 | grep \#title | cut -d= -f2 ) - fi - done <<< "$page_content" - elif [[ ${config[project_generator]} == "markdown" ]]; then - while IFS= read -r line - do - # Check if the line starts with '#' and capture the line - if [[ "$line" == \#* ]]; then - # Remove all leading '#' characters and the first space (if present) - local page_title="${line#\#}" # Remove the first '#' character - page_title="${page_title#\#}" # Remove the second '#' character if present - page_title="${page_title#"${page_title%%[![:space:]]*}"}" # Trim leading whitespace - break # Exit the loop after finding the first heading - fi - done <<< ${page_content} - fi - _msg std " - ${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 "${0:t}_msg_12" - page_content=$( echo ${page_content} | grep -v \#title ) - - # HTML'ify the page content - if (${debug}) _msg debug "${0:t}_msg_13" " ${pages_in_array}" - page_content=$( _run_engine "$page_content" ) - # Look for links, images and videos and convert them if present. - 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 - - # Replace every #pagetitle 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|${config[site_tagline]}|gs; s|#sitename|${config[site_name]}|gs") - - 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 "${0:t}_msg_20" - pages_tpl=$( _last_updated ${pages_tpl} ) - - # Always use lowercase for file names - 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 "${0:t}_msg_22" - pages_tpl=$( _cleanup "${pages_tpl}" ) - - # Write pages_tpl to disk - # _msg std "Writing ${config[site_root]}/${pages_title_lower%.*}.html to disk." - echo "${pages_tpl}" > ${config[site_root]}/${pages_title_lower%.*}.html - - # 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}" && ${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 - # 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 [[ ${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 - -} - -## -# @brief Generate or update blog files or export metadata based on argument. -function _blogs() { - # This function either generates blog files or exports metadata based on the argument - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - _msg main "${0:t}_msg_3" - - # Running function _list_blogs - if (${debug}) _msg debug "${0:t}_msg_1" - _list_blogs - - if [[ ${no_blogs_found} == "true" ]]; then - _msg sub "${0:t}_msg_2" - return - fi - - # Running function _blog_cache - if (${debug}) _msg debug "${0:t}_msg_4" - _blog_cache - - if (( ${#make_blog_array[@]} > 0 )); then - - # Declare the array to hold metadata strings for each blog - BLOG_META_STR_ARRAY=() - - # Regular blog creation process - - if [[ -f ${config[project_root]}/themes/${config[site_theme]}/blogs.tpl ]]; then - local blog_tpl=$(<"${config[project_root]}/themes/${config[site_theme]}/blogs.tpl") - else - _msg info "${0:t}_msg_5" - exit - fi - - for blog in "${make_blog_array[@]}"; do - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg info "**************************FOR LOOP START*********************************" - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg debug "${0:t}_msg_6" " ${blog}" - - local content="$(<"${blog}")" - local sdate btitle ingress body blog_index blog_dir blog_url - - # Initialize variables to track if DATE and BLOG_TITLE are found - local date_found=false - local title_found=false - - # Process content line by line - while IFS= read -r line - do - # Check for the DATE line - if [[ "${line}" == "DATE "* ]]; then - 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 "${0:t}_msg_8" - title_found=true - fi - # If both DATE and BLOG_TITLE are found, no need to continue checking - if [[ "${date_found}" == true && "${title_found}" == true ]]; then - break - fi - done <<< "${content}" - - # Check if DATE or BLOG_TITLE metadata is missing and log message - if [[ "${date_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_9" " ${blog}." - continue # Skip this file and move to the next - fi - if [[ "${title_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_10" " ${blog}." - continue # Skip this file and move to the next - fi - - # Extract blog information - sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) ) - if [[ ${config[project_generator]} == "native" ]]; then - if (${debug}) _msg debug "* qstags: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == "BLOG_TITLE "* ]]; then - btitle="${line#BLOG_TITLE }" - break - fi - done <<< "$content" - elif [[ ${config[project_generator]} == "markdown" ]]; then - if (${debug}) _msg debug "* markdown: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == \#* ]]; then - btitle="${line#\#}" # Remove the first '#' character - btitle="${btitle#\#}" # Remove the second '#' character if present - btitle="${btitle#"${btitle%%[![:space:]]*}"}" # Trim leading whitespace - break # Exit the loop after finding the first heading - fi - done <<< "$content" - fi - if (${debug}) _msg debug "* Fetching INGRESS" - ingress=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | sed "s|\ \#INGRESS_STOP||" | sed "s|^\ ||" ) - if (${debug}) _msg debug "* Fetching BODY" - body=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#BODY_START\K(.*?)#BODY_STOP" | sed "s|\ \#BODY_STOP||" | sed "s|^\ ||" ) - - blog_index=$(echo "${btitle:l}" | sed 's/ /_/g; s/,//g; s/\.//g; s/://g; s/[()]//g') - - blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" - blog_url="${blog_dir}/${blog_index}.html" - - 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 "${0:t}_msg_12" " ${blog}" - - _msg std " - ${btitle}" - - # Prepare the blog template - if (${debug}) _msg debug "${0:t}_msg_14" " ${blog}" - local blog_content=$( - echo "${blog_tpl}" | \ - perl -pe "\ - s|BLOGTITLE|${btitle}|g; \ - s|BLOGURL|${blog_url}|g; \ - s|\QINGRESS\E|${ingress}|g; \ - s|\QBODY\E|${body}|g \ - ") - blog_content="${blog_content//CALNDAY/${sdate[4]}}" - blog_content="${blog_content//CALYEAR/${sdate[2]}}" - blog_content="${blog_content//CALMONTH/${sdate[3]}}" - blog_content="${blog_content//CALADAY/${sdate[1]}}" - - if (${debug}) _msg debug "${0:t}_msg_15" " ${engine} " "${0:t}_msg_15_1" " ${blog}" - blog_content=$( _run_engine "${blog_content}" ) - # Look for links, images and videos and convert them if present. - if (${debug}) _msg debug "${0:t}_msg_16" - if [[ $( echo ${blog_content} | grep \#link ) ]]; then - 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 "${0:t}_msg_18" - blog_content=$(_image "${blog_content}") - fi - if [[ $( echo ${blog_content} | grep \#ytvideo ) ]]; then - if (${debug}) _msg debug "${0:t}_msg_19" - blog_content=$(_youtube "${blog_content}") - fi - - # Replace every #tagline in blog_content - if (${debug}) _msg debug "${0:t}_msg_20" - blog_content=$( echo ${blog_content} | perl -pe "s|#tagline|${config[site_tagline]}|gs; s|#sitename|${config[site_name]}|gs; s|#pagetitle|${page_title}|gs" ) - - if (${debug}) _msg debug "* Running _last_updated" - blog_content=$(_last_updated "${blog_content}") - if (${debug}) _msg debug "* Running _cleanup" - blog_content=$(_cleanup "${blog_content}") - - # Create directory if it doesn't exist - if (${debug}) _msg debug "${0:t}_msg_21" " ${config[site_root]}${blog_dir}" - [[ ! -d "${config[site_root]}/${blog_dir}" ]] && mkdir -p "${config[site_root]}/${blog_dir}" - - # Write to file - if (${debug}) _msg debug "${0:t}_msg_22" " ${config[site_root]}${blog_url}" - echo "${blog_content}" > "${config[site_root]}${blog_url}" - - unset sdate btitle ingress body blog_index blog_dir blog_url - - done - # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post - export BLOG_META_STR_ARRAY - if (${debug}) _msg debug "${0:t}_msg_23" - export new_updated_blogs=true - - else - _msg sub "${0:t}_msg_24" - export new_updated_blogs=false - fi - - if [[ ${new_updated_blogs} == "true" ]]; then - if (${debug}) _msg sub "${0:t}_msg_25" - _blog_idx_for_index - if (${debug}) _msg sub "${0:t}_msg_26" - _blog_index - fi - -} - -## -# @brief Generate the file blog/index.tmp.html. -function _blog_idx_for_index() { - # This function generates the file blog/index.tmp.html - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - _msg sub "${0:t}_msg_1" " ${config[project_root]}/blog/index.tmp.html" - - if (${debug}) _msg debug "${0:t}_msg_2" - - local blog_list_tpl=$(<${config[project_root]}/themes/${config[site_theme]}/blog_list.tpl) - local blog_list_content="" - - # Truncate file before writing new one - : >| "${config[project_root]}/blog/index.tmp.html" - - # 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 "${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}") - - # Initialize variables to store each component - local sdate btitle ingress url - - # Iterate over each component and extract information - if (${debug}) _msg debug "${0:t}_msg_6" - for component in "${meta_array[@]}" - do - case "${component}" in - SDATE:*) sdate=${component#SDATE: } ;; - BTITLE:*) btitle=${component#BTITLE: } ;; - INGRESS:*) ingress=${component#INGRESS: } ;; - URL:*) url=${component#URL: } ;; - esac - - done - - local adate=( $( echo ${sdate} ) ) - local caladay="${adate[1]}" - local calyear="${adate[2]}" - local calmonth="${adate[3]}" - local calnday="${adate[4]}" - - local bdate="${adate[1]} - ${adate[4]}/${adate[3]}/${adate[2]}" - blog_list_content+=$( - echo "${blog_list_tpl}" | \ - perl -pe "\ - s|BLOGURL|${config[site_url]}${url}|g; \ - s|BLOGTITLE|${btitle}|g; \ - s|INGRESS|${ingress}|g; \ - s|BLOGDATE|${bdate}|g; \ - s|CALADAY|${caladay}|g; \ - s|CALNDAY|${calnday}|g; \ - s|CALMONTH|${calmonth}|g; \ - s|CALYEAR|${calyear}|g \ - ") - - unset sdate btitle ingress url adate caladay calyear calmonth calnday - - done - if (${debug}) _msg debug "${0:t}_msg_7" " ${engine} " "${0:t}_msg_7.1" - # Catch any QStags or Markdown in the Ingress - blog_list_content=$( _run_engine ${blog_list_content} ) - if (${debug}) _msg debug "${0:t}_msg_8" " ${config[project_root]}/blog/index.tmp.html" - #if (${debug}) _msg debug "${0:t}_msg_9" " ${blog_list_content}" - echo ${blog_list_content} > ${config[project_root]}/blog/index.tmp.html - -} - -## -# @brief Generate the www_root/blog/index.html file. -function _blog_index() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # This function generates the www_root/blog/index.html file that gets its data from _blog_list_for_index() - # ${new_updated_blogs} comes from the function _blogs if anything new or updated is detected - if ([[ ${config[site_blog]} == "false" ]] && [[ ${new_updated_blogs} = "true" ]]); then - - if (${debug}) _msg debug "${0:t}_msg_1" "${config[site_blog]}" - 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" " ${config[site_blog]}" - - _msg std "${0:t}_msg_5" " ${config[site_root]}/blog/index.html" - - local blog_index_tpl=$(<${config[project_root]}/themes/${config[site_theme]}/blog_index.tpl) - local blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) - - if (${debug}) _msg debug "${0:t}_msg_6" - local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${config[site_name]}|gs; s|#tagline|${config[site_tagline]}|gs") - if (${debug}) _msg debug "${0:t}_msg_7" " ${config[project_root]}/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 "${0:t}_msg_8" " ${config[site_root]}/blog/index.html" - _msg debug "${0:t}_msg_9" " ${#blog_index_content}" - fi - echo "$blog_index_content" > ${config[site_root]}/blog/index.html - _f_last_updated ${config[site_root]}/blog/index.html - - fi - -} - -## -# @brief Add the blog list to the index file if blog_in_index is true. -function _add_blog_list_to_index() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # Let's find the file 'index.qst' and add the blog if blog_in_index is true - if (${debug}) _msg debug "${0:t}_msg_1" - local blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) - local site_index_file=$(<${config[site_root]}/index.html) - echo "${site_index_file}" | awk -v new_body="${blog_index_list}" '{sub(/BLOGINDEX/, new_body)} 1' > "${config[site_root]}/index.html" - -} - -## -# @brief Generate the sitemap files if conditions are met. -function _sitemap() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - # Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file. - if ([[ ${config[site_sitemap]} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] )) || [[ ${sitemap_force} == "true" ]]; then - - setopt extendedglob - - _msg main "${0:t}_msg_1" - - local sm_file="sitemap.xml" - local b_file="sitemap-blogs.xml" - local p_file="sitemap-pages.xml" - local sitemap_file="${config[site_root]}/${sm_file}" - local sitemap_blog="${config[site_root]}/${b_file}" - local sitemap_page="${config[site_root]}/${p_file}" - - # Find all HTML files and store them in an array - builtin cd ${config[site_root]} - local -a html_files=(**/[a-z]*.html(.)) - local -a blog_files=() - local -a page_files=() - for file in "${html_files[@]}"; do - if [[ $file == *blog* ]]; then - blog_files+=("$file") - else - page_files+=("$file") - fi - done - - # Start of the XML file for BLOGS - echo '' > ${sitemap_blog} - echo "" >> ${sitemap_blog} - echo "" >> ${sitemap_blog} - echo '> ${sitemap_blog} - echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_blog} - echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_blog} - echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_blog} - echo '>' >> ${sitemap_blog} - - # Add each URL to the sitemap - for file in "${blog_files[@]}" - do - # Remove www_root from the path and prepend site_url - local url="${config[site_url]}/${file}" - local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - - echo " " >> ${sitemap_blog} - echo " ${url}" >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - done - - # End of the XML file - echo '' >> "${sitemap_blog}" - _msg std " - ${b_file}" - - # Start of the XML file for PAGES - echo '' > ${sitemap_page} - echo "" >> ${sitemap_page} - echo "" >> ${sitemap_page} - echo '> ${sitemap_page} - echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_page} - echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_page} - echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_page} - echo '>' >> ${sitemap_page} - - # Add each URL to the sitemap - for file in "${page_files[@]}" - do - # Remove www_root from the path and prepend site_url - local url="${config[site_url]}/${file}" - local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - - echo " " >> ${sitemap_page} - echo " ${url}" >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - done - - # End of the XML file - echo '' >> "${sitemap_page}" - _msg std " - ${p_file}" - - if (${debug}); then _msg debug "${0:t}_msg_2" " ${sitemap_file}"; fi - - # Start of the XML file for the main sitemap - echo '' > "${sitemap_file}" - echo "" >> "${sitemap_file}" - - # Add sitemap-blogs.xml to the sitemap - echo " " >> "${sitemap_file}" - echo " ${config[site_url]}/${b_file}" >> "${sitemap_file}" - local lastmod_b=$(stat -c %y "${b_file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - echo " ${lastmod_b}" >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - - # Add sitemap-pages.xml to the sitemap - echo " " >> "${sitemap_file}" - echo " ${config[site_url]}/${p_file}" >> "${sitemap_file}" - local lastmod_p=$(stat -c %y "${p_file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - echo " ${lastmod_p}" >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - - # End of the XML file - echo "" >> "${sitemap_file}" - _msg std " - ${sm_file}" - - builtin cd ${config[project_root]} - - fi - -} - -## -# @brief Convert #link tags to clickable HTML links. -# @param content The content containing #link tags. -# @return The content with #link tags replaced by HTML links. -function _link() { - # This converts #link tags to actual clickable links in a provided string - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - local modified_content="" - - # Process the content line by line - echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#link"* ]]; then - 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 "${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}" - if [[ ${url_dest} =~ ^https?:// ]]; then - # Add external link icon for external URLs - modified_link+="\"External" - fi - modified_link+="" - line=${line//"#link ${url_full}"/${modified_link}} - fi - modified_content+="${line}\n" - done - - # Return the modified content - echo -e "${modified_content}" - -} - -## -# @brief Convert #showimg tags to HTML img tags. -# @param content The content containing #showimg tags. -# @return The content with #showimg tags replaced by HTML img tags. -function _image() { - # This replaces #showimg tags with actual HTML img tags in a provided string - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - local modified_content="" - - # Process the content line by line - echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#showimg"* ]]; then - 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}') - local image=$(echo "${img_link}" | awk -F'¤' '{print $1}') - local img_alt=$(echo "${img_link}" | awk -F'¤' '{print $2}') - - # Determine the source of the image - local real_image="" - if [[ ${image} =~ ^https?:// ]]; then - real_image=${image} - elif [[ ${image} =~ ^\/ ]]; then - real_image=${image} - else - real_image="/images/${image}" - fi - - # Form the replacement HTML image tag - local img_tag="\"${img_alt}\"" - line=${line//"#showimg ${img_link}"/${img_tag}} - fi - modified_content+="${line}\n" - done - - # Return the modified content - echo -e "${modified_content}" - -} - -## -# @brief Embed a YouTube video in the provided content. -# @param content The content containing #ytvideo tags. -# @return The content with #ytvideo tags replaced by YouTube iframe embeds. -function _youtube() { - # This embeds a YouTube video in a provided string - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - local modified_content="" - - # Process the content line by line - echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#ytvideo"* ]]; then - if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" - - # Extract YouTube video ID - local yt_id=$(echo "${line}" | awk -F'#ytvideo ' '{print $2}') - - # Form the replacement YouTube iframe embed - local yt_iframe="" - line=${line//"#ytvideo ${yt_id}"/${yt_iframe}} - fi - modified_content+="${line}\n" - done - - # Return the modified content - echo -e "${modified_content}" - -} - -## -# @brief Remove leftover tags from the content. -# @param content The content to be cleaned. -# @return The cleaned content. -function _cleanup() { - # This removes tags used in the templates that may be left over for some reason - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - - if (${debug}) _msg debug "${0:t}_msg_1" - - # Perform the cleanup - # -e "s|BLOGINDEX\ ||g" - local cleaned_content=$(echo "${content}" | sed \ - -e "s|¤||g" \ - -e "s|#showimg\ ||g" \ - -e "s|#ytvideo\ ||g" \ - -e "s|#link\ ||g" \ - ) - - # Return the cleaned content - echo "${cleaned_content}" - -} - -## -# @brief Convert QStags to HTML using Perl. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. -function _p_qstags() { - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - - if ${debug}; then - _msg debug "${0:t}_msg_1" - fi - - # Use perl to convert QStags to HTML - perl -0777 -pe ' - BEGIN { - @qstags = ( - "#BR", "
\n", - "#BD", "", "#EBD", "", - "#I", "", "#EI", "\n", - "#P", "

", "#EP", "

\n", - "#Q", "
", "#EQ", "
\n", - "#C", "", "#EC", "\n", - "#H1", "

", "#EH1", "

\n", - "#H2", "

", "#EH2", "

\n", - "#H3", "

", "#EH3", "

\n", - "#H4", "

", "#EH4", "

\n", - "#H5", "
", "#EH5", "
\n", - "#H6", "
", "#EH6", "
\n", - "#STRONG", "", "#ESTRONG", "\n", - "#EM", "", "#SEM", "\n", - "#DV", "
", "#EDV", "
\n", - "#SPN", "", "#ESPN", "\n", - "#UL", "
    ", "#EUL", "
\n", - "#OL", "
    ", "#EOL", "
\n", - "#LI", "
  • ", "#ELI", "
  • \n", - "#UD", "", "#EUD", "\n", - "#TBL", "", "#ETBL", "
    \n", - "#TR", "", "#ETR", "\n", - "#TD", "", "#ETD", "\n", - "#TH", "", "#ETH", "\n", - "#ART", "
    ", "#EART", "
    \n", - "#SEC", "
    ", "#ESEC", "
    \n", - "#ASIDE", "\n", - "#NAV", "\n", - "#BTN", "\n", - "#SEL", "\n", - "#OPT", "\n", - "#LT", "<", "#GT", ">", "#NUM", "#" - ); - } - - for (my $i = 0; $i < $#qstags; $i += 2) { - my $qstag = $qstags[$i]; - my $html = $qstags[$i + 1]; - s/\Q$qstag\E/$html/g; - } - ' <<< "$content" - -} - -## -# @brief Convert QStags to HTML using Zsh regex module. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. -function _qstags() { - - # This function uses the regex module from Zsh to parse the QStags - - if [[ ${globaldebug} == "true" ]]; then - local debug=true - else - local debug=false - fi - - local content="${1}" - - if ${debug}; then - _msg debug "${0:t}_msg_1" - fi - - # Load regex module - # zmodload zsh/regex - - # Define tag replacements as an associative array - typeset -A qstags=( - "#BR" "
    \n" - "#BD" "" "#EBD" "" - "#I" "" "#EI" "\n" - "#P" "

    " "#EP" "

    \n" - "#Q" "
    " "#EQ" "
    \n" - "#C" "" "#EC" "\n" - "#H1" "

    " "#EH1" "

    \n" - "#H2" "

    " "#EH2" "

    \n" - "#H3" "

    " "#EH3" "

    \n" - "#H4" "

    " "#EH4" "

    \n" - "#H5" "
    " "#EH5" "
    \n" - "#H6" "
    " "#EH6" "
    \n" - "#STRONG" "" "#ESTRONG" "\n" - "#EM" "" "#SEM" "\n" - "#DV" "
    " "#EDV" "
    \n" - "#SPN" "" "#ESPN" "\n" - "#UL" "
      " "#EUL" "
    \n" - "#OL" "
      " "#EOL" "
    \n" - "#LI" "
  • " "#ELI" "
  • \n" - "#UD" "" "#EUD" "\n" - "#TBL" "" "#ETBL" "
    \n" - "#TR" "" "#ETR" "\n" - "#TD" "" "#ETD" "\n" - "#TH" "" "#ETH" "\n" - "#ART" "
    " "#EART" "
    \n" - "#SEC" "
    " "#ESEC" "
    \n" - "#ASIDE" "\n" - "#NAV" "\n" - "#BTN" "\n" - "#SEL" "\n" - "#OPT" "\n" - "#LT" "<" "#GT" ">" "#NUM" "#" - ) - - #for qstag html (${(kv)qstags}) - # do - # # Escape tag for regex use - # local escapedTag=$(printf '%s' "$qstag" | sed 's/[].\[^$*]/\\&/g') - # if [[ "$content" =~ "$escapedTag" ]]; then - # content=${content//($qstag)/$html} - # fi - #done - for qstag html (${(kv)qstags}); do - # Direct replacement without regex check - content=${content//${qstag}/${html}} - done - - echo "${content}" - -} - - -case ${1} in - force) - _msg sub "_qsgen2_msg_2" - : >| "$blog_cache_file" # Truncate the blog cache before doing update - : >| "$pages_cache_file" # Truncate the page cache before doing update - ;; - sitemap) - _msg sub "Updating sitemaps" - export sitemap_force=true - _sitemap - exit - ;; - *) - # Nothing - ;; -esac - -_blogs -_pages -_sitemap diff --git a/docs/zsdoc/data/features/qsgen2/Script_Body_/autoload b/docs/zsdoc/data/features/qsgen2/Script_Body_/autoload deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/Script_Body_/autoload +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/Script_Body_/export b/docs/zsdoc/data/features/qsgen2/Script_Body_/export deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/Script_Body_/export +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/Script_Body_/source b/docs/zsdoc/data/features/qsgen2/Script_Body_/source deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/Script_Body_/source +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/Script_Body_/zmodload b/docs/zsdoc/data/features/qsgen2/Script_Body_/zmodload deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/Script_Body_/zmodload +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_blogs/export b/docs/zsdoc/data/features/qsgen2/_blogs/export deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_blogs/export +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_list_blogs/export b/docs/zsdoc/data/features/qsgen2/_list_blogs/export deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_list_blogs/export +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_list_blogs/setopt b/docs/zsdoc/data/features/qsgen2/_list_blogs/setopt deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_list_blogs/setopt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_list_pages/export b/docs/zsdoc/data/features/qsgen2/_list_pages/export deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_list_pages/export +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_list_pages/setopt b/docs/zsdoc/data/features/qsgen2/_list_pages/setopt deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_list_pages/setopt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_pages/export b/docs/zsdoc/data/features/qsgen2/_pages/export deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_pages/export +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_pages/read b/docs/zsdoc/data/features/qsgen2/_pages/read deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_pages/read +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/features/qsgen2/_sitemap/setopt b/docs/zsdoc/data/features/qsgen2/_sitemap/setopt deleted file mode 100644 index 8b13789..0000000 --- a/docs/zsdoc/data/features/qsgen2/_sitemap/setopt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/zsdoc/data/functions/qsgen2/_add_blog_list_to_index b/docs/zsdoc/data/functions/qsgen2/_add_blog_list_to_index deleted file mode 100644 index 8348282..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_add_blog_list_to_index +++ /dev/null @@ -1,9 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -if (${debug}) _msg debug "${0:t}_msg_1" -local blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) -local site_index_file=$(<${config[site_root]}/index.html) -echo "${site_index_file}" | awk -v new_body="${blog_index_list}" '{sub(/BLOGINDEX/, new_body)} 1' > "${config[site_root]}/index.html" diff --git a/docs/zsdoc/data/functions/qsgen2/_blog_cache b/docs/zsdoc/data/functions/qsgen2/_blog_cache deleted file mode 100644 index 72a1727..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_blog_cache +++ /dev/null @@ -1,31 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -_list_blogs -typeset -A blog_cache -if [[ -f $blog_cache_file ]]; then - while IFS=':' read -r name hash; do - blog_cache[$name]=$hash - if (${debug}) _msg debug "${0:t}_msg_1" " ${blog_cache[${name}]}" - done < "$blog_cache_file" -fi -make_blog_array=() -for blog_file in ${blogs_file_array[@]}; do - current_hash=$(md5sum "$blog_file" | awk '{print $1}') - - if (${debug}) _msg debug "${0:t}_msg_2" " ${blog_file}" - if (${debug}) _msg debug "${0:t}_msg_3" " ${current_hash}" - if [[ ${blog_cache[$blog_file]} != "$current_hash" ]]; then - if (${debug}) _msg debug "${0:t}_msg_4" " ${blog_file}" - if (${debug}) _msg debug "${0:t}_msg_5" " ${current_hash}" - make_blog_array+=("$blog_file") - blog_cache[$blog_file]=$current_hash - fi -done -: >| "$blog_cache_file" -for name in "${(@k)blog_cache}"; do - echo "$name:${blog_cache[$name]}" >> "$blog_cache_file" -done diff --git a/docs/zsdoc/data/functions/qsgen2/_blog_idx_for_index b/docs/zsdoc/data/functions/qsgen2/_blog_idx_for_index deleted file mode 100644 index a3b706e..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_blog_idx_for_index +++ /dev/null @@ -1,59 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -_msg sub "${0:t}_msg_1" " ${config[project_root]}/blog/index.tmp.html" - -if (${debug}) _msg debug "${0:t}_msg_2" - -local blog_list_tpl=$(<${config[project_root]}/themes/${config[site_theme]}/blog_list.tpl) -local blog_list_content="" -: >| "${config[project_root]}/blog/index.tmp.html" - -for meta_str in ${BLOG_META_STR_ARRAY[@]} - do - if (${debug}) _msg debug "${0:t}_msg_4" - if (${debug}) _msg debug "${0:t}_msg_5" " ${meta_str}" - local -a meta_array=("${(@s/||/)meta_str}") - local sdate btitle ingress url - if (${debug}) _msg debug "${0:t}_msg_6" - for component in "${meta_array[@]}" - do - case "${component}" in - SDATE:*) sdate=${component#SDATE: } ;; - BTITLE:*) btitle=${component#BTITLE: } ;; - INGRESS:*) ingress=${component#INGRESS: } ;; - URL:*) url=${component#URL: } ;; - esac - - done - - local adate=( $( echo ${sdate} ) ) - local caladay="${adate[1]}" - local calyear="${adate[2]}" - local calmonth="${adate[3]}" - local calnday="${adate[4]}" - - local bdate="${adate[1]} - ${adate[4]}/${adate[3]}/${adate[2]}" - blog_list_content+=$( - echo "${blog_list_tpl}" | \ - perl -pe "\ - s|BLOGURL|${config[site_url]}${url}|g; \ - s|BLOGTITLE|${btitle}|g; \ - s|INGRESS|${ingress}|g; \ - s|BLOGDATE|${bdate}|g; \ - s|CALADAY|${caladay}|g; \ - s|CALNDAY|${calnday}|g; \ - s|CALMONTH|${calmonth}|g; \ - s|CALYEAR|${calyear}|g \ - ") - - unset sdate btitle ingress url adate caladay calyear calmonth calnday - -done -if (${debug}) _msg debug "${0:t}_msg_7" " ${engine} " "${0:t}_msg_7.1" -blog_list_content=$( _run_engine ${blog_list_content} ) -if (${debug}) _msg debug "${0:t}_msg_8" " ${config[project_root]}/blog/index.tmp.html" -echo ${blog_list_content} > ${config[project_root]}/blog/index.tmp.html diff --git a/docs/zsdoc/data/functions/qsgen2/_blog_index b/docs/zsdoc/data/functions/qsgen2/_blog_index deleted file mode 100644 index ebb8f44..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_blog_index +++ /dev/null @@ -1,30 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -if ([[ ${config[site_blog]} == "false" ]] && [[ ${new_updated_blogs} = "true" ]]); then - - if (${debug}) _msg debug "${0:t}_msg_1" "${config[site_blog]}" - 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" " ${config[site_blog]}" - - _msg std "${0:t}_msg_5" " ${config[site_root]}/blog/index.html" - - local blog_index_tpl=$(<${config[project_root]}/themes/${config[site_theme]}/blog_index.tpl) - local blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) - - if (${debug}) _msg debug "${0:t}_msg_6" - local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${config[site_name]}|gs; s|#tagline|${config[site_tagline]}|gs") - if (${debug}) _msg debug "${0:t}_msg_7" " ${config[project_root]}/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 "${0:t}_msg_8" " ${config[site_root]}/blog/index.html" - _msg debug "${0:t}_msg_9" " ${#blog_index_content}" - fi - echo "$blog_index_content" > ${config[site_root]}/blog/index.html - _f_last_updated ${config[site_root]}/blog/index.html - -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_blogs b/docs/zsdoc/data/functions/qsgen2/_blogs deleted file mode 100644 index 22fb45c..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_blogs +++ /dev/null @@ -1,155 +0,0 @@ -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" -_list_blogs - -if [[ ${no_blogs_found} == "true" ]]; then - _msg sub "${0:t}_msg_2" - return -fi -if (${debug}) _msg debug "${0:t}_msg_4" -_blog_cache - -if (( ${#make_blog_array[@]} > 0 )); then - BLOG_META_STR_ARRAY=() - - if [[ -f ${config[project_root]}/themes/${config[site_theme]}/blogs.tpl ]]; then - local blog_tpl=$(<"${config[project_root]}/themes/${config[site_theme]}/blogs.tpl") - else - _msg info "${0:t}_msg_5" - exit - fi - - for blog in "${make_blog_array[@]}"; do - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg info "**************************FOR LOOP START*********************************" - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg debug "${0:t}_msg_6" " ${blog}" - - local content="$(<"${blog}")" - local sdate btitle ingress body blog_index blog_dir blog_url - local date_found=false - local title_found=false - while IFS= read -r line - do - if [[ "${line}" == "DATE "* ]]; then - if (${debug}) _msg debug "${0:t}_msg_7" - date_found=true - fi - if [[ "${line}" == "BLOG_TITLE "* ]]; then - if (${debug}) _msg debug "${0:t}_msg_8" - title_found=true - fi - if [[ "${date_found}" == true && "${title_found}" == true ]]; then - break - fi - done <<< "${content}" - if [[ "${date_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_9" " ${blog}." - continue - fi - if [[ "${title_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_10" " ${blog}." - continue - fi - sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) ) - if [[ ${config[project_generator]} == "native" ]]; then - if (${debug}) _msg debug "* qstags: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == "BLOG_TITLE "* ]]; then - btitle="${line#BLOG_TITLE }" - break - fi - done <<< "$content" - elif [[ ${config[project_generator]} == "markdown" ]]; then - if (${debug}) _msg debug "* markdown: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == \#* ]]; then - btitle="${line#\#}" - btitle="${btitle#\#}" - btitle="${btitle#"${btitle%%[![:space:]]*}"}" - break - fi - done <<< "$content" - fi - if (${debug}) _msg debug "* Fetching INGRESS" - ingress=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | sed "s|\ \#INGRESS_STOP||" | sed "s|^\ ||" ) - if (${debug}) _msg debug "* Fetching BODY" - body=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#BODY_START\K(.*?)#BODY_STOP" | sed "s|\ \#BODY_STOP||" | sed "s|^\ ||" ) - - blog_index=$(echo "${btitle:l}" | sed 's/ /_/g; s/,//g; s/\.//g; s/://g; s/[()]//g') - - blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" - blog_url="${blog_dir}/${blog_index}.html" - - if (${debug}) _msg debug "${0:t}_msg_11" " ${blog} " "${0:t}_msg_11.1" - local metadata_str="SDATE: ${sdate[@]}||BTITLE: ${btitle}||INGRESS: ${ingress}||URL: ${blog_url}" - BLOG_META_STR_ARRAY+=("${metadata_str}") - - if (${debug}) _msg debug "${0:t}_msg_12" " ${blog}" - - _msg std " - ${btitle}" - if (${debug}) _msg debug "${0:t}_msg_14" " ${blog}" - local blog_content=$( - echo "${blog_tpl}" | \ - perl -pe "\ - s|BLOGTITLE|${btitle}|g; \ - s|BLOGURL|${blog_url}|g; \ - s|\QINGRESS\E|${ingress}|g; \ - s|\QBODY\E|${body}|g \ - ") - blog_content="${blog_content//CALNDAY/${sdate[4]}}" - blog_content="${blog_content//CALYEAR/${sdate[2]}}" - blog_content="${blog_content//CALMONTH/${sdate[3]}}" - blog_content="${blog_content//CALADAY/${sdate[1]}}" - - if (${debug}) _msg debug "${0:t}_msg_15" " ${engine} " "${0:t}_msg_15_1" " ${blog}" - blog_content=$( _run_engine "${blog_content}" ) - if (${debug}) _msg debug "${0:t}_msg_16" - if [[ $( echo ${blog_content} | grep \#link ) ]]; then - 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 "${0:t}_msg_18" - blog_content=$(_image "${blog_content}") - fi - if [[ $( echo ${blog_content} | grep \#ytvideo ) ]]; then - if (${debug}) _msg debug "${0:t}_msg_19" - blog_content=$(_youtube "${blog_content}") - fi - if (${debug}) _msg debug "${0:t}_msg_20" - blog_content=$( echo ${blog_content} | perl -pe "s|#tagline|${config[site_tagline]}|gs; s|#sitename|${config[site_name]}|gs; s|#pagetitle|${page_title}|gs" ) - - if (${debug}) _msg debug "* Running _last_updated" - blog_content=$(_last_updated "${blog_content}") - if (${debug}) _msg debug "* Running _cleanup" - blog_content=$(_cleanup "${blog_content}") - if (${debug}) _msg debug "${0:t}_msg_21" " ${config[site_root]}${blog_dir}" - [[ ! -d "${config[site_root]}/${blog_dir}" ]] && mkdir -p "${config[site_root]}/${blog_dir}" - if (${debug}) _msg debug "${0:t}_msg_22" " ${config[site_root]}${blog_url}" - echo "${blog_content}" > "${config[site_root]}${blog_url}" - - unset sdate btitle ingress body blog_index blog_dir blog_url - - done - export BLOG_META_STR_ARRAY - if (${debug}) _msg debug "${0:t}_msg_23" - export new_updated_blogs=true - -else - _msg sub "${0:t}_msg_24" - export new_updated_blogs=false -fi - -if [[ ${new_updated_blogs} == "true" ]]; then - if (${debug}) _msg sub "${0:t}_msg_25" - _blog_idx_for_index - if (${debug}) _msg sub "${0:t}_msg_26" - _blog_index -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_cleanup b/docs/zsdoc/data/functions/qsgen2/_cleanup deleted file mode 100644 index eeb4cbe..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_cleanup +++ /dev/null @@ -1,16 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" - -if (${debug}) _msg debug "${0:t}_msg_1" -local cleaned_content=$(echo "${content}" | sed \ - -e "s|¤||g" \ - -e "s|#showimg\ ||g" \ - -e "s|#ytvideo\ ||g" \ - -e "s|#link\ ||g" \ - ) -echo "${cleaned_content}" diff --git a/docs/zsdoc/data/functions/qsgen2/_f_last_updated b/docs/zsdoc/data/functions/qsgen2/_f_last_updated deleted file mode 100644 index e02b84a..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_f_last_updated +++ /dev/null @@ -1,19 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -local upd_msg="Last updated ${today} by ${QSGEN} ${VERSION}" - -if ${debug}; then - _msg debug "${0:t}_msg_1" " ${1}" - _msg debug "${0:t}_msg_2" " ${upd_msg}" -fi -local content="$(<${1})" -content="${content//#updated/${upd_msg}}" - -if [[ -f "${1}" ]]; then - sed -i -e "s|#updated|${upd_msg}|" "${1}" -else - _msg debug "${0:t}_msg_3" " '${1}' " "${0:t}_msg_3.1" -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_file_to_lower b/docs/zsdoc/data/functions/qsgen2/_file_to_lower deleted file mode 100644 index 3e10d4d..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_file_to_lower +++ /dev/null @@ -1,5 +0,0 @@ -local filename="${1}" -filename="${filename// /-}" -filename=$(echo "${filename}" | sed -e 's/^[^a-zA-Z0-9_.]+//g' -e 's/[^a-zA-Z0-9_-]+/-/g') - -echo ${filename} diff --git a/docs/zsdoc/data/functions/qsgen2/_help b/docs/zsdoc/data/functions/qsgen2/_help deleted file mode 100644 index b076b5d..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_help +++ /dev/null @@ -1,2 +0,0 @@ - echo "This is where I'll write the Help documentation." -exit diff --git a/docs/zsdoc/data/functions/qsgen2/_image b/docs/zsdoc/data/functions/qsgen2/_image deleted file mode 100644 index 7d25dbf..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_image +++ /dev/null @@ -1,28 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" -local modified_content="" -echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#showimg"* ]]; then - if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" - local img_link=$(echo "${line}" | awk -F'#showimg ' '{print $2}') - local image=$(echo "${img_link}" | awk -F'¤' '{print $1}') - local img_alt=$(echo "${img_link}" | awk -F'¤' '{print $2}') - local real_image="" - if [[ ${image} =~ ^https?:// ]]; then - real_image=${image} - elif [[ ${image} =~ ^\/ ]]; then - real_image=${image} - else - real_image="/images/${image}" - fi - local img_tag="\"${img_alt}\"" - line=${line//"#showimg ${img_link}"/${img_tag}} - fi - modified_content+="${line}\n" -done -echo -e "${modified_content}" diff --git a/docs/zsdoc/data/functions/qsgen2/_last_updated b/docs/zsdoc/data/functions/qsgen2/_last_updated deleted file mode 100644 index cb5693b..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_last_updated +++ /dev/null @@ -1,15 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -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}" -local updated_content=$(echo "${content}" | sed \ - -e "s|#updated|${upd_msg}|") -echo "${updated_content}" diff --git a/docs/zsdoc/data/functions/qsgen2/_link b/docs/zsdoc/data/functions/qsgen2/_link deleted file mode 100644 index 180b797..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_link +++ /dev/null @@ -1,27 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" -local modified_content="" -echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#link"* ]]; then - if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" - 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 "${0:t}_msg_2" " ${url_dest}" - if (${debug}) _msg debug "${0:t}_msg_3" " ${url_txt}" - local modified_link="${url_txt}" - if [[ ${url_dest} =~ ^https?:// ]]; then - modified_link+="\"External" - fi - modified_link+="" - line=${line//"#link ${url_full}"/${modified_link}} - fi - modified_content+="${line}\n" -done -echo -e "${modified_content}" diff --git a/docs/zsdoc/data/functions/qsgen2/_list_blogs b/docs/zsdoc/data/functions/qsgen2/_list_blogs deleted file mode 100644 index d67a068..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_list_blogs +++ /dev/null @@ -1,22 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -blogs_file_array=() - -export no_blogs_found=false -setopt local_options null_glob -local -a blog_files=(blog/*.blog(On)) - -if (( ${#blog_files[@]} == 0 )); then - if ${debug}; then _msg debug "${0:t}_msg_1"; fi - export no_blogs_found=true - return -else - for file in "${blog_files[@]}" - do - if ${debug}; then _msg debug "${0:t}_msg_2" " $file"; fi - blogs_file_array+=("$file") - done -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_list_pages b/docs/zsdoc/data/functions/qsgen2/_list_pages deleted file mode 100644 index 893d8ac..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_list_pages +++ /dev/null @@ -1,21 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -pages_file_array=() - -export no_pages_found=false -setopt local_options null_glob -local -a pages_files=(*.${file_ext}) - -if (( ${#pages_files} == 0 )); then - if ${debug}; then _msg debug "${0:t}_msg_1" " ${file_ext}."; fi - export no_pages_found=true - return -else - for file in "${pages_files[@]}"; do - if ${debug}; then _msg debug "${0:t}_msg_2" " ${file}"; fi - pages_file_array+=("$file") - done -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_msg b/docs/zsdoc/data/functions/qsgen2/_msg deleted file mode 100644 index f18c940..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_msg +++ /dev/null @@ -1,21 +0,0 @@ -local type=$1 -shift - -local full_msg="" -for arg in "$@"; do - if [[ -n "${qsgenlang[$arg]}" ]]; then - full_msg+="${qsgenlang[$arg]}" - else - full_msg+="$arg" - fi -done -local color="${end}" -case $type in - std) color="${green}" ;; - info) color="${yellow}" ;; - debug) color="${red}" ;; - other) color="${bold_yellow}" ;; - sub) color="${magenta}" ;; - main) color="${white}${green_bg}" ;; -esac -printf "${color}%b${end}\n" "${full_msg}" diff --git a/docs/zsdoc/data/functions/qsgen2/_p_qstags b/docs/zsdoc/data/functions/qsgen2/_p_qstags deleted file mode 100644 index e413ff9..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_p_qstags +++ /dev/null @@ -1,55 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" - -if ${debug}; then - _msg debug "${0:t}_msg_1" -fi -perl -0777 -pe ' - BEGIN { - @qstags = ( - "#BR", "
    \n", - "#BD", "", "#EBD", "", - "#I", "", "#EI", "\n", - "#P", "

    ", "#EP", "

    \n", - "#Q", "
    ", "#EQ", "
    \n", - "#C", "", "#EC", "\n", - "#H1", "

    ", "#EH1", "

    \n", - "#H2", "

    ", "#EH2", "

    \n", - "#H3", "

    ", "#EH3", "

    \n", - "#H4", "

    ", "#EH4", "

    \n", - "#H5", "
    ", "#EH5", "
    \n", - "#H6", "
    ", "#EH6", "
    \n", - "#STRONG", "", "#ESTRONG", "\n", - "#EM", "", "#SEM", "\n", - "#DV", "
    ", "#EDV", "
    \n", - "#SPN", "", "#ESPN", "\n", - "#UL", "
      ", "#EUL", "
    \n", - "#OL", "
      ", "#EOL", "
    \n", - "#LI", "
  • ", "#ELI", "
  • \n", - "#UD", "", "#EUD", "\n", - "#TBL", "", "#ETBL", "
    \n", - "#TR", "", "#ETR", "\n", - "#TD", "", "#ETD", "\n", - "#TH", "", "#ETH", "\n", - "#ART", "
    ", "#EART", "
    \n", - "#SEC", "
    ", "#ESEC", "
    \n", - "#ASIDE", "\n", - "#NAV", "\n", - "#BTN", "\n", - "#SEL", "\n", - "#OPT", "\n", - "#LT", "<", "#GT", ">", "#NUM", "#" - ); - } - - for (my $i = 0; $i < $#qstags; $i += 2) { - my $qstag = $qstags[$i]; - my $html = $qstags[$i + 1]; - s/\Q$qstag\E/$html/g; - } - ' <<< "$content" diff --git a/docs/zsdoc/data/functions/qsgen2/_pages b/docs/zsdoc/data/functions/qsgen2/_pages deleted file mode 100644 index d2ee3cd..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_pages +++ /dev/null @@ -1,108 +0,0 @@ -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 diff --git a/docs/zsdoc/data/functions/qsgen2/_pages_cache b/docs/zsdoc/data/functions/qsgen2/_pages_cache deleted file mode 100644 index a4336c6..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_pages_cache +++ /dev/null @@ -1,31 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -typeset -A pages_cache - -_list_pages -if [[ -f $pages_cache_file ]]; then - while IFS=':' read -r name hash; do - pages_cache[$name]=$hash - if (${debug}) _msg debug "${0:t}_msg_1" " ${pages_cache[${name}]}" - done < "$pages_cache_file" -fi -pages_array=() -for file in ${pages_file_array[@]}; do - current_hash=$(md5sum "$file" | awk '{print $1}') - - if (${debug}) _msg debug "${0:t}_msg_2" " ${pages_cache[$file]}" - if (${debug}) _msg debug "${0:t}_msg_3" " current_cache: ${current_hash}" - if [[ ${pages_cache[$file]} != "$current_hash" ]]; then - if (${debug}) _msg debug "${0:t}_msg_4" " ${pages_cache[$file]}" - if (${debug}) _msg debug "${0:t}_msg_5" " current_cache: ${current_hash}" - pages_array+=("$file") - pages_cache[$file]=$current_hash - fi -done -: >| "$pages_cache_file" -for name in "${(@k)pages_cache}"; do - echo "$name:${pages_cache[$name]}" >> "$pages_cache_file" -done diff --git a/docs/zsdoc/data/functions/qsgen2/_qstags b/docs/zsdoc/data/functions/qsgen2/_qstags deleted file mode 100644 index 4154834..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_qstags +++ /dev/null @@ -1,50 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" - -if ${debug}; then - _msg debug "${0:t}_msg_1" -fi -typeset -A qstags=( - "#BR" "
    \n" - "#BD" "" "#EBD" "" - "#I" "" "#EI" "\n" - "#P" "

    " "#EP" "

    \n" - "#Q" "
    " "#EQ" "
    \n" - "#C" "" "#EC" "\n" - "#H1" "

    " "#EH1" "

    \n" - "#H2" "

    " "#EH2" "

    \n" - "#H3" "

    " "#EH3" "

    \n" - "#H4" "

    " "#EH4" "

    \n" - "#H5" "
    " "#EH5" "
    \n" - "#H6" "
    " "#EH6" "
    \n" - "#STRONG" "" "#ESTRONG" "\n" - "#EM" "" "#SEM" "\n" - "#DV" "
    " "#EDV" "
    \n" - "#SPN" "" "#ESPN" "\n" - "#UL" "
      " "#EUL" "
    \n" - "#OL" "
      " "#EOL" "
    \n" - "#LI" "
  • " "#ELI" "
  • \n" - "#UD" "" "#EUD" "\n" - "#TBL" "" "#ETBL" "
    \n" - "#TR" "" "#ETR" "\n" - "#TD" "" "#ETD" "\n" - "#TH" "" "#ETH" "\n" - "#ART" "
    " "#EART" "
    \n" - "#SEC" "
    " "#ESEC" "
    \n" - "#ASIDE" "\n" - "#NAV" "\n" - "#BTN" "\n" - "#SEL" "\n" - "#OPT" "\n" - "#LT" "<" "#GT" ">" "#NUM" "#" - ) - for qstag html (${(kv)qstags}); do - content=${content//${qstag}/${html}} - done - - echo "${content}" diff --git a/docs/zsdoc/data/functions/qsgen2/_run_engine b/docs/zsdoc/data/functions/qsgen2/_run_engine deleted file mode 100644 index 944f561..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_run_engine +++ /dev/null @@ -1,11 +0,0 @@ -local debug=false - -if [[ ${config[project_generator]} == "native" ]]; then - ${engine} ${1} -elif [[ ${config[project_generator]} == "markdown" ]]; then - echo "${1} | ${engine} ${engine_opts}" -else - _msg debug "ERROR running engine: ${engine}!" - _msg info "Usage: _run_engine " - exit -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_sitemap b/docs/zsdoc/data/functions/qsgen2/_sitemap deleted file mode 100644 index a95367f..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_sitemap +++ /dev/null @@ -1,92 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi -if ([[ ${config[site_sitemap]} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] )) || [[ ${sitemap_force} == "true" ]]; then - - setopt extendedglob - - _msg main "${0:t}_msg_1" - - local sm_file="sitemap.xml" - local b_file="sitemap-blogs.xml" - local p_file="sitemap-pages.xml" - local sitemap_file="${config[site_root]}/${sm_file}" - local sitemap_blog="${config[site_root]}/${b_file}" - local sitemap_page="${config[site_root]}/${p_file}" - builtin cd ${config[site_root]} - local -a html_files=(**/[a-z]*.html(.)) - local -a blog_files=() - local -a page_files=() - for file in "${html_files[@]}"; do - if [[ $file == *blog* ]]; then - blog_files+=("$file") - else - page_files+=("$file") - fi - done - echo '' > ${sitemap_blog} - echo "" >> ${sitemap_blog} - echo "" >> ${sitemap_blog} - echo '> ${sitemap_blog} - echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_blog} - echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_blog} - echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_blog} - echo '>' >> ${sitemap_blog} - for file in "${blog_files[@]}" - do - local url="${config[site_url]}/${file}" - local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - - echo " " >> ${sitemap_blog} - echo " ${url}" >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - echo " " >> ${sitemap_blog} - done - echo '' >> "${sitemap_blog}" - _msg std " - ${b_file}" - echo '' > ${sitemap_page} - echo "" >> ${sitemap_page} - echo "" >> ${sitemap_page} - echo '> ${sitemap_page} - echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_page} - echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_page} - echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_page} - echo '>' >> ${sitemap_page} - for file in "${page_files[@]}" - do - local url="${config[site_url]}/${file}" - local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - - echo " " >> ${sitemap_page} - echo " ${url}" >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - echo " " >> ${sitemap_page} - done - echo '' >> "${sitemap_page}" - _msg std " - ${p_file}" - - if (${debug}); then _msg debug "${0:t}_msg_2" " ${sitemap_file}"; fi - echo '' > "${sitemap_file}" - echo "" >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - echo " ${config[site_url]}/${b_file}" >> "${sitemap_file}" - local lastmod_b=$(stat -c %y "${b_file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - echo " ${lastmod_b}" >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - echo " ${config[site_url]}/${p_file}" >> "${sitemap_file}" - local lastmod_p=$(stat -c %y "${p_file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//') - echo " ${lastmod_p}" >> "${sitemap_file}" - echo " " >> "${sitemap_file}" - echo "" >> "${sitemap_file}" - _msg std " - ${sm_file}" - - builtin cd ${config[project_root]} - -fi diff --git a/docs/zsdoc/data/functions/qsgen2/_version b/docs/zsdoc/data/functions/qsgen2/_version deleted file mode 100644 index 67fb6fb..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_version +++ /dev/null @@ -1,4 +0,0 @@ -_msg info "_qsgen2_msg_7" "-$(strftime "%Y")" -echo "${yellow}- https://github.com/kekePower/qsgen2/${end}" -_msg info "_qsgen2_msg_8" " '${1} help' " "_qsgen2_msg_8.1" -exit diff --git a/docs/zsdoc/data/functions/qsgen2/_youtube b/docs/zsdoc/data/functions/qsgen2/_youtube deleted file mode 100644 index f1e9a52..0000000 --- a/docs/zsdoc/data/functions/qsgen2/_youtube +++ /dev/null @@ -1,18 +0,0 @@ -if [[ ${globaldebug} == "true" ]]; then - local debug=true -else - local debug=false -fi - -local content="${1}" -local modified_content="" -echo "${content}" | while IFS= read -r line; do - if [[ ${line} == *"#ytvideo"* ]]; then - if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" - local yt_id=$(echo "${line}" | awk -F'#ytvideo ' '{print $2}') - local yt_iframe="" - line=${line//"#ytvideo ${yt_id}"/${yt_iframe}} - fi - modified_content+="${line}\n" -done -echo -e "${modified_content}" diff --git a/docs/zsdoc/data/rev_call_tree.zsd b/docs/zsdoc/data/rev_call_tree.zsd deleted file mode 100644 index b68ee26..0000000 --- a/docs/zsdoc/data/rev_call_tree.zsd +++ /dev/null @@ -1,14 +0,0 @@ -qsgen2/_add_blog_list_to_index: qsgen2/_pages -qsgen2/_blog_cache: qsgen2/_blogs -qsgen2/_blog_idx_for_index: qsgen2/_blogs -qsgen2/_blog_index: qsgen2/_blogs -qsgen2/_blogs: qsgen2/zsd_script_body -qsgen2/_f_last_updated: qsgen2/_blog_index -qsgen2/_help: qsgen2/zsd_script_body -qsgen2/_list_blogs: qsgen2/_blog_cache qsgen2/_blogs -qsgen2/_list_pages: qsgen2/_pages_cache -qsgen2/_msg: qsgen2/_version qsgen2/zsd_script_body qsgen2/_run_engine qsgen2/_list_pages qsgen2/_list_blogs qsgen2/_last_updated qsgen2/_f_last_updated qsgen2/_pages qsgen2/_blogs qsgen2/_blog_idx_for_index qsgen2/_blog_index qsgen2/_sitemap qsgen2/_p_qstags qsgen2/_qstags -qsgen2/_pages: qsgen2/zsd_script_body -qsgen2/_pages_cache: qsgen2/_pages -qsgen2/_sitemap: qsgen2/zsd_script_body -qsgen2/_version: qsgen2/zsd_script_body diff --git a/docs/zsdoc/data/trees/qsgen2/Script_Body_.tree b/docs/zsdoc/data/trees/qsgen2/Script_Body_.tree deleted file mode 100644 index 734f239..0000000 --- a/docs/zsdoc/data/trees/qsgen2/Script_Body_.tree +++ /dev/null @@ -1,28 +0,0 @@ -Script_Body_ -|-- _blogs -|   |-- _blog_cache -|   |   `-- _list_blogs -|   |   `-- _msg -|   |-- _blog_idx_for_index -|   |   `-- _msg -|   |-- _blog_index -|   |   |-- _f_last_updated -|   |   |   `-- _msg -|   |   `-- _msg -|   |-- _list_blogs -|   |   `-- _msg -|   `-- _msg -|-- _help -|-- _msg -|-- _pages -|   |-- _add_blog_list_to_index -|   |-- _msg -|   `-- _pages_cache -|   `-- _list_pages -|   `-- _msg -|-- _sitemap -|   `-- _msg -`-- _version - `-- _msg - -26 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_blog_cache.tree b/docs/zsdoc/data/trees/qsgen2/_blog_cache.tree deleted file mode 100644 index 328ef4a..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_blog_cache.tree +++ /dev/null @@ -1,5 +0,0 @@ -_blog_cache -`-- _list_blogs - `-- _msg - -3 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_blog_idx_for_index.tree b/docs/zsdoc/data/trees/qsgen2/_blog_idx_for_index.tree deleted file mode 100644 index 48e59fd..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_blog_idx_for_index.tree +++ /dev/null @@ -1,4 +0,0 @@ -_blog_idx_for_index -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_blog_index.tree b/docs/zsdoc/data/trees/qsgen2/_blog_index.tree deleted file mode 100644 index 1d43b91..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_blog_index.tree +++ /dev/null @@ -1,6 +0,0 @@ -_blog_index -|-- _f_last_updated -|   `-- _msg -`-- _msg - -4 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_blogs.tree b/docs/zsdoc/data/trees/qsgen2/_blogs.tree deleted file mode 100644 index 820bc0c..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_blogs.tree +++ /dev/null @@ -1,15 +0,0 @@ -_blogs -|-- _blog_cache -|   `-- _list_blogs -|   `-- _msg -|-- _blog_idx_for_index -|   `-- _msg -|-- _blog_index -|   |-- _f_last_updated -|   |   `-- _msg -|   `-- _msg -|-- _list_blogs -|   `-- _msg -`-- _msg - -13 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_f_last_updated.tree b/docs/zsdoc/data/trees/qsgen2/_f_last_updated.tree deleted file mode 100644 index 2079f72..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_f_last_updated.tree +++ /dev/null @@ -1,4 +0,0 @@ -_f_last_updated -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_last_updated.tree b/docs/zsdoc/data/trees/qsgen2/_last_updated.tree deleted file mode 100644 index bea0bb2..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_last_updated.tree +++ /dev/null @@ -1,4 +0,0 @@ -_last_updated -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_list_blogs.tree b/docs/zsdoc/data/trees/qsgen2/_list_blogs.tree deleted file mode 100644 index 7f077b7..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_list_blogs.tree +++ /dev/null @@ -1,4 +0,0 @@ -_list_blogs -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_list_pages.tree b/docs/zsdoc/data/trees/qsgen2/_list_pages.tree deleted file mode 100644 index 52bf9ad..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_list_pages.tree +++ /dev/null @@ -1,4 +0,0 @@ -_list_pages -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_p_qstags.tree b/docs/zsdoc/data/trees/qsgen2/_p_qstags.tree deleted file mode 100644 index 332b781..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_p_qstags.tree +++ /dev/null @@ -1,4 +0,0 @@ -_p_qstags -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_pages.tree b/docs/zsdoc/data/trees/qsgen2/_pages.tree deleted file mode 100644 index 051f5d8..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_pages.tree +++ /dev/null @@ -1,8 +0,0 @@ -_pages -|-- _add_blog_list_to_index -|-- _msg -`-- _pages_cache - `-- _list_pages - `-- _msg - -6 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_pages_cache.tree b/docs/zsdoc/data/trees/qsgen2/_pages_cache.tree deleted file mode 100644 index bf6bdd6..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_pages_cache.tree +++ /dev/null @@ -1,5 +0,0 @@ -_pages_cache -`-- _list_pages - `-- _msg - -3 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_qstags.tree b/docs/zsdoc/data/trees/qsgen2/_qstags.tree deleted file mode 100644 index 2829821..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_qstags.tree +++ /dev/null @@ -1,4 +0,0 @@ -_qstags -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_run_engine.tree b/docs/zsdoc/data/trees/qsgen2/_run_engine.tree deleted file mode 100644 index 92f3028..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_run_engine.tree +++ /dev/null @@ -1,4 +0,0 @@ -_run_engine -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_sitemap.tree b/docs/zsdoc/data/trees/qsgen2/_sitemap.tree deleted file mode 100644 index 069657f..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_sitemap.tree +++ /dev/null @@ -1,4 +0,0 @@ -_sitemap -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/data/trees/qsgen2/_version.tree b/docs/zsdoc/data/trees/qsgen2/_version.tree deleted file mode 100644 index 5a0c255..0000000 --- a/docs/zsdoc/data/trees/qsgen2/_version.tree +++ /dev/null @@ -1,4 +0,0 @@ -_version -`-- _msg - -2 directories, 0 files diff --git a/docs/zsdoc/qsgen2.adoc b/docs/zsdoc/qsgen2.adoc deleted file mode 100644 index 8e800cb..0000000 --- a/docs/zsdoc/qsgen2.adoc +++ /dev/null @@ -1,517 +0,0 @@ -qsgen2(1) -========= -:compat-mode!: - -NAME ----- -qsgen2 - a shell script - -SYNOPSIS --------- -Documentation automatically generated with `zsdoc' - -FUNCTIONS ---------- - - _add_blog_list_to_index - _blog_cache - _blog_idx_for_index - _blog_index - _blogs - _cleanup - _file_to_lower - _f_last_updated - _help - _image - _last_updated - _link - _list_blogs - _list_pages - _msg - _pages - _pages_cache - _p_qstags - _qstags - _run_engine - _sitemap - _version - _youtube - -DETAILS -------- - -Script Body -~~~~~~~~~~~ - -Has 101 line(s). Calls functions: - - Script-Body - |-- _blogs - |   |-- _blog_cache - |   |   `-- _list_blogs - |   |   `-- _msg - |   |-- _blog_idx_for_index - |   |   `-- _msg - |   |-- _blog_index - |   |   |-- _f_last_updated - |   |   |   `-- _msg - |   |   `-- _msg - |   |-- _list_blogs - |   |   `-- _msg - |   `-- _msg - |-- _help - |-- _msg - |-- _pages - |   |-- _add_blog_list_to_index - |   |-- _msg - |   `-- _pages_cache - |   `-- _list_pages - |   `-- _msg - |-- _sitemap - |   `-- _msg - `-- _version - `-- _msg - -Uses feature(s): _autoload_, _export_, _source_, _zmodload_ - -_Exports (environment):_ blogdate [big]*//* file_ext [big]*//* sitemap_force [big]*//* today - -_add_blog_list_to_index -~~~~~~~~~~~~~~~~~~~~~~~ - -____ - ## - # @brief Add the blog list to the index file if blog_in_index is true. -____ - -Has 9 line(s). Doesn't call other functions. - -Called by: - - _pages - -_blog_cache -~~~~~~~~~~~ - -____ - ## - # @brief Cache the state of blog files and identify changes. -____ - -Has 31 line(s). Calls functions: - - _blog_cache - `-- _list_blogs - `-- _msg - -Called by: - - _blogs - -_blog_idx_for_index -~~~~~~~~~~~~~~~~~~~ - -____ - ## - # @brief Generate the file blog/index.tmp.html. -____ - -Has 59 line(s). Calls functions: - - _blog_idx_for_index - `-- _msg - -Called by: - - _blogs - -_Environment variables used:_ BLOG_META_STR_ARRAY - -_blog_index -~~~~~~~~~~~ - -____ - ## - # @brief Generate the www_root/blog/index.html file. -____ - -Has 30 line(s). Calls functions: - - _blog_index - |-- _f_last_updated - |   `-- _msg - `-- _msg - -Called by: - - _blogs - -_Environment variables used:_ new_updated_blogs - -_blogs -~~~~~~ - -____ - ## - # @brief Generate or update blog files or export metadata based on argument. -____ - -Has 155 line(s). Calls functions: - - _blogs - |-- _blog_cache - |   `-- _list_blogs - |   `-- _msg - |-- _blog_idx_for_index - |   `-- _msg - |-- _blog_index - |   |-- _f_last_updated - |   |   `-- _msg - |   `-- _msg - |-- _list_blogs - |   `-- _msg - `-- _msg - -Uses feature(s): _export_ - -Called by: - - Script-Body - -_List of exports (to environment):_ BLOG_META_STR_ARRAY [big]*//* new_updated_blogs - -_Environment variables used:_ new_updated_blogs [big]*//* no_blogs_found - -_cleanup -~~~~~~~~ - -____ - ## - # @brief Remove leftover tags from the content. - # @param content The content to be cleaned. - # @return The cleaned content. -____ - -Has 16 line(s). Doesn't call other functions. - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_file_to_lower -~~~~~~~~~~~~~~ - -____ - ## - # @brief Convert the filename to lowercase and replace spaces with dashes. - # @param filename The original filename. - # @return The modified filename. -____ - -Has 5 line(s). Doesn't call other functions. - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_f_last_updated -~~~~~~~~~~~~~~~ - -____ - ## - # @brief Update #updated and #version tags in the provided file. - # @param file_path The path to the file to be updated. -____ - -Has 19 line(s). Calls functions: - - _f_last_updated - `-- _msg - -Called by: - - _blog_index - -_Environment variables used:_ today - -_help -~~~~~ - -____ - ## - # @brief Display help information for the script. - # @param ... Additional arguments (unused in this function). -____ - -Has 2 line(s). Doesn't call other functions. - -Called by: - - Script-Body - -_image -~~~~~~ - -____ - ## - # @brief Convert #showimg tags to HTML img tags. - # @param content The content containing #showimg tags. - # @return The content with #showimg tags replaced by HTML img tags. -____ - -Has 28 line(s). Doesn't call other functions. - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_last_updated -~~~~~~~~~~~~~ - -____ - ## - # @brief Update #updated and #version tags in the provided content. - # @param content The content to be updated. - # @return The updated content. -____ - -Has 15 line(s). Calls functions: - - _last_updated - `-- _msg - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_Environment variables used:_ today - -_link -~~~~~ - -____ - ## - # @brief Convert #link tags to clickable HTML links. - # @param content The content containing #link tags. - # @return The content with #link tags replaced by HTML links. -____ - -Has 27 line(s). Doesn't call other functions. - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_list_blogs -~~~~~~~~~~~ - -____ - ## - # @brief List all blog files and store them in an array. -____ - -Has 22 line(s). Calls functions: - - _list_blogs - `-- _msg - -Uses feature(s): _export_, _setopt_ - -Called by: - - _blog_cache - _blogs - -_List of exports (to environment):_ no_blogs_found - -_list_pages -~~~~~~~~~~~ - -____ - ## - # @brief List all page files and store them in an array. -____ - -Has 21 line(s). Calls functions: - - _list_pages - `-- _msg - -Uses feature(s): _export_, _setopt_ - -Called by: - - _pages_cache - -_List of exports (to environment):_ no_pages_found - -_Environment variables used:_ file_ext - -_msg -~~~~ - -____ - ## - # @brief Display a message with specific formatting based on message type. - # @param type The type of message (e.g., std, info, debug, etc.) - # @param ... The keys or additional strings to be formatted and displayed. -____ - -Has 21 line(s). Doesn't call other functions. - -Called by: - - _blog_idx_for_index - _blog_index - _blogs - _f_last_updated - _last_updated - _list_blogs - _list_pages - _pages - _p_qstags - _qstags - _run_engine - Script-Body - _sitemap - _version - -_pages -~~~~~~ - -____ - ## - # @brief Generate all new and updated pages. -____ - -Has 108 line(s). Calls functions: - - _pages - |-- _add_blog_list_to_index - |-- _msg - `-- _pages_cache - `-- _list_pages - `-- _msg - -Uses feature(s): _export_, _read_ - -Called by: - - Script-Body - -_List of exports (to environment):_ new_updated_pages - -_Environment variables used:_ no_pages_found [big]*//* file_ext - -_pages_cache -~~~~~~~~~~~~ - -____ - ## - # @brief Cache the state of page files and identify changes. - # @return Array of pages to be processed. -____ - -Has 31 line(s). Calls functions: - - _pages_cache - `-- _list_pages - `-- _msg - -Called by: - - _pages - -_p_qstags -~~~~~~~~~ - -____ - ## - # @brief Convert QStags to HTML using Perl. - # @param content The content containing QStags. - # @return The content with QStags converted to HTML. -____ - -Has 55 line(s). Calls functions: - - _p_qstags - `-- _msg - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_qstags -~~~~~~~ - -____ - ## - # @brief Convert QStags to HTML using Zsh regex module. - # @param content The content containing QStags. - # @return The content with QStags converted to HTML. -____ - -Has 50 line(s). Calls functions: - - _qstags - `-- _msg - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_run_engine -~~~~~~~~~~~ - -____ - ## - # @brief Run the configured engine to process the input file. - # @param input The input file to be processed. -____ - -Has 11 line(s). Calls functions: - - _run_engine - `-- _msg - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - -_sitemap -~~~~~~~~ - -____ - ## - # @brief Generate the sitemap files if conditions are met. -____ - -Has 92 line(s). Calls functions: - - _sitemap - `-- _msg - -Uses feature(s): _setopt_ - -Called by: - - Script-Body - -_Environment variables used:_ new_updated_blogs [big]*//* new_updated_pages [big]*//* sitemap_force - -_version -~~~~~~~~ - -____ - ## - # @brief Display the version information of the script. - # @param ... Additional arguments (unused in this function). -____ - -Has 4 line(s). Calls functions: - - _version - `-- _msg - -Called by: - - Script-Body - -_youtube -~~~~~~~~ - -____ - ## - # @brief Embed a YouTube video in the provided content. - # @param content The content containing #ytvideo tags. - # @return The content with #ytvideo tags replaced by YouTube iframe embeds. -____ - -Has 18 line(s). Doesn't call other functions. - -Not called by script or any function (may be e.g. a hook, a Zle widget, etc.). - diff --git a/docs/zsdoc/qsgen2.html b/docs/zsdoc/qsgen2.html deleted file mode 100644 index bf0fbc8..0000000 --- a/docs/zsdoc/qsgen2.html +++ /dev/null @@ -1,1381 +0,0 @@ - - - - - - -qsgen2(1) - - - - - -
    -
    -

    NAME

    -
    -

    qsgen2 - a shell script

    -
    -
    -
    -

    SYNOPSIS

    -
    -

    Documentation automatically generated with ‘zsdoc’

    -
    -
    -
    -

    FUNCTIONS

    -
    -
    -
    -
    _add_blog_list_to_index
    -_blog_cache
    -_blog_idx_for_index
    -_blog_index
    -_blogs
    -_cleanup
    -_file_to_lower
    -_f_last_updated
    -_help
    -_image
    -_last_updated
    -_link
    -_list_blogs
    -_list_pages
    -_msg
    -_pages
    -_pages_cache
    -_p_qstags
    -_qstags
    -_run_engine
    -_sitemap
    -_version
    -_youtube
    -
    -
    -
    -
    -

    DETAILS

    -
    -
    -

    Script Body

    -

    Has 101 line(s). Calls functions:

    -
    -
    -
    Script-Body
    -|-- _blogs
    -|   |-- _blog_cache
    -|   |   `-- _list_blogs
    -|   |       `-- _msg
    -|   |-- _blog_idx_for_index
    -|   |   `-- _msg
    -|   |-- _blog_index
    -|   |   |-- _f_last_updated
    -|   |   |   `-- _msg
    -|   |   `-- _msg
    -|   |-- _list_blogs
    -|   |   `-- _msg
    -|   `-- _msg
    -|-- _help
    -|-- _msg
    -|-- _pages
    -|   |-- _add_blog_list_to_index
    -|   |-- _msg
    -|   `-- _pages_cache
    -|       `-- _list_pages
    -|           `-- _msg
    -|-- _sitemap
    -|   `-- _msg
    -`-- _version
    -    `-- _msg
    -
    -

    Uses feature(s): autoload, export, source, zmodload

    -

    Exports (environment): blogdate // file_ext // sitemap_force // today

    -
    -
    -

    _add_blog_list_to_index

    -
    -
    -
    -
    -
    ##
    -# @brief Add the blog list to the index file if blog_in_index is true.
    -
    -
    -
    -
    -

    Has 9 line(s). Doesn’t call other functions.

    -

    Called by:

    -
    -
    -
    _pages
    -
    -
    -
    -

    _blog_cache

    -
    -
    -
    -
    -
    ##
    -# @brief Cache the state of blog files and identify changes.
    -
    -
    -
    -
    -

    Has 31 line(s). Calls functions:

    -
    -
    -
    _blog_cache
    -`-- _list_blogs
    -    `-- _msg
    -
    -

    Called by:

    -
    -
    -
    _blogs
    -
    -
    -
    -

    _blog_idx_for_index

    -
    -
    -
    -
    -
    ##
    -# @brief Generate the file blog/index.tmp.html.
    -
    -
    -
    -
    -

    Has 59 line(s). Calls functions:

    -
    -
    -
    _blog_idx_for_index
    -`-- _msg
    -
    -

    Called by:

    -
    -
    -
    _blogs
    -
    -

    Environment variables used: BLOG_META_STR_ARRAY

    -
    -
    -

    _blog_index

    -
    -
    -
    -
    -
    ##
    -# @brief Generate the www_root/blog/index.html file.
    -
    -
    -
    -
    -

    Has 30 line(s). Calls functions:

    -
    -
    -
    _blog_index
    -|-- _f_last_updated
    -|   `-- _msg
    -`-- _msg
    -
    -

    Called by:

    -
    -
    -
    _blogs
    -
    -

    Environment variables used: new_updated_blogs

    -
    -
    -

    _blogs

    -
    -
    -
    -
    -
    ##
    -# @brief Generate or update blog files or export metadata based on argument.
    -
    -
    -
    -
    -

    Has 155 line(s). Calls functions:

    -
    -
    -
    _blogs
    -|-- _blog_cache
    -|   `-- _list_blogs
    -|       `-- _msg
    -|-- _blog_idx_for_index
    -|   `-- _msg
    -|-- _blog_index
    -|   |-- _f_last_updated
    -|   |   `-- _msg
    -|   `-- _msg
    -|-- _list_blogs
    -|   `-- _msg
    -`-- _msg
    -
    -

    Uses feature(s): export

    -

    Called by:

    -
    -
    -
    Script-Body
    -
    -

    List of exports (to environment): BLOG_META_STR_ARRAY // new_updated_blogs

    -

    Environment variables used: new_updated_blogs // no_blogs_found

    -
    -
    -

    _cleanup

    -
    -
    -
    -
    -
    ##
    -# @brief Remove leftover tags from the content.
    -# @param content The content to be cleaned.
    -# @return The cleaned content.
    -
    -
    -
    -
    -

    Has 16 line(s). Doesn’t call other functions.

    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _file_to_lower

    -
    -
    -
    -
    -
    ##
    -# @brief Convert the filename to lowercase and replace spaces with dashes.
    -# @param filename The original filename.
    -# @return The modified filename.
    -
    -
    -
    -
    -

    Has 5 line(s). Doesn’t call other functions.

    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _f_last_updated

    -
    -
    -
    -
    -
    ##
    -# @brief Update #updated and #version tags in the provided file.
    -# @param file_path The path to the file to be updated.
    -
    -
    -
    -
    -

    Has 19 line(s). Calls functions:

    -
    -
    -
    _f_last_updated
    -`-- _msg
    -
    -

    Called by:

    -
    -
    -
    _blog_index
    -
    -

    Environment variables used: today

    -
    -
    -

    _help

    -
    -
    -
    -
    -
    ##
    -# @brief Display help information for the script.
    -# @param ... Additional arguments (unused in this function).
    -
    -
    -
    -
    -

    Has 2 line(s). Doesn’t call other functions.

    -

    Called by:

    -
    -
    -
    Script-Body
    -
    -
    -
    -

    _image

    -
    -
    -
    -
    -
    ##
    -# @brief Convert #showimg tags to HTML img tags.
    -# @param content The content containing #showimg tags.
    -# @return The content with #showimg tags replaced by HTML img tags.
    -
    -
    -
    -
    -

    Has 28 line(s). Doesn’t call other functions.

    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _last_updated

    -
    -
    -
    -
    -
    ##
    -# @brief Update #updated and #version tags in the provided content.
    -# @param content The content to be updated.
    -# @return The updated content.
    -
    -
    -
    -
    -

    Has 15 line(s). Calls functions:

    -
    -
    -
    _last_updated
    -`-- _msg
    -
    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -

    Environment variables used: today

    -
    -
    - -
    -
    -
    -
    -
    ##
    -# @brief Convert #link tags to clickable HTML links.
    -# @param content The content containing #link tags.
    -# @return The content with #link tags replaced by HTML links.
    -
    -
    -
    -
    -

    Has 27 line(s). Doesn’t call other functions.

    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _list_blogs

    -
    -
    -
    -
    -
    ##
    -# @brief List all blog files and store them in an array.
    -
    -
    -
    -
    -

    Has 22 line(s). Calls functions:

    -
    -
    -
    _list_blogs
    -`-- _msg
    -
    -

    Uses feature(s): export, setopt

    -

    Called by:

    -
    -
    -
    _blog_cache
    -_blogs
    -
    -

    List of exports (to environment): no_blogs_found

    -
    -
    -

    _list_pages

    -
    -
    -
    -
    -
    ##
    -# @brief List all page files and store them in an array.
    -
    -
    -
    -
    -

    Has 21 line(s). Calls functions:

    -
    -
    -
    _list_pages
    -`-- _msg
    -
    -

    Uses feature(s): export, setopt

    -

    Called by:

    -
    -
    -
    _pages_cache
    -
    -

    List of exports (to environment): no_pages_found

    -

    Environment variables used: file_ext

    -
    -
    -

    _msg

    -
    -
    -
    -
    -
    ##
    -# @brief Display a message with specific formatting based on message type.
    -# @param type The type of message (e.g., std, info, debug, etc.)
    -# @param ... The keys or additional strings to be formatted and displayed.
    -
    -
    -
    -
    -

    Has 21 line(s). Doesn’t call other functions.

    -

    Called by:

    -
    -
    -
    _blog_idx_for_index
    -_blog_index
    -_blogs
    -_f_last_updated
    -_last_updated
    -_list_blogs
    -_list_pages
    -_pages
    -_p_qstags
    -_qstags
    -_run_engine
    -Script-Body
    -_sitemap
    -_version
    -
    -
    -
    -

    _pages

    -
    -
    -
    -
    -
    ##
    -# @brief Generate all new and updated pages.
    -
    -
    -
    -
    -

    Has 108 line(s). Calls functions:

    -
    -
    -
    _pages
    -|-- _add_blog_list_to_index
    -|-- _msg
    -`-- _pages_cache
    -    `-- _list_pages
    -        `-- _msg
    -
    -

    Uses feature(s): export, read

    -

    Called by:

    -
    -
    -
    Script-Body
    -
    -

    List of exports (to environment): new_updated_pages

    -

    Environment variables used: no_pages_found // file_ext

    -
    -
    -

    _pages_cache

    -
    -
    -
    -
    -
    ##
    -# @brief Cache the state of page files and identify changes.
    -# @return Array of pages to be processed.
    -
    -
    -
    -
    -

    Has 31 line(s). Calls functions:

    -
    -
    -
    _pages_cache
    -`-- _list_pages
    -    `-- _msg
    -
    -

    Called by:

    -
    -
    -
    _pages
    -
    -
    -
    -

    _p_qstags

    -
    -
    -
    -
    -
    ##
    -# @brief Convert QStags to HTML using Perl.
    -# @param content The content containing QStags.
    -# @return The content with QStags converted to HTML.
    -
    -
    -
    -
    -

    Has 55 line(s). Calls functions:

    -
    -
    -
    _p_qstags
    -`-- _msg
    -
    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _qstags

    -
    -
    -
    -
    -
    ##
    -# @brief Convert QStags to HTML using Zsh regex module.
    -# @param content The content containing QStags.
    -# @return The content with QStags converted to HTML.
    -
    -
    -
    -
    -

    Has 50 line(s). Calls functions:

    -
    -
    -
    _qstags
    -`-- _msg
    -
    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _run_engine

    -
    -
    -
    -
    -
    ##
    -# @brief Run the configured engine to process the input file.
    -# @param input The input file to be processed.
    -
    -
    -
    -
    -

    Has 11 line(s). Calls functions:

    -
    -
    -
    _run_engine
    -`-- _msg
    -
    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -

    _sitemap

    -
    -
    -
    -
    -
    ##
    -# @brief Generate the sitemap files if conditions are met.
    -
    -
    -
    -
    -

    Has 92 line(s). Calls functions:

    -
    -
    -
    _sitemap
    -`-- _msg
    -
    -

    Uses feature(s): setopt

    -

    Called by:

    -
    -
    -
    Script-Body
    -
    -

    Environment variables used: new_updated_blogs // new_updated_pages // sitemap_force

    -
    -
    -

    _version

    -
    -
    -
    -
    -
    ##
    -# @brief Display the version information of the script.
    -# @param ... Additional arguments (unused in this function).
    -
    -
    -
    -
    -

    Has 4 line(s). Calls functions:

    -
    -
    -
    _version
    -`-- _msg
    -
    -

    Called by:

    -
    -
    -
    Script-Body
    -
    -
    -
    -

    _youtube

    -
    -
    -
    -
    -
    ##
    -# @brief Embed a YouTube video in the provided content.
    -# @param content The content containing #ytvideo tags.
    -# @return The content with #ytvideo tags replaced by YouTube iframe embeds.
    -
    -
    -
    -
    -

    Has 18 line(s). Doesn’t call other functions.

    -

    Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

    -
    -
    -
    -
    -

    - - - diff --git a/include/qsgen2/lang/en_UK b/include/qsgen2/lang/en_UK index c1cdeef..c30f7f3 100644 --- a/include/qsgen2/lang/en_UK +++ b/include/qsgen2/lang/en_UK @@ -1,117 +1,217 @@ -qsgenlang=( -_qsgen2_msg_2 "- Forced Update: Generating Everything" -_qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *" -_qsgen2_msg_4 "Please install Pandoc." -_qsgen2_msg_5 "No valid generator found. Are you sure you've selected the correct generator in 'config'?" -_qsgen2_msg_6 "Using the" -_qsgen2_msg_6.1 "-engine for files:" -_qsgen2_msg_7 "- Created by kekePower - 2018-" -_qsgen2_msg_8 "- See" -_qsgen2_msg_8.1 "for more information." -_qsgen2_msg_9 "Contents of the Config file:" -_list_pages_msg_1 "_list_pages: No Pages found with extension" -_list_pages_msg_2 "_list_pages: Adding file to array:" -_list_blogs_msg_1 "_list_blogs: No blog files found." -_list_blogs_msg_2 "_list_blogs: Adding file to array:" -_blog_cache_msg_1 "_blog_cache: HASH VALUE:" -_blog_cache_msg_2 "1. _blog_cache:" -_blog_cache_msg_3 "2. _blog_cache: current_cache:" -_blog_cache_msg_4 "3. _blog_cache: new_cache_file:" -_blog_cache_msg_5 "4. _blog_cache: new_current_cache:" -_pages_cache_msg_1 "PAGES HASH VALUE:" -_pages_cache_msg_2 "1. pages_cache:" -_pages_cache_msg_3 "1. _pages_cache: current_cache:" -_pages_cache_msg_4 "2. _pages_cache: pages_file:" -_pages_cache_msg_5 "2. _pages_cache: current_cache:" -_last_updated_msg_1 "_last_updated: Setting date and version in footer" -_last_updated_msg_1 "_last_updated:" -_f_last_updated_msg_1 "_f_last_updated: Setting date and version in footer of file" -_f_last_updated_msg_2 "_f_last_updated:" -_f_last_updated_msg_3 "_f_last_updated: File" -_f_last_updated_msg_3.1 "not found." -_pages_msg_1 "_pages: Running function _pages_cache" -_pages_msg_2 "* You do not have any pages *" -_pages_msg_3 "Generating Pages" -_pages_msg_4 "_pages: pages_array is not empty" -_pages_msg_5 "_pages: Setting Pages template" -_pages_msg_6 "Unable to find the Pages template:" -_pages_msg_7 "_pages: Reading Pages template into pages_tpl" -_pages_msg_9 "_pages: Loading page_content once -" -_pages_msg_10 "_pages: Finding page_title" -_pages_msg_11 "_pages:" -_pages_msg_12 "_pages: Removing #title line from page_content" -_pages_msg_13 "_pages: Running engine on" -_pages_msg_14 "_pages: Checking for #link, #showimg and #ytvideo in page_content" -_pages_msg_15 "_pages: #link is present, run _link: page_content" -_pages_msg_16 "_pages: #showimg is present, run _image: page_content" -_pages_msg_17 "_pages: #ytvideo is present, run _youtube: page_content" -_pages_msg_18 "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl" -_pages_msg_19 "_pages: Replacing BODY with page_content in pages_tpl" -_pages_msg_20 "_pages: _last_updated in pages_tpl" -_pages_msg_21 "_pages: Lowercase filenames, always" -_pages_msg_22 "_pages: Running _cleanup" -_pages_msg_23 "- Parsing" -_pages_msg_24 "- blog_in_index =" -_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 "- 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" -_blogs_msg_4 "_blogs: Running function _blog_cache" -_blogs_msg_5 "Unable to find theme template for Blogs." -_blogs_msg_6 "_blogs: Processing pre-data for" -_blogs_msg_7 "_blogs: Looking for DATE: Found" -_blogs_msg_8 "_blogs: Looking for BLOG_TITLE: Found" -_blogs_msg_9 "* _blogs: DATE metadata missing in" -_blogs_msg_10 "* _blogs: BLOG_TITLE metadata missing in" -_blogs_msg_11 "_blogs: Adding data for" -_blogs_msg_11.1 "to array to export" -_blogs_msg_12 "_blogs: Processing" -_blogs_msg_14 "_blogs: Processing substitutes in" -_blogs_msg_15 "_blogs: Running function" -_blogs_msg_15.1 "for" -_blogs_msg_16 "_blogs: Checking for #link, #showimg and #ytvideo in blog_content" -_blogs_msg_17 "_blogs: #link is present, run _link: blog_content" -_blogs_msg_18 "_blogs: #showimg is present, run _link: blog_content" -_blogs_msg_19 "_blogs: #ytvideo is present, run _link: blog_content" -_blogs_msg_20 "_blogs: Replacing tagline, sitename and pagetitle" -_blogs_msg_21 "_blogs: Creating directory" -_blogs_msg_22 "_blogs: Writing blog to disk:" -_blogs_msg_23 "_blogs: new_updated_blogs=true" -_blogs_msg_24 "- No new or updated Blogs found" -_blogs_msg_25 "* _blogs: Running _blog_idx_for_index" -_blogs_msg_26 "* _blogs: Running _blog_index" -_blog_idx_for_index_msg_1 "- Populating" -_blog_idx_for_index_msg_2 "_blog_idx_for_index: Initiating function" -_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 from BLOG_META_STR_ARRAY from _blogs" -_blog_idx_for_index_msg_5 "_blog_idx_for_index:" -_blog_idx_for_index_msg_6 "_blog_idx_for_index: Iterate over each component and extract information" -_blog_idx_for_index_msg_7 "_blog_idx_for_index: Running" -_blog_idx_for_index_msg_7.1 "on content to catch QStags in Ingress" -_blog_idx_for_index_msg_8 "_blog_idx_for_index: Writing _blog_idx_for_index to file:" -_blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content =" -_blog_index_msg_1 "_blog_index: blog_in_index=" -_blog_index_msg_2 "_blog_index: new_updated_blogs=" -_blog_index_msg_3 "_blog_index: Running function _blog_index" -_blog_index_msg_4 "_blog_index: blog_in_index =" -_blog_index_msg_5 "- Generating Page:" -_blog_index_msg_6 "_blog_index: Replacing sitename and tagline" -_blog_index_msg_7 "_blog_index: Replacing BODY with content of" -_blog_index_msg_8 "_blog_index: Writing" -_blog_index_msg_9 "_blog_index: Content length of blog_index_content:" -_add_blog_list_to_index_msg_1 "_add_blog_list_to_index: Inserting blog list to index.html" -_sitemap_msg_1 "Generating Sitemap" -_sitemap_msg_2 "Sitemap generated at" -_link_msg_1 "_link: URL_MAIN(line):" -_link_msg_2 "_link_ URL:" -_link_msg_3 "_link: Text:" -_image_msg_1 "_image: Processing line:" -_youtube_msg_1 "_youtube: Processing 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" -) +# Quick Site Generator 2 - English Language File +# This file contains all user-facing strings for the application + +# Error Messages +error.missing_dependencies = "Missing required dependencies: %s" +error.config_validation_failed = "Configuration validation failed. Please check your configuration files." +error.config_missing_key = "Missing required configuration: %s" +error.invalid_url = "site_url must start with http:// or https://" +error.directory_not_found = "Directory does not exist: %s" +error.theme_not_found = "Theme directory not found: %s" +error.theme_config_not_found = "Theme configuration not found: %s" +error.theme_config_creation_failed = "Failed to create theme configuration: %s" +error.config_parse = "Failed to parse config file: %s" +error.invalid_path = "Invalid path: %s" +error.write_failed = "Failed to write to temporary file: %s" +error.move_failed = "Failed to move temporary file to: %s" +error.config_load_failed = "Failed to load configuration file: %s" +error.config_not_found = "No valid configuration file found." +error.create_blog_index_failed = "Failed to create blog index at: %s" +error.create_sample_post_failed = "Failed to create sample blog post at: %s" +error.create_sample_page_failed = "Failed to create sample page at: %s" +error.engine_not_found = "Engine not found or not executable: %s" +error.unknown_generator = "Unknown generator: %s" +error.unknown_option = "Unknown option: %s" +error.directory_not_empty = "Directory '%s' already exists and is not empty." +error.theme_creation_failed = "Failed to create theme: %s" +error.config_creation_failed = "Failed to create configuration file: %s" +error.directory_creation_failed = "Failed to create directory: %s" +error.file_creation_failed = "Failed to create file: %s" +error.layout_creation_failed = "Failed to create layout file: %s" +error.stylesheet_creation_failed = "Failed to create stylesheet: %s" +error.script_creation_failed = "Failed to create script file: %s" + +# Warning Messages +warning.optional_dependency = "Optional tool '%s' is required for %s but not found" +warning.dependency_version = "%s version %s is below the recommended version %s" +warning.legacy_config = "Using legacy config file. Consider renaming '%s' to 'site.conf'" +warning.git_repo = "Warning: Running in a git repository directory. Make sure this is intended." +warning.outdated_dependencies = "Some dependencies are outdated:" + +# Info Messages +info.legacy_config = "Warning: Using legacy '%s' file. Consider renaming to 'site.conf'" +info.legacy_config_used = "Using legacy config file. Consider renaming 'config' to 'site.conf'" +info.config_help = "Please create 'site.conf' in your project directory." +info.config_template = "You can use 'config.example' as a template." +info.git_repo_help = "If you want to generate the site, run from the project root directory." +info.usage = "Usage: %s [options]" +info.engine_usage = "Usage: _run_engine " +info.creating_blog_index = "Creating blog index file..." +info.creating_sample_post = "Creating sample blog post..." +info.creating_sample_page = "Creating sample page..." +info.setting_up_project = "Setting up project structure..." +info.creating_directories = "Creating project directories..." +info.initializing_blog = "Initializing blog..." +info.initializing_pages = "Initializing pages..." +info.initializing_theme = "Initializing theme..." +info.initializing_config = "Initializing configuration..." +info.initializing_complete = "Initialization complete!" +info.initializing_aborted = "Initialization aborted." +info.use_force_option = "Use --force to overwrite the existing directory." +info.get_started_instructions = "To get started" +info.happy_coding = "Happy coding!" +info.initializing_project = "Initializing project..." +info.initializing_blog_cache = "Initializing blog cache..." +info.initializing_pages_cache = "Initializing pages cache..." + +# Debug Messages +debug.loading_config = "Loading config file: %s" +debug.loaded_config = "=== Loaded Configuration ===" +debug.config_value = "%s: %s" +debug.config_end = "===========================" +debug.raw_config = "=== Raw Config File ===" +debug.raw_config_end = "======================" +debug.blog_cache_update = "Updating blog cache at %s" +debug.blog_cache_bytes = "Blog cache updated with %d bytes" +debug.blog_cache_loading = "Loading blog index from cache" +debug.blog_cache_stale_new = "Blog cache stale: New or updated blogs detected" +debug.blog_cache_stale_missing = "Blog cache stale: Cache file does not exist" +debug.blog_cache_stale_old = "Blog cache stale: Cache is older than 1 hour" +debug.blog_cache_fresh = "Blog cache is fresh" +debug.pages_cache_update = "Updating pages cache at %s" +debug.pages_cache_bytes = "Pages cache updated with %d bytes" +debug.pages_cache_loading = "Loading pages index from cache" +debug.pages_cache_stale_new = "Pages cache stale: New or updated pages detected" +debug.pages_cache_stale_missing = "Pages cache stale: Cache file does not exist" +debug.pages_cache_stale_old = "Pages cache stale: Cache is older than 1 hour" +debug.pages_cache_fresh = "Pages cache is fresh" + +# Blog Messages +blog.not_found = "No blog files found." +blog.generating = "Generating blog" +blog.no_template = "Unable to find the blog template: %s" +blog.cache_updated = "Blog cache updated" +blog.cache_loading = "Loading blog cache" +blog.cache_stale = "Blog cache is stale, rebuilding..." +blog.cache_fresh = "Blog cache is fresh" +blog.post_updated = "Updated blog post: %s" +blog.post_skipped = "Skipped (no changes): %s" +blog.post_error = "Error processing blog post: %s" + +# Blog Generation Messages +blog.hello_world_title = "Hello, World!" +blog.published_on = "Published on" +blog.welcome_message = "Welcome to your new blog! This is a sample blog post." +blog.getting_started = "Getting Started" +blog.edit_this_post = "You can edit this post at %s" +blog.features = "Features" +blog.feature_markdown = "Markdown support" +blog.feature_easy_customize = "Easy to customize" +blog.feature_fast_lightweight = "Fast and lightweight" +blog.next_steps = "Next Steps" +blog.step_edit_post = "Edit this post" +blog.step_add_posts = "Add more posts" +blog.step_customize_theme = "Customize your theme" +blog.step_publish_site = "Publish your site" +blog.happy_blogging = "Happy blogging!" +blog.latest_posts = "Latest Posts" +blog.sample_post = "Blog Post" +blog.categories = "Categories" +blog.sample_category = "Category" +blog.archives = "Archives" +blog.tags = "Tags" +blog.about = "About" +blog.about_text = "This is a sample blog index page. You can edit it at %s" + +# Page Generation Messages +page.about_me_title = "About Me" +page.welcome_title = "Welcome to My Site" +page.welcome_message = "This is a sample about page. You can edit it at %s" +page.my_story_title = "My Story" +page.my_story_content = "I'm a passionate developer who loves creating amazing websites with qsgen2!" +page.skills_title = "Skills" +page.skill_webdev = "Web Development" +page.skill_design = "Design" +page.skill_opensource = "Open Source" +page.contact_title = "Contact" +page.contact_content = "You can reach me at: email@example.com" +page.about_site_title = "About This Site" +page.about_site_content = "This site was built with [qsgen2](https://github.com/kekePower/qsgen2)." + +# Success Messages +success.config_loaded = "Configuration loaded successfully" +success.build_complete = "Build completed successfully" +success.blog_index_created = "Created blog index at: %s" +success.sample_post_created = "Created sample blog post at: %s" +success.sample_page_created = "Created sample page at: %s" +success.project_initialized = "Project initialized successfully!" +success.theme_initialized = "Theme initialized successfully!" +success.config_initialized = "Configuration file created successfully!" + +# System Messages +system.created_by = "- Created by kekePower - 2018-%s" +system.see_help = "- See '%s help' for more information." + +# List Messages +list.pages_not_found = "_list_pages: No Pages found with ext %s" +list.pages_adding = "_list_pages: Adding file to array: %s" +list.blogs_not_found = "_list_blogs: No blog files found." +list.blogs_adding = "_list_blogs: Adding file to array: %s" + +# Blog Cache Messages +blog_cache.hash = "_blog_cache: HASH VALUE:" +blog_cache.current = "1. _blog_cache:" +blog_cache.cache_file = "2. _blog_cache: current_cache:" +blog_cache.new_cache = "3. _blog_cache: new_cache_file:" +blog_cache.new_current = "4. _blog_cache: new_current_cache:" + +# Pages Cache Messages +page_cache.hash = "PAGES HASH VALUE:" +page_cache.current = "1. pages_cache:" +page_cache.cache_file = "2. _pages_cache: current_cache:" +page_cache.pages_file = "2. _pages_cache: pages_file:" + +# Navigation +nav.home = "Home" +nav.blog = "Blog" +nav.about = "About" + +# Footer +footer.all_rights_reserved = "All rights reserved." + +# Configuration +config.site_config_title = "Site Configuration" +config.theme_config_title = "Theme Configuration" +config.site_name_default = "My Awesome Site" +config.site_tagline_default = "A static site generated with qsgen2" +config.site_description_default = "This is my awesome static site" +config.your_name = "Your Name" +config.theme_description = "A custom theme for qsgen2" +config.theme_files_title = "Theme files (relative to theme directory)" + +# CSS and JavaScript +css.main_styles = "Main Styles" +js.main_javascript = "Main JavaScript" +js.console_message = "Hello from qsgen2!" +js.add_custom_javascript = "Add any custom JavaScript here" +js.your_code_here = "Your code here" + +# Last Updated Messages +last_updated.setting = "_last_updated: Setting date and version in footer" +last_updated.file_not_found = "_f_last_updated: File %s not found." + +# Pages Messages +pages.generating = "Generating Pages" +pages.none = "* You do not have any pages *" +pages.no_template = "Unable to find the Pages template: %s" + +# Pandoc Messages +pandoc.install = "Please install Pandoc." +pandoc.download = "https://github.com/jgm/pandoc/releases" + +# Generator Messages +generator.not_found = "No valid generator found. Are you sure you've selected the correct generator in 'config'?" + +# Build Messages +build.forced = "- Forced Update: Generating Everything" +build.using_engine = "Using the %s -engine for files:" diff --git a/include/qsgen2/lang/en_US b/include/qsgen2/lang/en_US index 61f7b3c..c30f7f3 100644 --- a/include/qsgen2/lang/en_US +++ b/include/qsgen2/lang/en_US @@ -1,117 +1,217 @@ -qsgenlang=( -_qsgen2_msg_2 "- Forced Update: Generating Everything" -_qsgen2_msg_3 "* %SCRIPT_NAME% cannot parse this site. Exiting. *" -_qsgen2_msg_4 "Please install Pandoc." -_qsgen2_msg_5 "No valid generator found. Are you sure you\'ve selected the correct generator in \'config\'?" -_qsgen2_msg_6 "Using the" -_qsgen2_msg_6.1 "-engine for files:" -_qsgen2_msg_7 "- Created by kekePower - 2018-" -_qsgen2_msg_8 "- See" -_qsgen2_msg_8.1 "for more information." -_qsgen2_msg_9 "Contents of the Config file:" -_list_pages_msg_1 "_list_pages: No Pages found with ext" -_list_pages_msg_2 "_list_pages: Adding file to array:" -_list_blogs_msg_1 "_list_blogs: No blog files found." -_list_blogs_msg_2 "_list_blogs: Adding file to array:" -_blog_cache_msg_1 "_blog_cache: HASH VALUE:" -_blog_cache_msg_2 "1. _blog_cache:" -_blog_cache_msg_3 "2. _blog_cache: current_cache:" -_blog_cache_msg_4 "3. _blog_cache: new_cache_file:" -_blog_cache_msg_5 "4. _blog_cache: new_current_cache:" -_pages_cache_msg_1 "PAGES HASH VALUE:" -_pages_cache_msg_2 "1. pages_cache:" -_pages_cache_msg_3 "1. _pages_cache: current_cache:" -_pages_cache_msg_4 "2. _pages_cache: pages_file:" -_pages_cache_msg_5 "2. _pages_cache: current_cache:" -_last_updated_msg_1 "_last_updated: Setting date and version in footer" -_last_updated_msg_1 "_last_updated:" -_f_last_updated_msg_1 "_f_last_updated: Setting date and version in footer of file" -_f_last_updated_msg_2 "_f_last_updated:" -_f_last_updated_msg_3 "_f_last_updated: File" -_f_last_updated_msg_3.1 "not found." -_pages_msg_1 "_pages: Running function _pages_cache" -_pages_msg_2 "* You do not have any pages *" -_pages_msg_3 "Generating Pages" -_pages_msg_4 "_pages: pages_array is not empty" -_pages_msg_5 "_pages: Setting Pages template" -_pages_msg_6 "Unable to find the Pages template:" -_pages_msg_7 "_pages: Reading Pages template into pages_tpl" -_pages_msg_9 "_pages: Loading page_content once -" -_pages_msg_10 "_pages: Finding page_title" -_pages_msg_11 "_pages:" -_pages_msg_12 "_pages: Removing #title line from page_content" -_pages_msg_13 "_pages: Running engine on" -_pages_msg_14 "_pages: Checking for #link, #showimg and #ytvideo in page_content" -_pages_msg_15 "_pages: #link is present, run _link: page_content" -_pages_msg_16 "_pages: #showimg is present, run _image: page_content" -_pages_msg_17 "_pages: #ytvideo is present, run _youtube: page_content" -_pages_msg_18 "_pages: Replacing #pagetitle, #tagline and #sitename in pages_tpl" -_pages_msg_19 "_pages: Replacing BODY with page_content in pages_tpl" -_pages_msg_20 "_pages: _last_updated in pages_tpl" -_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 "- 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 "- 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" -_blogs_msg_4 "_blogs: Running function _blog_cache" -_blogs_msg_5 "Unable to find theme template for Blogs." -_blogs_msg_6 "_blogs: Processing pre-data for" -_blogs_msg_7 "_blogs: Looking for DATE: Found" -_blogs_msg_8 "_blogs: Looking for BLOG_TITLE: Found" -_blogs_msg_9 "* _blogs: DATE metadata missing in" -_blogs_msg_10 "* _blogs: BLOG_TITLE metadata missing in" -_blogs_msg_11 "_blogs: Adding data for" -_blogs_msg_11.1 "to array to export" -_blogs_msg_12 "_blogs: Processing" -_blogs_msg_14 "_blogs: Processing substitutes in" -_blogs_msg_15 "_blogs: Running function" -_blogs_msg_15_1 "for" -_blogs_msg_16 "_blogs: Checking for #link, #showimg and #ytvideo in blog_content" -_blogs_msg_17 "_blogs: #link is present, run _link: blog_content" -_blogs_msg_18 "_blogs: #showimg is present, run _link: blog_content" -_blogs_msg_19 "_blogs: #ytvideo is present, run _link: blog_content" -_blogs_msg_20 "_blogs: Replacing tagline, sitename and pagetitle" -_blogs_msg_21 "_blogs: Creating directory" -_blogs_msg_22 "_blogs: Writing blog to disk:" -_blogs_msg_23 "_blogs: new_updated_blogs=true" -_blogs_msg_24 "- No new or updated Blogs found" -_blogs_msg_25 "* _blogs: Running _blog_idx_for_index" -_blogs_msg_26 "* _blogs: Running _blog_index" -_blog_idx_for_index_msg_1 "- Populating" -_blog_idx_for_index_msg_2 "_blog_idx_for_index: Initiating function" -_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 from BLOG_META_STR_ARRAY from _blogs" -_blog_idx_for_index_msg_5 "_blog_idx_for_index:" -_blog_idx_for_index_msg_6 "_blog_idx_for_index: Iterate over each component and extract information" -_blog_idx_for_index_msg_7 "_blog_idx_for_index: Running" -_blog_idx_for_index_msg_7.1 "on content to catch QStags in Ingress" -_blog_idx_for_index_msg_8 "_blog_idx_for_index: Writing _blog_idx_for_index to file:" -_blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content =" -_blog_index_msg_1 "_blog_index: blog_in_index=" -_blog_index_msg_2 "_blog_index: new_updated_blogs=" -_blog_index_msg_3 "_blog_index: Running function _blog_index" -_blog_index_msg_4 "_blog_index: blog_in_index =" -_blog_index_msg_5 "- Generating Page:" -_blog_index_msg_6 "_blog_index: Replacing sitename and tagline" -_blog_index_msg_7 "_blog_index: Replacing BODY with content of" -_blog_index_msg_8 "_blog_index: Writing" -_blog_index_msg_9 "_blog_index: Content length of blog_index_content:" -_add_blog_list_to_index_msg_1 "_add_blog_list_to_index: Inserting blog list to index.html" -_sitemap_msg_1 "Generating Sitemap" -_sitemap_msg_2 "Sitemap generated at" -_link_msg_1 "_link: URL_MAIN(line):" -_link_msg_2 "_link_ URL:" -_link_msg_3 "_link: Text:" -_image_msg_1 "_image: Processing line:" -_youtube_msg_1 "_youtube: Processing 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" -) +# Quick Site Generator 2 - English Language File +# This file contains all user-facing strings for the application + +# Error Messages +error.missing_dependencies = "Missing required dependencies: %s" +error.config_validation_failed = "Configuration validation failed. Please check your configuration files." +error.config_missing_key = "Missing required configuration: %s" +error.invalid_url = "site_url must start with http:// or https://" +error.directory_not_found = "Directory does not exist: %s" +error.theme_not_found = "Theme directory not found: %s" +error.theme_config_not_found = "Theme configuration not found: %s" +error.theme_config_creation_failed = "Failed to create theme configuration: %s" +error.config_parse = "Failed to parse config file: %s" +error.invalid_path = "Invalid path: %s" +error.write_failed = "Failed to write to temporary file: %s" +error.move_failed = "Failed to move temporary file to: %s" +error.config_load_failed = "Failed to load configuration file: %s" +error.config_not_found = "No valid configuration file found." +error.create_blog_index_failed = "Failed to create blog index at: %s" +error.create_sample_post_failed = "Failed to create sample blog post at: %s" +error.create_sample_page_failed = "Failed to create sample page at: %s" +error.engine_not_found = "Engine not found or not executable: %s" +error.unknown_generator = "Unknown generator: %s" +error.unknown_option = "Unknown option: %s" +error.directory_not_empty = "Directory '%s' already exists and is not empty." +error.theme_creation_failed = "Failed to create theme: %s" +error.config_creation_failed = "Failed to create configuration file: %s" +error.directory_creation_failed = "Failed to create directory: %s" +error.file_creation_failed = "Failed to create file: %s" +error.layout_creation_failed = "Failed to create layout file: %s" +error.stylesheet_creation_failed = "Failed to create stylesheet: %s" +error.script_creation_failed = "Failed to create script file: %s" + +# Warning Messages +warning.optional_dependency = "Optional tool '%s' is required for %s but not found" +warning.dependency_version = "%s version %s is below the recommended version %s" +warning.legacy_config = "Using legacy config file. Consider renaming '%s' to 'site.conf'" +warning.git_repo = "Warning: Running in a git repository directory. Make sure this is intended." +warning.outdated_dependencies = "Some dependencies are outdated:" + +# Info Messages +info.legacy_config = "Warning: Using legacy '%s' file. Consider renaming to 'site.conf'" +info.legacy_config_used = "Using legacy config file. Consider renaming 'config' to 'site.conf'" +info.config_help = "Please create 'site.conf' in your project directory." +info.config_template = "You can use 'config.example' as a template." +info.git_repo_help = "If you want to generate the site, run from the project root directory." +info.usage = "Usage: %s [options]" +info.engine_usage = "Usage: _run_engine " +info.creating_blog_index = "Creating blog index file..." +info.creating_sample_post = "Creating sample blog post..." +info.creating_sample_page = "Creating sample page..." +info.setting_up_project = "Setting up project structure..." +info.creating_directories = "Creating project directories..." +info.initializing_blog = "Initializing blog..." +info.initializing_pages = "Initializing pages..." +info.initializing_theme = "Initializing theme..." +info.initializing_config = "Initializing configuration..." +info.initializing_complete = "Initialization complete!" +info.initializing_aborted = "Initialization aborted." +info.use_force_option = "Use --force to overwrite the existing directory." +info.get_started_instructions = "To get started" +info.happy_coding = "Happy coding!" +info.initializing_project = "Initializing project..." +info.initializing_blog_cache = "Initializing blog cache..." +info.initializing_pages_cache = "Initializing pages cache..." + +# Debug Messages +debug.loading_config = "Loading config file: %s" +debug.loaded_config = "=== Loaded Configuration ===" +debug.config_value = "%s: %s" +debug.config_end = "===========================" +debug.raw_config = "=== Raw Config File ===" +debug.raw_config_end = "======================" +debug.blog_cache_update = "Updating blog cache at %s" +debug.blog_cache_bytes = "Blog cache updated with %d bytes" +debug.blog_cache_loading = "Loading blog index from cache" +debug.blog_cache_stale_new = "Blog cache stale: New or updated blogs detected" +debug.blog_cache_stale_missing = "Blog cache stale: Cache file does not exist" +debug.blog_cache_stale_old = "Blog cache stale: Cache is older than 1 hour" +debug.blog_cache_fresh = "Blog cache is fresh" +debug.pages_cache_update = "Updating pages cache at %s" +debug.pages_cache_bytes = "Pages cache updated with %d bytes" +debug.pages_cache_loading = "Loading pages index from cache" +debug.pages_cache_stale_new = "Pages cache stale: New or updated pages detected" +debug.pages_cache_stale_missing = "Pages cache stale: Cache file does not exist" +debug.pages_cache_stale_old = "Pages cache stale: Cache is older than 1 hour" +debug.pages_cache_fresh = "Pages cache is fresh" + +# Blog Messages +blog.not_found = "No blog files found." +blog.generating = "Generating blog" +blog.no_template = "Unable to find the blog template: %s" +blog.cache_updated = "Blog cache updated" +blog.cache_loading = "Loading blog cache" +blog.cache_stale = "Blog cache is stale, rebuilding..." +blog.cache_fresh = "Blog cache is fresh" +blog.post_updated = "Updated blog post: %s" +blog.post_skipped = "Skipped (no changes): %s" +blog.post_error = "Error processing blog post: %s" + +# Blog Generation Messages +blog.hello_world_title = "Hello, World!" +blog.published_on = "Published on" +blog.welcome_message = "Welcome to your new blog! This is a sample blog post." +blog.getting_started = "Getting Started" +blog.edit_this_post = "You can edit this post at %s" +blog.features = "Features" +blog.feature_markdown = "Markdown support" +blog.feature_easy_customize = "Easy to customize" +blog.feature_fast_lightweight = "Fast and lightweight" +blog.next_steps = "Next Steps" +blog.step_edit_post = "Edit this post" +blog.step_add_posts = "Add more posts" +blog.step_customize_theme = "Customize your theme" +blog.step_publish_site = "Publish your site" +blog.happy_blogging = "Happy blogging!" +blog.latest_posts = "Latest Posts" +blog.sample_post = "Blog Post" +blog.categories = "Categories" +blog.sample_category = "Category" +blog.archives = "Archives" +blog.tags = "Tags" +blog.about = "About" +blog.about_text = "This is a sample blog index page. You can edit it at %s" + +# Page Generation Messages +page.about_me_title = "About Me" +page.welcome_title = "Welcome to My Site" +page.welcome_message = "This is a sample about page. You can edit it at %s" +page.my_story_title = "My Story" +page.my_story_content = "I'm a passionate developer who loves creating amazing websites with qsgen2!" +page.skills_title = "Skills" +page.skill_webdev = "Web Development" +page.skill_design = "Design" +page.skill_opensource = "Open Source" +page.contact_title = "Contact" +page.contact_content = "You can reach me at: email@example.com" +page.about_site_title = "About This Site" +page.about_site_content = "This site was built with [qsgen2](https://github.com/kekePower/qsgen2)." + +# Success Messages +success.config_loaded = "Configuration loaded successfully" +success.build_complete = "Build completed successfully" +success.blog_index_created = "Created blog index at: %s" +success.sample_post_created = "Created sample blog post at: %s" +success.sample_page_created = "Created sample page at: %s" +success.project_initialized = "Project initialized successfully!" +success.theme_initialized = "Theme initialized successfully!" +success.config_initialized = "Configuration file created successfully!" + +# System Messages +system.created_by = "- Created by kekePower - 2018-%s" +system.see_help = "- See '%s help' for more information." + +# List Messages +list.pages_not_found = "_list_pages: No Pages found with ext %s" +list.pages_adding = "_list_pages: Adding file to array: %s" +list.blogs_not_found = "_list_blogs: No blog files found." +list.blogs_adding = "_list_blogs: Adding file to array: %s" + +# Blog Cache Messages +blog_cache.hash = "_blog_cache: HASH VALUE:" +blog_cache.current = "1. _blog_cache:" +blog_cache.cache_file = "2. _blog_cache: current_cache:" +blog_cache.new_cache = "3. _blog_cache: new_cache_file:" +blog_cache.new_current = "4. _blog_cache: new_current_cache:" + +# Pages Cache Messages +page_cache.hash = "PAGES HASH VALUE:" +page_cache.current = "1. pages_cache:" +page_cache.cache_file = "2. _pages_cache: current_cache:" +page_cache.pages_file = "2. _pages_cache: pages_file:" + +# Navigation +nav.home = "Home" +nav.blog = "Blog" +nav.about = "About" + +# Footer +footer.all_rights_reserved = "All rights reserved." + +# Configuration +config.site_config_title = "Site Configuration" +config.theme_config_title = "Theme Configuration" +config.site_name_default = "My Awesome Site" +config.site_tagline_default = "A static site generated with qsgen2" +config.site_description_default = "This is my awesome static site" +config.your_name = "Your Name" +config.theme_description = "A custom theme for qsgen2" +config.theme_files_title = "Theme files (relative to theme directory)" + +# CSS and JavaScript +css.main_styles = "Main Styles" +js.main_javascript = "Main JavaScript" +js.console_message = "Hello from qsgen2!" +js.add_custom_javascript = "Add any custom JavaScript here" +js.your_code_here = "Your code here" + +# Last Updated Messages +last_updated.setting = "_last_updated: Setting date and version in footer" +last_updated.file_not_found = "_f_last_updated: File %s not found." + +# Pages Messages +pages.generating = "Generating Pages" +pages.none = "* You do not have any pages *" +pages.no_template = "Unable to find the Pages template: %s" + +# Pandoc Messages +pandoc.install = "Please install Pandoc." +pandoc.download = "https://github.com/jgm/pandoc/releases" + +# Generator Messages +generator.not_found = "No valid generator found. Are you sure you've selected the correct generator in 'config'?" + +# Build Messages +build.forced = "- Forced Update: Generating Everything" +build.using_engine = "Using the %s -engine for files:" diff --git a/include/qsgen2/lang/es_ES b/include/qsgen2/lang/es_ES index b4eb9f9..9a0e825 100644 --- a/include/qsgen2/lang/es_ES +++ b/include/qsgen2/lang/es_ES @@ -1,117 +1,207 @@ -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 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 "- 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:" -_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: array_de_páginas no está vacío" -_pages_msg_5 "_pages: Estableciendo plantilla de Páginas" -_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_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 archivo en minúsculas, siempre" -_pages_msg_22 "_pages: Ejecutando _cleanup" -_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_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 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" -_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_14 "_blogs: Procesando sustitutos en" -_blogs_msg_15 "_blogs: Ejecutando función" -_blogs_msg_15.1 "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, 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 "- Llenando" -_blog_idx_for_index_msg_2 "_blog_idx_for_index: Iniciando función" -_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:" -_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_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 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" -) +# Generador Rápido de Sitios 2 - Archivo de idioma español +# Este archivo contiene todas las cadenas visibles para el usuario de la aplicación + +# Mensajes de error +error.missing_dependencies = "Faltan dependencias requeridas: %s" +error.config_validation_failed = "Error en la validación de la configuración. Por favor, verifique sus archivos de configuración." +error.config_missing_key = "Falta la configuración requerida: %s" +error.invalid_url = "site_url debe comenzar con http:// o https://" +error.directory_not_found = "El directorio no existe: %s" +error.theme_not_found = "Directorio del tema no encontrado: %s" +error.theme_config_not_found = "Configuración del tema no encontrada: %s" +error.theme_config_creation_failed = "Error al crear la configuración del tema: %s" +error.config_parse = "Error al analizar el archivo de configuración: %s" +error.invalid_path = "Ruta no válida: %s" +error.write_failed = "Error al escribir en el archivo temporal: %s" +error.move_failed = "Error al mover el archivo temporal a: %s" +error.config_load_failed = "Error al cargar el archivo de configuración: %s" +error.config_not_found = "No se encontró ningún archivo de configuración válido." +error.create_blog_index_failed = "Error al crear el índice del blog en: %s" +error.create_sample_post_failed = "Error al crear la entrada de blog de ejemplo en: %s" +error.create_sample_page_failed = "Error al crear la página de ejemplo en: %s" +error.engine_not_found = "Motor no encontrado o no ejecutable: %s" +error.unknown_generator = "Generador desconocido: %s" +error.unknown_option = "Opción desconocida: %s" +error.directory_not_empty = "El directorio '%s' ya existe y no está vacío." +error.theme_creation_failed = "Error al crear el tema: %s" +error.config_creation_failed = "Error al crear el archivo de configuración: %s" +error.directory_creation_failed = "Error al crear el directorio: %s" +error.file_creation_failed = "Error al crear el archivo: %s" +error.layout_creation_failed = "Error al crear el archivo de diseño: %s" +error.stylesheet_creation_failed = "Error al crear la hoja de estilos: %s" +error.script_creation_failed = "Error al crear el archivo de script: %s" + +# Mensajes de advertencia +warning.optional_dependency = "La herramienta opcional '%s' es necesaria para %s pero no se encontró" +warning.dependency_version = "La versión %s de %s es inferior a la versión recomendada %s" +warning.legacy_config = "Usando archivo de configuración heredado. Considere renombrar '%s' a 'site.conf'" +warning.git_repo = "Advertencia: Ejecutando en un directorio de repositorio git. Asegúrese de que es intencionado." +warning.outdated_dependencies = "Algunas dependencias están desactualizadas:" + +# Mensajes informativos +info.legacy_config = "Advertencia: Usando archivo heredado '%s'. Considere renombrarlo a 'site.conf'" +info.legacy_config_used = "Usando archivo de configuración heredado. Considere renombrar 'config' a 'site.conf'" +info.config_help = "Por favor, cree un archivo 'site.conf' en el directorio de su proyecto." +info.config_template = "Puede usar 'config.example' como plantilla." +info.git_repo_help = "Si desea generar el sitio, ejecútelo desde el directorio raíz del proyecto." +info.usage = "Uso: %s [opciones]" +info.engine_usage = "Uso: _run_engine " +info.creating_blog_index = "Creando archivo de índice del blog..." +info.creating_sample_post = "Creando entrada de blog de ejemplo..." +info.creating_sample_page = "Creando página de ejemplo..." +info.setting_up_project = "Configurando la estructura del proyecto..." +info.creating_directories = "Creando directorios del proyecto..." +info.initializing_blog = "Inicializando blog..." +info.initializing_pages = "Inicializando páginas..." +info.initializing_theme = "Inicializando tema..." +info.initializing_config = "Inicializando configuración..." +info.initializing_complete = "¡Inicialización completada!" +info.initializing_aborted = "Inicialización cancelada." +info.use_force_option = "Use --force para sobrescribir el directorio existente." +info.get_started_instructions = "Para comenzar" +info.happy_coding = "¡Feliz programación!" +info.initializing_project = "Inicializando proyecto..." +info.initializing_blog_cache = "Inicializando caché del blog..." +info.initializing_pages_cache = "Inicializando caché de páginas..." + +# Mensajes de depuración +debug.loading_config = "Cargando archivo de configuración: %s" +debug.loaded_config = "=== Configuración Cargada ===" +debug.config_value = "%s: %s" +debug.config_end = "============================" +debug.raw_config = "=== Archivo de Configuración en Bruto ===" +debug.raw_config_end = "==================================" +debug.blog_cache_update = "Actualizando caché del blog en %s" +debug.blog_cache_bytes = "Caché del blog actualizado con %d bytes" +debug.blog_cache_loading = "Cargando índice del blog desde la caché" +debug.blog_cache_stale_new = "Caché del blog desactualizado: Se detectaron blogs nuevos o actualizados" +debug.blog_cache_stale_missing = "Caché del blog desactualizado: El archivo de caché no existe" +debug.blog_cache_stale_old = "Caché del blog desactualizado: La caché tiene más de 1 hora" +debug.blog_cache_fresh = "La caché del blog está actualizada" +debug.pages_cache_update = "Actualizando caché de páginas en %s" +debug.pages_cache_bytes = "Caché de páginas actualizado con %d bytes" +debug.pages_cache_loading = "Cargando índice de páginas desde la caché" +debug.pages_cache_stale_new = "Caché de páginas desactualizado: Se detectaron páginas nuevas o actualizadas" +debug.pages_cache_stale_missing = "Caché de páginas desactualizado: El archivo de caché no existe" +debug.pages_cache_stale_old = "Caché de páginas desactualizado: La caché tiene más de 1 hora" +debug.pages_cache_fresh = "La caché de páginas está actualizada" + +# Mensajes del Blog +blog.not_found = "No se encontraron archivos de blog." +blog.generating = "Generando blog" +blog.no_template = "No se pudo encontrar la plantilla del blog: %s" +blog.cache_updated = "Caché del blog actualizado" +blog.cache_loading = "Cargando caché del blog" +blog.cache_stale = "La caché del blog está desactualizada, reconstruyendo..." +blog.cache_fresh = "La caché del blog está actualizada" +blog.post_updated = "Entrada de blog actualizada: %s" +blog.post_skipped = "Omitido (sin cambios): %s" +blog.post_error = "Error al procesar la entrada del blog: %s" + +# Mensajes de Generación del Blog +blog.hello_world_title = "¡Hola, Mundo!" +blog.published_on = "Publicado el" +blog.welcome_message = "¡Bienvenido a tu nuevo blog! Esta es una entrada de blog de ejemplo." +blog.getting_started = "Comenzando" +blog.edit_this_post = "Puedes editar esta entrada en %s" +blog.features = "Características" +blog.feature_markdown = "Soporte para Markdown" +blog.feature_easy_customize = "Fácil de personalizar" +blog.feature_fast_lightweight = "Rápido y ligero" +blog.next_steps = "Próximos pasos" +blog.step_edit_post = "Editar esta entrada" +blog.step_add_posts = "Añadir más entradas" +blog.step_customize_theme = "Personalizar tu tema" +blog.step_publish_site = "Publicar tu sitio" +blog.happy_blogging = "¡Feliz blogueo!" +blog.latest_posts = "Últimas entradas" +blog.sample_post = "Entrada de blog" +blog.categories = "Categorías" +blog.sample_category = "Categoría" +blog.archives = "Archivos" +blog.tags = "Etiquetas" +blog.about = "Acerca de" +blog.about_text = "Esta es una página de índice de blog de ejemplo. Puedes editarla en %s" + +# Mensajes de Generación de Páginas +page.about_me_title = "Sobre Mí" +page.welcome_title = "Bienvenido a Mi Sitio" +page.welcome_message = "Esta es una página de ejemplo. Puedes editarla en %s" +page.my_story_title = "Mi Historia" +page.my_story_content = "¡Soy un desarrollador apasionado que adora crear sitios web increíbles con qsgen2!" +page.skills_title = "Habilidades" +page.skill_webdev = "Desarrollo Web" +page.skill_design = "Diseño" +page.skill_opensource = "Código Abierto" +page.contact_title = "Contacto" +page.contact_content = "Puedes contactarme en: email@example.com" +page.about_site_title = "Acerca de Este Sitio" +page.about_site_content = "Este sitio fue construido con [qsgen2](https://github.com/kekePower/qsgen2)." + +# Mensajes de Éxito +success.config_loaded = "Configuración cargada exitosamente" +success.build_complete = "Construcción completada exitosamente" +success.blog_index_created = "Índice del blog creado en: %s" +success.sample_post_created = "Entrada de blog de ejemplo creada en: %s" +success.sample_page_created = "Página de ejemplo creada en: %s" +success.project_initialized = "¡Proyecto inicializado exitosamente!" +success.theme_initialized = "¡Tema inicializado exitosamente!" +success.config_initialized = "¡Archivo de configuración creado exitosamente!" + +# Mensajes del Sistema +system.created_by = "- Creado por kekePower - 2018-%s" +system.see_help = "- Ver '%s help' para más información." + +# Mensajes de Lista +list.pages_not_found = "_list_pages: No se encontraron páginas con la extensión %s" +list.pages_adding = "_list_pages: Añadiendo archivo al array: %s" +list.blogs_not_found = "_list_blogs: No se encontraron archivos de blog." +list.blogs_adding = "_list_blogs: Añadiendo archivo al array: %s" + +# Navegación +nav.home = "Inicio" +nav.blog = "Blog" +nav.about = "Acerca de" + +# Pie de Página +footer.all_rights_reserved = "Todos los derechos reservados." + +# Configuración +config.site_config_title = "Configuración del Sitio" +config.theme_config_title = "Configuración del Tema" +config.site_name_default = "Mi Sitio Increíble" +config.site_tagline_default = "Un sitio estático generado con qsgen2" +config.site_description_default = "Este es mi increíble sitio estático" +config.your_name = "Tu Nombre" +config.theme_description = "Un tema personalizado para qsgen2" +config.theme_files_title = "Archivos del tema (relativo al directorio del tema)" + +# CSS y JavaScript +css.main_styles = "Estilos Principales" +js.main_javascript = "JavaScript Principal" +js.console_message = "¡Hola desde qsgen2!" +js.add_custom_javascript = "Añade cualquier JavaScript personalizado aquí" +js.your_code_here = "Tu código aquí" + +# Mensajes de Última Actualización +last_updated.setting = "_last_updated: Estableciendo fecha y versión en el pie de página" +last_updated.file_not_found = "_f_last_updated: Archivo %s no encontrado." + +# Mensajes de Páginas +pages.generating = "Generando Páginas" +pages.none = "* No tienes páginas *" +pages.no_template = "No se pudo encontrar la plantilla de páginas: %s" + +# Mensajes de Pandoc +pandoc.install = "Por favor, instala Pandoc." +pandoc.download = "https://github.com/jgm/pandoc/releases" + +# Mensajes del Generador +generator.not_found = "No se encontró un generador válido. ¿Estás seguro de que has seleccionado el generador correcto en 'config'?" +generator.using = "Usando generador: %s" +generator.execution_failed = "Error en la ejecución del generador: %s" +generator.execution_success = "Generador ejecutado exitosamente: %s" + +# Mensajes de Construcción +build.forced = "- Actualización forzada: Generando todo" +build.using_engine = "Usando el motor %s para archivos:" diff --git a/include/qsgen2/lang/fr_FR b/include/qsgen2/lang/fr_FR index 715061c..7773361 100644 --- a/include/qsgen2/lang/fr_FR +++ b/include/qsgen2/lang/fr_FR @@ -1,117 +1,209 @@ -qsgenlang=( -_qsgen2_msg_2 "- Mise à jour forcée : Génération de tout" -_qsgen2_msg_3 "* %SCRIPT_NAME% ne peut pas analyser ce site. Sortie. *" -_qsgen2_msg_4 "Veuillez installer Pandoc." -_qsgen2_msg_5 "Aucun générateur valide trouvé. Êtes-vous sûr d'avoir sélectionné le bon générateur dans 'config' ?" -_qsgen2_msg_6 "Utilisation du" -_qsgen2_msg_6.1 "-moteur pour les fichiers :" -_qsgen2_msg_7 "- Créé par kekePower - 2018-" -_qsgen2_msg_8 "- Voir" -_qsgen2_msg_8.1 "pour plus d'informations." -_qsgen2_msg_9 "Contenu du fichier Config :" -_list_pages_msg_1 "_list_pages : Aucune page trouvée avec l'extension" -_list_pages_msg_2 "_list_pages : Ajout du fichier au tableau :" -_list_blogs_msg_1 "_list_blogs : Aucun fichier de blog trouvé." -_list_blogs_msg_2 "_list_blogs : Ajout du fichier au tableau :" -_blog_cache_msg_1 "_blog_cache : VALEUR DU HASH :" -_blog_cache_msg_2 "1. _blog_cache :" -_blog_cache_msg_3 "2. _blog_cache : cache_actuel :" -_blog_cache_msg_4 "3. _blog_cache : nouveau_fichier_cache :" -_blog_cache_msg_5 "4. _blog_cache : nouveau_cache_actuel :" -_pages_cache_msg_1 "VALEUR DU HASH DES PAGES :" -_pages_cache_msg_2 "1. cache_des_pages :" -_pages_cache_msg_3 "1. _cache_des_pages : cache_actuel :" -_pages_cache_msg_4 "2. _cache_des_pages : fichier_des_pages :" -_pages_cache_msg_5 "2. _cache_des_pages : cache_actuel :" -_last_updated_msg_1 "_last_updated : Définition de la date et de la version dans le pied de page" -_last_updated_msg_1 "_last_updated :" -_f_last_updated_msg_1 "_f_last_updated : Définition de la date et de la version dans le pied de page du fichier" -_f_last_updated_msg_2 "_f_last_updated :" -_f_last_updated_msg_3 "_f_last_updated : Fichier" -_f_last_updated_msg_3.1 "non trouvé." -_pages_msg_1 "_pages : Exécution de la fonction _cache_des_pages" -_pages_msg_2 "* Vous n'avez aucune page *" -_pages_msg_3 "Génération des Pages" -_pages_msg_4 "_pages : le tableau des pages n'est pas vide" -_pages_msg_5 "_pages : Définition du modèle des Pages" -_pages_msg_6 "Impossible de trouver le modèle des Pages :" -_pages_msg_7 "_pages : Lecture du modèle des Pages dans pages_tpl" -_pages_msg_9 "_pages : Chargement du contenu de la page une fois -" -_pages_msg_10 "_pages : Recherche du titre de la page" -_pages_msg_11 "_pages :" -_pages_msg_12 "_pages : Suppression de la ligne #titre du contenu de la page" -_pages_msg_13 "_pages : Exécution du moteur sur" -_pages_msg_14 "_pages : Vérification de #lien, #montrerimg et #videoyt dans le contenu de la page" -_pages_msg_15 "_pages : #lien présent, exécution de _lien : contenu de la page" -_pages_msg_16 "_pages : #montrerimg présent, exécution de _image : contenu de la page" -_pages_msg_17 "_pages : #videoyt présent, exécution de _youtube : contenu de la page" -_pages_msg_18 "_pages : Remplacement de #titredelapage, #slogan et #nomdusite dans pages_tpl" -_pages_msg_19 "_pages : Remplacement du CORPS par le contenu de la page dans pages_tpl" -_pages_msg_20 "_pages : _dernière_mise_à_jour dans pages_tpl" -_pages_msg_21 "_pages : Noms de fichiers en minuscules, toujours" -_pages_msg_22 "_pages : Exécution de _nettoyage" -_pages_msg_23 "- Analyse" -_pages_msg_24 "- blog_dans_index =" -_pages_msg_25 "- Impression du fichier temporaire du blog :" -_pages_msg_26 "Mise à jour de index.html avec les nouveaux articles de blog" -_pages_msg_27 "- Analyse" -_pages_msg_28 "- blog_dans_index =" -_pages_msg_29 "- Aucune nouvelle page ou mise à jour trouvée" -_blogs_msg_1 "_blogs : Exécution de la fonction _list_blogs" -_blogs_msg_2 "* Vous n'avez aucun blog *" -_blogs_msg_3 "Génération des Blogs" -_blogs_msg_4 "_blogs : Exécution de la fonction _cache_des_blogs" -_blogs_msg_5 "Impossible de trouver le modèle de thème pour les Blogs." -_blogs_msg_6 "_blogs : Traitement des données préliminaires pour" -_blogs_msg_7 "_blogs : Recherche de DATE : Trouvé" -_blogs_msg_8 "_blogs : Recherche de TITRE_DU_BLOG : Trouvé" -_blogs_msg_9 "* _blogs : Donnée de DATE manquante dans" -_blogs_msg_10 "* _blogs : TITRE_DU_BLOG manquant dans" -_blogs_msg_11 "_blogs : Ajout des données pour" -_blogs_msg_11.1 "au tableau pour l'export" -_blogs_msg_12 "_blogs : Traitement" -_blogs_msg_14 "_blogs : Traitement des substituts dans" -_blogs_msg_15 "_blogs : Exécution de la fonction" -_blogs_msg_15.1 "pour" -_blogs_msg_16 "_blogs : Vérification de #lien, #montrerimg et #videoyt dans le contenu du blog" -_blogs_msg_17 "_blogs : #lien présent, exécution de _lien : contenu du blog" -_blogs_msg_18 "_blogs : #montrerimg présent, exécution de _lien : contenu du blog" -_blogs_msg_19 "_blogs : #videoyt présent, exécution de _lien : contenu du blog" -_blogs_msg_20 "_blogs : Remplacement de slogan, nomdusite et titredelapage" -_blogs_msg_21 "_blogs : Création du répertoire" -_blogs_msg_22 "_blogs : Écriture du blog sur le disque :" -_blogs_msg_23 "_blogs : nouveaux_blogs_mis_à_jour=true" -_blogs_msg_24 "- Aucun nouveau blog ou mise à jour trouvée" -_blogs_msg_25 "* _blogs : Exécution de _index_des_blogs_pour_index" -_blogs_msg_26 "* _blogs : Exécution de _index_des_blogs" -_blog_idx_for_index_msg_1 "- Peuplement" -_blog_idx_for_index_msg_2 "_index_des_blogs_pour_index : Initiation de la fonction" -_blog_idx_for_index_msg_3 "_index_des_blogs_pour_index : TABLEAU_DES_META_DU_BLOG :" -_blog_idx_for_index_msg_4 "_index_des_blogs_pour_index : meta_str du TABLEAU_DES_META_DU_BLOG de _blogs" -_blog_idx_for_index_msg_5 "_index_des_blogs_pour_index :" -_blog_idx_for_index_msg_6 "_index_des_blogs_pour_index : Itération sur chaque composant et extraction des informations" -_blog_idx_for_index_msg_7 "_index_des_blogs_pour_index : Exécution de" -_blog_idx_for_index_msg_7.1 "sur le contenu pour attraper les QStags dans l'Ingress" -_blog_idx_for_index_msg_8 "_index_des_blogs_pour_index : Écriture de _index_des_blogs_pour_index dans le fichier :" -_blog_idx_for_index_msg_9 "_index_des_blogs_pour_index : contenu_de_la_liste_des_blogs =" -_blog_index_msg_1 "_index_des_blogs : blog_dans_index=" -_blog_index_msg_2 "_index_des_blogs : nouveaux_blogs_mis_à_jour=" -_blog_index_msg_3 "_index_des_blogs : Exécution de la fonction _index_des_blogs" -_blog_index_msg_4 "_index_des_blogs : blog_dans_index =" -_blog_index_msg_5 "- Génération de la Page :" -_blog_index_msg_6 "_index_des_blogs : Remplacement de nomdusite et slogan" -_blog_index_msg_7 "_index_des_blogs : Remplacement du CORPS par le contenu de" -_blog_index_msg_8 "_index_des_blogs : Écriture" -_blog_index_msg_9 "_index_des_blogs : Longueur du contenu de blog_index_content :" -_add_blog_list_to_index_msg_1 "_add_blog_list_to_index : Insertion de la liste des blogs dans index.html" -_sitemap_msg_1 "Génération du Plan du site" -_sitemap_msg_2 "Plan du site généré à" -_link_msg_1 "_link : URL_PRINCIPALE(ligne) :" -_link_msg_2 "_link_ URL :" -_link_msg_3 "_link : Texte :" -_image_msg_1 "_image : Traitement de la ligne :" -_youtube_msg_1 "_youtube : Traitement de la ligne :" -_cleanup_msg_1 "_cleanup : Nettoyage des tags dans le contenu" -_html_msg_1 "_html : Conversion des QStags dans le contenu" -_zhtml_msg_1 "_zhtml : Conversion des QStags dans le contenu" -) +# Générateur de Site Rapide 2 - Fichier de langue française +# Ce fichier contient toutes les chaînes visibles par l'utilisateur pour l'application + +# Messages d'erreur +error.missing_dependencies = "Dépendances requises manquantes : %s" +error.config_validation_failed = "Échec de la validation de la configuration. Veuillez vérifier vos fichiers de configuration." +error.config_missing_key = "Configuration requise manquante : %s" +error.invalid_url = "site_url doit commencer par http:// ou https://" +error.directory_not_found = "Le répertoire n'existe pas : %s" +error.theme_not_found = "Répertoire du thème introuvable : %s" +error.theme_config_not_found = "Configuration du thème introuvable : %s" +error.theme_config_creation_failed = "Échec de la création de la configuration du thème : %s" +error.config_parse = "Échec de l'analyse du fichier de configuration : %s" +error.invalid_path = "Chemin invalide : %s" +error.write_failed = "Échec de l'écriture dans le fichier temporaire : %s" +error.move_failed = "Échec du déplacement du fichier temporaire vers : %s" +error.config_load_failed = "Échec du chargement du fichier de configuration : %s" +error.config_not_found = "Aucun fichier de configuration valide trouvé." +error.create_blog_index_failed = "Échec de la création de l'index du blog à : %s" +error.create_sample_post_failed = "Échec de la création d'un exemple d'article de blog à : %s" +error.create_sample_page_failed = "Échec de la création d'une page exemple à : %s" +error.engine_not_found = "Moteur introuvable ou non exécutable : %s" +error.unknown_generator = "Générateur inconnu : %s" +error.unknown_option = "Option inconnue : %s" +error.directory_not_empty = "Le répertoire '%s' existe déjà et n'est pas vide." +error.theme_creation_failed = "Échec de la création du thème : %s" +error.config_creation_failed = "Échec de la création du fichier de configuration : %s" +error.directory_creation_failed = "Échec de la création du répertoire : %s" +error.file_creation_failed = "Échec de la création du fichier : %s" +error.layout_creation_failed = "Échec de la création du fichier de mise en page : %s" +error.stylesheet_creation_failed = "Échec de la création de la feuille de style : %s" +error.script_creation_failed = "Échec de la création du fichier de script : %s" + +# Messages d'avertissement +warning.optional_dependency = "L'outil optionnel '%s' est requis pour %s mais n'a pas été trouvé" +warning.dependency_version = "La version %s de %s est inférieure à la version recommandée %s" +warning.legacy_config = "Utilisation d'un fichier de configuration hérité. Envisagez de renommer '%s' en 'site.conf'" +warning.git_repo = "Attention : Exécution dans un répertoire de dépôt git. Assurez-vous que c'est intentionnel." +warning.outdated_dependencies = "Certaines dépendances ne sont pas à jour :" + +# Messages d'information +info.legacy_config = "Attention : Utilisation du fichier hérité '%s'. Envisagez de le renommer en 'site.conf'" +info.legacy_config_used = "Utilisation du fichier de configuration hérité. Envisagez de renommer 'config' en 'site.conf'" +info.config_help = "Veuillez créer un fichier 'site.conf' dans votre répertoire de projet." +info.config_template = "Vous pouvez utiliser 'config.example' comme modèle." +info.git_repo_help = "Si vous souhaitez générer le site, exécutez depuis le répertoire racine du projet." +info.usage = "Utilisation : %s [options]" +info.engine_usage = "Utilisation : _run_engine " +info.creating_blog_index = "Création du fichier d'index du blog..." +info.creating_sample_post = "Création d'un exemple d'article de blog..." +info.creating_sample_page = "Création d'une page exemple..." +info.setting_up_project = "Configuration de la structure du projet..." +info.creating_directories = "Création des répertoires du projet..." +info.initializing_blog = "Initialisation du blog..." +info.initializing_pages = "Initialisation des pages..." +info.initializing_theme = "Initialisation du thème..." +# Messages de débogage +debug.loading_config = "Chargement du fichier de configuration : %s" +debug.loaded_config = "=== Configuration Chargée ===" +debug.config_value = "%s : %s" +debug.config_end = "==========================" +debug.raw_config = "=== Fichier de Configuration Brut ===" +debug.raw_config_end = "================================" +debug.blog_cache_update = "Mise à jour du cache du blog à %s" +debug.blog_cache_bytes = "Cache du blog mis à jour avec %d octets" +debug.blog_cache_loading = "Chargement de l'index du blog depuis le cache" +debug.blog_cache_stale_new = "Cache du blog obsolète : Nouveaux blogs ou mises à jour détectés" +debug.blog_cache_stale_deleted = "Cache du blog obsolète : Blogs supprimés détectés" +debug.blog_cache_fresh = "Le cache du blog est à jour, reconstruction ignorée" +debug.blog_cache_rebuilding = "Reconstruction du cache du blog..." +debug.blog_cache_rebuilt = "Cache du blog reconstruit avec %d entrées" +debug.pages_cache_update = "Mise à jour du cache des pages à %s" +debug.pages_cache_bytes = "Cache des pages mis à jour avec %d octets" +debug.pages_cache_loading = "Chargement de l'index des pages depuis le cache" +debug.pages_cache_stale_new = "Cache des pages obsolète : Nouvelles pages ou mises à jour détectées" +debug.pages_cache_stale_deleted = "Cache des pages obsolète : Pages supprimées détectées" +debug.pages_cache_fresh = "Le cache des pages est à jour, reconstruction ignorée" +debug.pages_cache_rebuilding = "Reconstruction du cache des pages..." +debug.pages_cache_rebuilt = "Cache des pages reconstruit avec %d entrées" +debug.cache_hit = "Cache trouvé pour %s" +debug.cache_miss = "Cache manquant pour %s" +debug.cache_updated = "Cache mis à jour pour %s" +debug.cache_skipped = "Mise à jour du cache ignorée pour %s (aucun changement détecté)" +blog.cache_loading = "Chargement de l'index du blog depuis le cache" +blog.cache_stale = "Cache du blog obsolète, reconstruction..." +blog.cache_fresh = "Le cache du blog est à jour" +blog.post_updated = "Article de blog mis à jour : %s" +blog.post_skipped = "Ignoré (aucun changement) : %s" + +# Blog Messages +blog.not_found = "Aucun fichier de blog trouvé." +blog.generating = "Génération du blog" +blog.no_template = "Impossible de trouver le modèle de blog : %s" +blog.cache_updated = "Cache du blog mis à jour" +blog.cache_loading = "Chargement de l'index du blog depuis le cache" +blog.cache_stale = "Cache du blog obsolète, reconstruction..." +blog.cache_fresh = "Le cache du blog est à jour" +blog.post_updated = "Article de blog mis à jour : %s" +blog.post_skipped = "Ignoré (aucun changement) : %s" +blog.post_error = "Erreur lors du traitement de l'article de blog : %s" + +# Messages de Génération de Blog +blog.hello_world_title = "Bonjour le monde !" +blog.published_on = "Publié le" +blog.welcome_message = "Bienvenue sur votre nouveau blog ! Ceci est un exemple d'article de blog." +blog.getting_started = "Pour commencer" +blog.edit_this_post = "Vous pouvez modifier cet article à l'emplacement %s" +blog.features = "Fonctionnalités" +blog.feature_markdown = "Prise en charge du Markdown" +blog.feature_easy_customize = "Facile à personnaliser" +blog.feature_fast_lightweight = "Rapide et léger" +blog.next_steps = "Prochaines étapes" +blog.step_edit_post = "Modifier cet article" +blog.step_add_posts = "Ajouter plus d'articles" +blog.step_customize_theme = "Personnaliser votre thème" +blog.step_publish_site = "Publier votre site" +blog.happy_blogging = "Bon blogage !" +blog.latest_posts = "Derniers articles" +blog.sample_post = "Article de blog" +blog.categories = "Catégories" +blog.sample_category = "Catégorie" +blog.archives = "Archives" +blog.tags = "Étiquettes" +blog.about = "À propos" +blog.about_text = "Ceci est une page d'index de blog exemple. Vous pouvez la modifier à l'emplacement %s" + +# Messages de Génération de Pages +page.about_me_title = "À propos de moi" +page.welcome_title = "Bienvenue sur mon site" +page.welcome_message = "Ceci est une page À propos exemple. Vous pouvez la modifier à l'emplacement %s" +page.my_story_title = "Mon histoire" +page.my_story_content = "Je suis un développeur passionné qui adore créer des sites web incroyables avec qsgen2 !" +page.skills_title = "Compétences" +page.skill_webdev = "Développement Web" +page.skill_design = "Design" +page.skill_opensource = "Logiciel Libre" +page.contact_title = "Contact" +page.contact_content = "Vous pouvez me contacter à : email@exemple.com" +page.about_site_title = "À propos de ce site" +page.about_site_content = "Ce site a été construit avec [qsgen2](https://github.com/kekePower/qsgen2)." + +# Messages de Succès +success.config_loaded = "Configuration chargée avec succès" +success.build_complete = "Construction terminée avec succès" +success.blog_index_created = "Index du blog créé à l'emplacement : %s" +success.sample_post_created = "Exemple d'article de blog créé à l'emplacement : %s" +success.sample_page_created = "Page exemple créée à l'emplacement : %s" +success.project_initialized = "Projet initialisé avec succès !" +success.theme_initialized = "Thème initialisé avec succès !" +success.config_initialized = "Fichier de configuration créé avec succès !" + +# Messages Système +system.created_by = "- Créé par kekePower - 2018-%s" +system.see_help = "- Voir '%s help' pour plus d'informations." + +# Messages de Liste +list.pages_not_found = "_list_pages : Aucune page trouvée avec l'extension %s" +list.pages_adding = "_list_pages : Ajout du fichier au tableau : %s" +list.blogs_not_found = "_list_blogs : Aucun fichier de blog trouvé." +list.blogs_adding = "_list_blogs : Ajout du fichier au tableau : %s" + +# Navigation +nav.home = "Accueil" +nav.blog = "Blog" +nav.about = "À propos" + +# Pied de page +footer.all_rights_reserved = "Tous droits réservés." + +# Configuration +config.site_config_title = "Configuration du Site" +config.theme_config_title = "Configuration du Thème" +config.site_name_default = "Mon Super Site" +config.site_tagline_default = "Un site statique généré avec qsgen2" +config.site_description_default = "Voici mon super site statique" +config.your_name = "Votre Nom" +config.theme_description = "Un thème personnalisé pour qsgen2" +config.theme_files_title = "Fichiers du thème (relatif au répertoire du thème)" + +# CSS et JavaScript +css.main_styles = "Styles Principaux" +js.main_javascript = "JavaScript Principal" +js.console_message = "Bonjour depuis qsgen2 !" +js.add_custom_javascript = "Ajoutez votre code JavaScript personnalisé ici" +js.your_code_here = "Votre code ici" + +# Messages de Dernière Mise à Jour +last_updated.setting = "_last_updated : Définition de la date et de la version dans le pied de page" +last_updated.file_not_found = "_f_last_updated : Fichier %s non trouvé." + +# Pages Messages +pages.generating = "Génération des Pages" +pages.none = "* Vous n'avez aucune page *" +pages.no_template = "Impossible de trouver le modèle de page : %s" + +# Messages Pandoc +pandoc.install = "Veuillez installer Pandoc." +pandoc.download = "https://github.com/jgm/pandoc/releases" + +# Messages du Générateur +generator.not_found = "Aucun générateur valide trouvé. Êtes-vous sûr d'avoir sélectionné le bon générateur dans 'config' ?" +generator.using = "Utilisation du générateur : %s" +generator.not_found = "Générateur introuvable : %s" +generator.execution_failed = "Échec de l'exécution du générateur : %s" +generator.execution_success = "Générateur exécuté avec succès : %s" + +# Messages de Construction +build.forced = "- Mise à jour forcée : Génération complète" +build.using_engine = "Utilisation du moteur %s pour les fichiers :" diff --git a/include/qsgen2/lang/nb_NO b/include/qsgen2/lang/nb_NO index b164004..eb7bfc5 100644 --- a/include/qsgen2/lang/nb_NO +++ b/include/qsgen2/lang/nb_NO @@ -1,115 +1,217 @@ -qsgenlang=( -_qsgen2_msg_2 "Tvungen oppdatering: Genererer alt" -_qsgen2_msg_3 "* %SCRIPT_NAME% kan ikke analysere dette nettstedet. Avslutter. *" -_qsgen2_msg_4 "Vennligst installer Pandoc." -_qsgen2_msg_5 "Ingen gyldig generator funnet. Er du sikker på at du har valgt riktig generator i 'config'?" -_qsgen2_msg_6 "Bruker ${generator}-motoren for filer: ${file_ext}" -_qsgen2_msg_7 "- Laget av kekePower - 2018" -_qsgen2_msg_8 "- Se" -_qsgen2_msg_8.1 "for mer informasjon." -_qsgen2_msg_9 "Innhold i Config filen:" -_list_pages_msg_1 "_list_pages: Ingen sider funnet med utvidelse" -_list_pages_msg_2 "_list_pages: Legger til fil i array:" -_list_blogs_msg_3 "_list_blogs: Ingen blogginnlegg funnet." -_list_blogs_msg_4 "_list_blogs: Legger til fil i array:" -_blog_cache_msg_1 "_blog_cache: HASH VERDI:" -_blog_cache_msg_2 "1. _blog_cache:" -_blog_cache_msg_3 "2. _blog_cache: nåværende cache:" -_blog_cache_msg_4 "3. _blog_cache: ny cache-fil:" -_blog_cache_msg_5 "4. _blog_cache: ny nåværende cache:" -_pages_cache_msg_1 "_pages_cache: PAGES HASH VERDI:" -_pages_cache_msg_2 "1. pages_cache:" -_pages_cache_msg_3 "1. _pages_cache: nåværende cache:" -_pages_cache_msg_4 "2. _pages_cache: sidefil:" -_pages_cache_msg_5 "2. _pages_cache: nåværende cache:" -_last_updated_msg_1 "_last_updated: Setter dato og versjon i bunntekst" -_last_updated_msg_1 "_last_updated:" -_f_last_updated_msg_1 "_f_last_updated: Setter dato og versjon i bunntekst for fil" -_f_last_updated_msg_2 "_f_last_updated:" -_f_last_updated_msg_3 "_f_last_updated: Filen" -_f_last_updated_msg_3.1 "ble ikke funnet." -_pages_msg_1 "_pages: Kjører funksjon _pages_cache" -_pages_msg_2 "* Du har ingen sider *" -_pages_msg_3 "Genererer Sider" -_pages_msg_4 "_pages: sidearray er ikke tom" -_pages_msg_5 "_pages: Setter Opp Sider-mal" -_pages_msg_6 "Kan ikke finne Sidemalen:" -_pages_msg_7 "_pages: Leser Sidemalen inn i pages_tpl" -_pages_msg_9 "_pages: Laster sideinnhold en gang - " -_pages_msg_10 "_pages: Finne sidetittel" -_pages_msg_11 "_pages:" -_pages_msg_12 "_pages: Fjerner #tittel linje fra sideinnhold" -_pages_msg_13 "_pages: Kjører motor på" -_pages_msg_14 "_pages: Sjekker for #link, #showimg og #ytvideo i sideinnhold" -_pages_msg_15 "_pages: #link er til stede, kjør _link: sideinnhold" -_pages_msg_16 "_pages: #showimg er til stede, kjør _image: sideinnhold" -_pages_msg_17 "_pages: #ytvideo er til stede, kjør _youtube: sideinnhold" -_pages_msg_18 "_pages: Erstatter #sidetittel, #tagline og #sidenavn i pages_tpl" -_pages_msg_19 "_pages: Erstatter BODY med sideinnhold i pages_tpl" -_pages_msg_20 "_pages: _last_updated i pages_tpl" -_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 "- 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 "- 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" -_blogs_msg_4 "_blogs: Kjører funksjon _blog_cache" -_blogs_msg_5 "Kan ikke finne tema mal for Blogger." -_blogs_msg_6 "_blogs: Behandler forhåndsdata for" -_blogs_msg_7 "_blogs: Leter etter DATO: Funnet" -_blogs_msg_8 "_blogs: Leter etter BLOGGTITTEL: Funnet" -_blogs_msg_9 "* _blogs: DATO-metadata mangler i" -_blogs_msg_10 "* _blogs: BLOGGTITTEL-metadata mangler i" -_blogs_msg_11 "_blogs: Legger til data for" -_blogs_msg_11.1 "til array for eksport" -_blogs_msg_12 "_blogs: Behandler" -_blogs_msg_14 "_blogs: Behandler erstatninger i" -_blogs_msg_15 "_blogs: Kjører funksjon" -_blogs_msg_15.1 "for" -_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" -_blogs_msg_22 "_blogs: Skriver blogg til disk:" -_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" -_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_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:" -_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" -_blog_idx_for_index_msg_7.1 "på innhold for å fange QStags i Ingress" -_blog_idx_for_index_msg_8 "_blog_idx_for_index: Skriver _blog_idx_for_index til fil:" -_blog_idx_for_index_msg_9 "_blog_idx_for_index: blog_list_content =" -_blog_index_msg_1 "_blog_index: blog_in_index=" -_blog_index_msg_2 "_blog_index: new_updated_blogs=" -_blog_index_msg_3 "_blog_index: Kjører funksjon _blog_index" -_blog_index_msg_4 "_blog_index: blog_in_index = " -_blog_index_msg_5 "- Genererer Side:" -_blog_index_msg_6 "_blog_index: Erstatter sitenavn og tagline" -_blog_index_msg_7 "_blog_index: Erstatter BODY med innhold fra" -_blog_index_msg_8 "_blog_index: Skriver" -_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å" -_link_msg_1 "_link: HOVED URL-LINJE:" -_link_msg_2 "_link_ URL:" -_link_msg_3 "_link: Tekst:" -_image_msg_1 "_image: Behandler linje:" -_youtube_msg_1 "_youtube: Behandler linje:" -_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" -) +# Quick Site Generator 2 - Norsk språkfil +# Denne filen inneholder alle brukervendte strenger for applikasjonen + +# Feilmeldinger +error.missing_dependencies = "Mangler påkrevde avhengigheter: %s" +error.config_validation_failed = "Validering av konfigurasjon feilet. Vennligst sjekk konfigurasjonsfilene dine." +error.config_missing_key = "Mangler påkrevd konfigurasjon: %s" +error.invalid_url = "site_url må starte med http:// eller https://" +error.directory_not_found = "Mappen finnes ikke: %s" +error.theme_not_found = "Temamappe ikke funnet: %s" +error.theme_config_not_found = "Temakonfigurasjon ikke funnet: %s" +error.theme_config_creation_failed = "Kunne ikke opprette temakonfigurasjon: %s" +error.config_parse = "Kunne ikke tolke konfigurasjonsfil: %s" +error.invalid_path = "Ugyldig sti: %s" +error.write_failed = "Kunne ikke skrive til midlertidig fil: %s" +error.move_failed = "Kunne ikke flytte midlertidig fil til: %s" +error.config_load_failed = "Kunne ikke laste konfigurasjonsfil: %s" +error.config_not_found = "Ingen gyldig konfigurasjonsfil funnet." +error.create_blog_index_failed = "Kunne ikke opprette bloggindeks på: %s" +error.create_sample_post_failed = "Kunne ikke opprette eksempelinnlegg på: %s" +error.create_sample_page_failed = "Kunne ikke opprette eksempelside på: %s" +error.engine_not_found = "Motor ikke funnet eller ikke kjørbar: %s" +error.unknown_generator = "Ukjent generator: %s" +error.unknown_option = "Ukjent alternativ: %s" +error.directory_not_empty = "Mappen '%s' finnes allerede og er ikke tom." +error.theme_creation_failed = "Kunne ikke opprette tema: %s" +error.config_creation_failed = "Kunne ikke opprette konfigurasjonsfil: %s" +error.directory_creation_failed = "Kunne ikke opprette mappe: %s" +error.file_creation_failed = "Kunne ikke opprette fil: %s" +error.layout_creation_failed = "Kunne ikke opprette layoutfil: %s" +error.stylesheet_creation_failed = "Kunne ikke opprette stilark: %s" +error.script_creation_failed = "Kunne ikke opprette scriptfil: %s" + +# Advarselsmeldinger +warning.optional_dependency = "Valgfritt verktøy '%s' kreves for %s, men ble ikke funnet" +warning.dependency_version = "%s versjon %s er lavere enn anbefalt versjon %s" +warning.legacy_config = "Bruker gammel konfigurasjonsfil. Vurder å endre navn på '%s' til 'site.conf'" +warning.git_repo = "Advarsel: Kjører i en git-mappe. Forsikre deg om at dette er meningen." +warning.outdated_dependencies = "Noen avhengigheter er utdaterte:" + +# Informasjonsmeldinger +info.legacy_config = "Advarsel: Bruker gammel '%s'-fil. Vurder å endre navn til 'site.conf'" +info.legacy_config_used = "Bruker gammel konfigurasjonsfil. Vurder å endre navn fra 'config' til 'site.conf'" +info.config_help = "Vennligst opprett 'site.conf' i prosjektmappen din." +info.config_template = "Du kan bruke 'config.example' som en mal." +info.git_repo_help = "Hvis du vil generere nettsiden, kjør fra prosjektets rotmappe." +info.usage = "Bruk: %s [alternativer]" +info.engine_usage = "Bruk: _run_engine " +info.creating_blog_index = "Oppretter bloggindeksfil..." +info.creating_sample_post = "Oppretter eksempelinnlegg..." +info.creating_sample_page = "Oppretter eksempelside..." +info.setting_up_project = "Setter opp prosjektstruktur..." +info.creating_directories = "Oppretter prosjektmapper..." +info.initializing_blog = "Initialiserer blogg..." +info.initializing_pages = "Initialiserer sider..." +info.initializing_theme = "Initialiserer tema..." +info.initializing_config = "Initialiserer konfigurasjon..." +info.initializing_complete = "Initialisering fullført!" +info.initializing_aborted = "Initialisering avbrutt." +info.use_force_option = "Bruk --force for å overskrive den eksisterende mappen." +info.get_started_instructions = "For å komme i gang" +info.happy_coding = "Lykke til med kodingen!" +info.initializing_project = "Initialiserer prosjekt..." +info.initializing_blog_cache = "Initialiserer blogg-mellomlager..." +info.initializing_pages_cache = "Initialiserer side-mellomlager..." + +# Feilsøkingsmeldinger +debug.loading_config = "Laster konfigurasjonsfil: %s" +debug.loaded_config = "=== Lastet Konfigurasjon ===" +debug.config_value = "%s: %s" +debug.config_end = "==========================" +debug.raw_config = "=== Rå Konfigurasjonsfil ===" +debug.raw_config_end = "========================" +debug.blog_cache_update = "Oppdaterer blogg-mellomlager på %s" +debug.blog_cache_bytes = "Blogg-mellomlager oppdatert med %d byte" +debug.blog_cache_loading = "Laster bloggindeks fra mellomlager" +debug.blog_cache_stale_new = "Blogg-mellomlager utdatert: Nye eller oppdaterte blogger oppdaget" +debug.blog_cache_stale_missing = "Blogg-mellomlager utdatert: Mellomlagerfilen finnes ikke" +debug.blog_cache_stale_old = "Blogg-mellomlager utdatert: Mellomlager er eldre enn 1 time" +debug.blog_cache_fresh = "Blogg-mellomlager er oppdatert" +debug.pages_cache_update = "Oppdaterer side-mellomlager på %s" +debug.pages_cache_bytes = "Side-mellomlager oppdatert med %d byte" +debug.pages_cache_loading = "Laster sideindeks fra mellomlager" +debug.pages_cache_stale_new = "Side-mellomlager utdatert: Nye eller oppdaterte sider oppdaget" +debug.pages_cache_stale_missing = "Side-mellomlager utdatert: Mellomlagerfilen finnes ikke" +debug.pages_cache_stale_old = "Side-mellomlager utdatert: Mellomlager er eldre enn 1 time" +debug.pages_cache_fresh = "Side-mellomlager er oppdatert" + +# Bloggmeldinger +blog.not_found = "Ingen bloggfiler funnet." +blog.generating = "Genererer blogg" +blog.no_template = "Kunne ikke finne bloggmalen: %s" +blog.cache_updated = "Blogg-mellomlager oppdatert" +blog.cache_loading = "Laster blogg-mellomlager" +blog.cache_stale = "Blogg-mellomlager er utdatert, bygger på nytt..." +blog.cache_fresh = "Blogg-mellomlager er oppdatert" +blog.post_updated = "Oppdatert blogginnlegg: %s" +blog.post_skipped = "Hoppet over (ingen endringer): %s" +blog.post_error = "Feil ved behandling av blogginnlegg: %s" + +# Blogg-genereringsmeldinger +blog.hello_world_title = "Hallo, verden!" +blog.published_on = "Publisert den" +blog.welcome_message = "Velkommen til din nye blogg! Dette er et eksempel på et blogginnlegg." +blog.getting_started = "Kom i gang" +blog.edit_this_post = "Du kan redigere dette innlegget på %s" +blog.features = "Funksjoner" +blog.feature_markdown = "Støtte for Markdown" +blog.feature_easy_customize = "Lett å tilpasse" +blog.feature_fast_lightweight = "Rask og lettvektig" +blog.next_steps = "Neste steg" +blog.step_edit_post = "Rediger dette innlegget" +blog.step_add_posts = "Legg til flere innlegg" +blog.step_customize_theme = "Tilpass temaet ditt" +blog.step_publish_site = "Publiser nettstedet ditt" +blog.happy_blogging = "Lykke til med bloggingen!" +blog.latest_posts = "Siste innlegg" +blog.sample_post = "Blogginnlegg" +blog.categories = "Kategorier" +blog.sample_category = "Kategori" +blog.archives = "Arkiv" +blog.tags = "Emneknagger" +blog.about = "Om" +blog.about_text = "Dette er en eksempelindeksside for bloggen. Du kan redigere den på %s" + +# Sidegenereringsmeldinger +page.about_me_title = "Om meg" +page.welcome_title = "Velkommen til nettstedet mitt" +page.welcome_message = "Dette er en eksempel 'om'-side. Du kan redigere den på %s" +page.my_story_title = "Min historie" +page.my_story_content = "Jeg er en lidenskapelig utvikler som elsker å lage fantastiske nettsteder med qsgen2!" +page.skills_title = "Ferdigheter" +page.skill_webdev = "Nettutvikling" +page.skill_design = "Design" +page.skill_opensource = "Åpen kildekode" +page.contact_title = "Kontakt" +page.contact_content = "Du kan nå meg på: epost@eksempel.no" +page.about_site_title = "Om dette nettstedet" +page.about_site_content = "Dette nettstedet er bygget med [qsgen2](https://github.com/kekePower/qsgen2)." + +# Suksessmeldinger +success.config_loaded = "Konfigurasjon lastet inn vellykket" +success.build_complete = "Bygging fullført vellykket" +success.blog_index_created = "Opprettet bloggindeks på: %s" +success.sample_post_created = "Opprettet eksempelblogginnlegg på: %s" +success.sample_page_created = "Opprettet eksempelside på: %s" +success.project_initialized = "Prosjektet er initialisert!" +success.theme_initialized = "Temaet er initialisert!" +success.config_initialized = "Konfigurasjonsfil opprettet!" + +# Blogg-mellomlager meldinger +blog_cache.hash = "_blog_cache: HASH VERDI:" +blog_cache.current = "1. _blog_cache:" +blog_cache.cache_file = "2. _blog_cache: current_cache:" +blog_cache.new_cache = "3. _blog_cache: new_cache_file:" +blog_cache.new_current = "4. _blog_cache: new_current_cache:" + +# Sider-mellomlager meldinger +page_cache.hash = "SIDER HASH VERDI:" +page_cache.current = "1. pages_cache:" +page_cache.cache_file = "2. _pages_cache: current_cache:" +page_cache.pages_file = "2. _pages_cache: pages_file:" + +# Systemmeldinger +system.created_by = "- Laget av kekePower - 2018-%s" +system.see_help = "- Se '%s help' for mer informasjon." + +# Listemeldinger +list.pages_not_found = "_list_pages: Ingen sider funnet med filendelse %s" +list.pages_adding = "_list_pages: Legger til fil i tabell: %s" +list.blogs_not_found = "_list_blogs: Ingen bloggfiler funnet." +list.blogs_adding = "_list_blogs: Legger til fil i tabell: %s" + +# Navigasjon +nav.home = "Hjem" +nav.blog = "Blogg" +nav.about = "Om" + +# Bunntekst +footer.all_rights_reserved = "Alle rettigheter reservert." + +# Konfigurasjon +config.site_config_title = "Nettstedsinnstillinger" +config.theme_config_title = "Temainnstillinger" +config.site_name_default = "Mitt fantastiske nettsted" +config.site_tagline_default = "Et statisk nettsted generert med qsgen2" +config.site_description_default = "Dette er mitt fantastiske statiske nettsted" +config.your_name = "Ditt navn" +config.theme_description = "Et egendefinert tema for qsgen2" +config.theme_files_title = "Temafiler (relativ til temamappe)" + +# CSS og JavaScript +css.main_styles = "Hovedstiler" +js.main_javascript = "Hoved-JavaScript" +js.console_message = "Hallo fra qsgen2!" +js.add_custom_javascript = "Legg til egendefinert JavaScript her" +js.your_code_here = "Din kode her" + +# Sist oppdatert-meldinger +last_updated.setting = "_last_updated: Setter dato og versjon i bunntekst" +last_updated.file_not_found = "_f_last_updated: Filen %s ble ikke funnet." + +# Pages Messages +pages.generating = "Genererer sider" +pages.none = "* Du har ingen sider *" +pages.no_template = "Kunne ikke finne sidemalen: %s" + +# Pandoc Messages +pandoc.install = "Please install Pandoc." +pandoc.download = "https://github.com/jgm/pandoc/releases" + +# Generator Messages +generator.not_found = "No valid generator found. Are you sure you've selected the correct generator in 'config'?" + +# Build Messages +build.forced = "- Forced Update: Generating Everything" +build.using_engine = "Using the %s -engine for files:" diff --git a/qsgen3 b/qsgen3 index 8b53d6d..df659ab 100755 --- a/qsgen3 +++ b/qsgen3 @@ -1,4 +1,4 @@ -#!/usr/bin/zsh +#!/usr/bin/env zsh ############################################################################### ############################################################################### @@ -16,14 +16,287 @@ ############################################################################### ############################################################################### -VERSION="0.4.3" # Sat-2024-02-24 +VERSION="0.6.0" # Sun-2025-05-18 QSGEN="Quick Site Generator 2" -# Set to true or false -# This will show debug information from every function in this script -# You can also set debug=true in a single function if you want to debug only that specific one. +# Exit immediately if a command exits with a non-zero status +# Do not allow unset variables +# Exit if any command in a pipeline fails +set -euo pipefail + +# Set the default locale and handle all filenames correctly +LC_ALL=C +LANG=C +IFS=$' \n\t' + +# Set the umask to prevent world-writable files +umask 0022 + +# Enable advanced pattern matching and extended globbing +setopt extended_glob +setopt glob_star_short + +# Global associative arrays +typeset -gA config # Configuration parameters +typeset -gA config_cache # Cached configuration values +typeset -ga BLOG_META_STR_ARRAY # Blog metadata array +typeset -gA messages # Localized messages + +# Load messages with auto-detection and fallback to en_US +_load_messages() { + local lang_dir="${0:h}/include/qsgen2/lang" + + # Default to en_US if no language is specified + local lang="en_US" + + # 1. Try configured language first + if [[ -n "${SITE_LANG:-}" ]]; then + lang="$SITE_LANG" + # 2. Try auto-detected system language + elif command -v locale >/dev/null; then + local sys_lang=$(locale | grep '^LANG=' | cut -d= -f2 | cut -d. -f1 | tr -d '"') + if [[ -n "$sys_lang" && -f "$lang_dir/$sys_lang" ]]; then + lang="$sys_lang" + fi + fi + + # Initialize messages array + typeset -gA messages + + # Load the language file + if [[ -f "$lang_dir/$lang" ]]; then + # Source the language file which should define the messages array + source "$lang_dir/$lang" + _msg debug "Using language: $lang" + else + _msg error "Language file not found: $lang_dir/$lang" + exit 1 + fi + + # If no messages were loaded, initialize with default messages + if (( ${#messages[@]} == 0 )); then + _msg warning "No messages loaded from language file. Using default messages." + messages=( + [error.config_not_found]="Configuration file not found" + [error.invalid_config]="Invalid configuration" + [warning.legacy_config_used]="Using legacy config file. Consider renaming to 'site.conf'" + [info.create_config]="Please create 'site.conf' in your project directory." + # Add more default messages as needed + ) + fi +} + +# Get a localized message +_i18n() { + local key="$1" + shift + + # First try to get the message from the messages array + # The messages are stored in the format: messages[key]="value" + local msg="" + + # Handle different message types + case "$key" in + error.*|warning.*|info.*|debug.*|success.*|blog.*) + # Direct message key (e.g., error.config_not_found) + msg="${messages[$key]:-}" + ;; + *) + # Try to find the message by key first + msg="${messages[$key]:-}" + ;; + esac + + # If message is still empty, use the key as fallback + if [[ -z "$msg" ]]; then + msg="$key" + fi + + # Replace placeholders with provided arguments + local i=1 + for arg in "$@"; do + msg=${msg/\%s/"$arg"} + i=$((i + 1)) + done + + echo -n "$msg" +} + +# Original _msg function that handles the actual message output +_original_msg() { + local level="$1" + shift + + # Skip if quiet mode is enabled for this level + case "$level" in + debug) [[ -z "$DEBUG" ]] && return ;; + info) [[ -n "$QUIET" ]] && return ;; + esac + + # Output the message with appropriate formatting + case "$level" in + error) echo -e "\e[1;31m[ERROR] $*\e[0m" >&2 ;; + warning) echo -e "\e[1;33m[WARNING] $*\e[0m" >&2 ;; + success) echo -e "\e[1;32m[SUCCESS] $*\e[0m" ;; + info) echo -e "[INFO] $*" ;; + debug) echo -e "\e[2m[DEBUG] $*\e[0m" >&2 ;; + *) echo -e "[$level] $*" ;; + esac +} + +# Wrapper for _msg to support i18n +_msg() { + local level="$1" + shift + + if [[ "$1" == "i18n" ]]; then + shift + local key="$1" + shift + _original_msg "$level" "$(_i18n "$key" "$@")" + else + _original_msg "$level" "$@" + fi +} + +# Core required tools and their minimum versions +declare -A REQUIRED_TOOLS=( + [zsh]="5.8" + [grep]="3.0" + [sed]="4.5" + [find]="4.7" +) + +# Optional tools and their minimum versions +declare -A OPTIONAL_TOOLS=( + [pandoc]="2.0" # Only needed for markdown support +) + +# Check for required tools and their versions +_check_dependencies() { + local tool version min_version + local missing_deps=() + local outdated_deps=() + + # Check core required tools + for tool in "${(@k)REQUIRED_TOOLS}"; do + if ! command -v "$tool" &>/dev/null; then + missing_deps+=("$tool") + continue + fi + + min_version="${REQUIRED_TOOLS[$tool]}" + version=$(_get_tool_version "$tool") + + if [[ "$(_version_compare "$version" "$min_version")" == "<" ]]; then + outdated_deps+=("$tool (installed: $version, required: $min_version)") + fi + done + + # Check optional tools + for tool in "${(@k)OPTIONAL_TOOLS}"; do + if ! command -v "$tool" &>/dev/null; then + _msg warning i18n warning.optional_dependency "$tool" "${OPTIONAL_TOOLS[$tool]}" + continue + fi + + min_version="${OPTIONAL_TOOLS[$tool]}" + version=$(_get_tool_version "$tool") + + if [[ "$(_version_compare "$version" "$min_version")" == "<" ]]; then + _msg warning i18n warning.dependency_version "$tool" "$version" "$min_version" + fi + done + + # Report missing dependencies + if (( ${#missing_deps[@]} > 0 )); then + _msg error i18n error.missing_dependencies "${(j:, :)missing_deps}" + return 1 + fi + + # Report outdated dependencies + if (( ${#outdated_deps[@]} > 0 )); then + _msg warning i18n warning.outdated_dependencies + for dep in "${outdated_deps[@]}"; do + _msg warning "- $dep" + done + fi + + # Check optional tools based on configuration + if [[ "${config[project_generator]:-}" == "markdown" ]]; then + for tool in "${(@k)OPTIONAL_TOOLS}"; do + if ! command -v "$tool" &>/dev/null; then + _msg warning "Optional tool '$tool' is required for markdown support but not found" + continue + fi + + min_version="${OPTIONAL_TOOLS[$tool]}" + version=$(_get_tool_version "$tool") + + if [[ "$(_version_compare "$version" "$min_version")" == "<" ]]; then + _msg warning "$tool version $version is below the recommended version $min_version" + fi + done + fi + + if (( ${#missing_deps[@]} > 0 )); then + _msg error "Missing required dependencies: ${(j:, :)missing_deps}" + fi + + if (( ${#outdated_deps[@]} > 0 )); then + _msg warning "Some dependencies are outdated:" + printf ' - %s\n' "${outdated_deps[@]}" + fi + + if (( ${#missing_deps[@]} > 0 )); then + exit 1 + fi +} + +# Get version of a tool +_get_tool_version() { + local tool="$1" + case "$tool" in + zsh) + "$tool" --version &1 | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n1 + ;; + esac +} + +# Compare version numbers +_version_compare() { + local v1=("${(s/./)1}") + local v2=("${(s/./)2}") + local i + + for ((i=1; i <= ${#v1} || i <= ${#v2}; i++)); do + if (( ${v1[i]:-0} < ${v2[i]:-0} )); then + echo "<" + return 0 + elif (( ${v1[i]:-0} > ${v2[i]:-0} )); then + echo ">" + return 0 + fi + done + echo "=" +} + +# Enable/disable debug mode for the entire script +# Can be overridden in individual functions for targeted debugging globaldebug=false +# Load messages early +_load_messages + +# Set debug mode if needed +[[ -n "$DEBUG" ]] && globaldebug=true + # Use Zsh fpath to set the path to some extra functions fpath=(${HOME}/bin/include/common ${HOME}/bin/include/qsgen2/lang $fpath) # In this case, let's load the 'include' function @@ -33,148 +306,387 @@ autoload zini # Including some colors to the script include common/colors +# Modern file reading function using zsh features +_read_file() { + local file="$1" + [[ -r "$file" ]] || return 1 + + # Use zsh's mapfile equivalent with proper error handling + local content + content="${(j: :f)$(<"$file")}" || return 1 + + # Remove trailing newline if present + echo -n "${content%$'\n'}" + return 0 +} + echo "${magenta}${blue_bg} ${QSGEN} ${end}${bold_white}${blue_bg}${VERSION} ${end}" +# Validate configuration values +_validate_config() { + local -a required=( + "site_name" "site_url" "site_theme" "site_root" "project_root" + "site_lang" "site_tagline" "site_description" + ) + + local valid=true + + # Check required fields + for key in "${required[@]}"; do + if [[ -z "${config[$key]:-}" ]]; then + _msg error i18n "error.missing_required_config" "${key}" + valid=false + fi + done + + # Validate URLs + if [[ -n "${config[site_url]:-}" ]]; then + if ! [[ "${config[site_url]}" =~ ^https?:// ]]; then + _msg error i18n "error.invalid_url_format" + valid=false + fi + fi + + # Validate directories + local -a dirs=("site_root" "project_root") + for dir in "${dirs[@]}"; do + if [[ -n "${config[$dir]:-}" && ! -d "${config[$dir]}" ]]; then + _msg error i18n "error.directory_not_found" "${config[$dir]}" + valid=false + fi + done + + # Validate theme + if [[ -n "${config[site_theme]:-}" && ! -d "${config[project_root]}/themes/${config[site_theme]}" ]]; then + _msg error i18n "error.theme_not_found" "${config[project_root]}/themes/${config[site_theme]}" + valid=false + fi + + # Load the theme configuration + local theme_conf="${config[project_root]}/themes/${config[site_theme]}/theme.conf" + if [[ -f "$theme_conf" ]]; then + source "$theme_conf" + _msg debug i18n "debug.theme_config_loaded" "$theme_conf" + else + _msg error i18n "error.theme_config_not_found" "$theme_conf" + exit 1 + fi + + if [[ "$valid" == false ]]; then + _msg error i18n "error.config_validation_failed" + exit 1 + fi +} + +# Load and validate configuration +_load_config() { + local config_file="$1" + if [[ -f "$config_file" ]]; then + if (${globaldebug}); then _msg debug i18n "debug.loading_config" "$config_file"; fi + if zini "$config_file"; then + return 0 + else + _msg error i18n "error.config_load_failed" "$config_file" + return 1 + fi + fi + return 1 +} + # Check for, and source, the config file for this specific website -if [[ -f $(pwd)/config ]]; then - if (${globaldebug}); then echo "${red}Config file found and sourced${end}\n${yellow} - $(pwd)/config${end}"; fi - zini $(pwd)/config +config_loaded=false +if _load_config "$(pwd)/site.conf"; then + config_loaded=true +elif _load_config "$(pwd)/config"; then + _msg warning i18n "warning.legacy_config_used" + config_loaded=true else - echo "${red}Cannot find configuration file.${end}" - echo "${yellow} - Please create the file 'config' in your project directory.${end}" - echo "${yellow} - See 'config.example' in the git source tree.${end}" - exit + _msg error i18n "error.config_not_found" + _msg info i18n "info.config_help" + _msg info i18n "info.config_template" + _msg info i18n "info.git_repo_help" + exit 1 fi -# Load language as defined in config -typeset -A qsgenlang -lang_found=false -for dir in $fpath; do - if [[ -f "${dir}/${config[project_lang]}" ]]; then - # echo "Language file: ${dir}/${config[project_lang]}" - source "${dir}/${config[project_lang]}" - lang_found=true - break +# Validate the loaded configuration +_validate_config + +# Set default values for optional parameters +config[parallel_jobs]="${config[parallel_jobs]:-$(nproc)}" +config[site_author]="${config[site_author]:-${USER}}" +config[site_timezone]="${config[site_timezone]:-$(date +%Z)}" + +# Ensure paths are absolute +if [[ -n "${config[site_root]:-}" && "${config[site_root]}" != /* ]]; then + config[site_root]="$(pwd)/${config[site_root]}" +fi + +if [[ -n "${config[project_root]:-}" && "${config[project_root]}" != /* ]]; then + config[project_root]="$(pwd)/${config[project_root]}" +fi + +# Safe file operations +_safe_path() { + # Resolve and validate a path to prevent directory traversal + # Usage: _safe_path "base/dir" "relative/path" + local base_dir="$1" + local target_path="$2" + + # Convert to absolute path + if [[ "$target_path" != /* ]]; then + target_path="$base_dir/$target_path" + fi + + # Normalize the path (resolve . and ..) + local normalized_path + normalized_path=$(realpath -m -- "$target_path" 2>/dev/null || echo "") + + # Ensure the path is within the base directory + if [[ -z "$normalized_path" || "$normalized_path" != "$base_dir"/* && "$normalized_path" != "$base_dir" ]]; then + _msg error i18n error.invalid_path "$target_path" + return 1 + fi + + echo "$normalized_path" + return 0 +} + +# Safe file writing with atomic operation +_safe_write() { + # Usage: _safe_write "content" "/path/to/file" + local content="$1" + local target_file="$2" + local tmp_file + + # Create parent directories if they don't exist + local dir_name + dir_name=$(dirname -- "$target_file") + mkdir -p -- "$dir_name" + + # Create a temporary file in the same directory for atomic write + tmp_file=$(mktemp -p "$dir_name" "${target_file##*/}.XXXXXXXXXX") + + # Write content to temporary file + echo -n "$content" > "$tmp_file" || { + _msg error i18n error.write_failed "$tmp_file" + rm -f -- "$tmp_file" + return 1 + } + + # Atomically move the file into place + mv -f -- "$tmp_file" "$target_file" || { + _msg error i18n error.move_failed "$tmp_file" "$target_file" + rm -f -- "$tmp_file" + return 1 + } + + return 0 +} + +# Debug: Show loaded configuration +if (${globaldebug}); then + _msg debug i18n debug.loaded_config + for key value in ${(kv)config}; do + _msg debug i18n debug.config_key_value "$key" "$value" + done + _msg debug i18n debug.config_end +fi + +# Check if we're in a git repository (but don't fail, just warn) +if git rev-parse --is-inside-work-tree &>/dev/null; then + _msg warning i18n warning.git_repo + _msg info i18n info.git_repo_help +fi + +# Create necessary directories if they don't exist +for dir in "${config[project_root]}/themes" "${config[project_root]}/pages" "${config[project_root]}/blog"; do + if [[ ! -d "$dir" ]]; then + mkdir -p "$dir" + _msg debug i18n debug.created_directory "$dir" fi done -if [[ ${lang_found} == "false" ]]; then - # Fall back to en_US if defined language isn't found - echo "Defined language, ${config[project_lang]}, not found. Using en_US." - source "${HOME}/bin/include/qsgen2/lang/en_US" - fi -if (${globaldebug}); then - qsconfig=$( cat $(pwd)/config | grep -v \# | awk '{print substr($0, index($0, " ") + 1)}' ) - echo "Content of Config file" - for qslines in ${qsconfig} - do - echo "${yellow}${qslines}${end}" - done -fi - -## -# @brief Display a message with specific formatting based on message type. -# @param type The type of message (e.g., std, info, debug, etc.) -# @param ... The keys or additional strings to be formatted and displayed. -function _msg() { - local type=$1 - shift # Remove the first argument so $@ now contains only keys or additional strings - - local full_msg="" - for arg in "$@"; do - if [[ -n "${qsgenlang[$arg]}" ]]; then - full_msg+="${qsgenlang[$arg]}" - else - full_msg+="$arg" - fi - done - - # Determine the color based on the type - local color="${end}" # Default to no color if type is unrecognized - case $type in - std) color="${green}" ;; - info) color="${yellow}" ;; - debug) color="${red}" ;; - other) color="${bold_yellow}" ;; - sub) color="${magenta}" ;; - main) color="${white}${green_bg}" ;; - esac - - # Use printf with %b to allow backslash escape interpretation - printf "${color}%b${end}\n" "${full_msg}" -} - -## -# @brief Display the version information of the script. -# @param ... Additional arguments (unused in this function). -function _version() { - _msg info "_qsgen2_msg_7" "-$(strftime "%Y")" - echo "${yellow}- https://github.com/kekePower/qsgen2/${end}" - _msg info "_qsgen2_msg_8" " '${1} help' " "_qsgen2_msg_8.1" - exit -} - -## -# @brief Display help information for the script. -# @param ... Additional arguments (unused in this function). -function _help() { - # This will also be translated some time in the future - echo "This is where I'll write the Help documentation." - exit -} - -if [[ "$1" == "version" || "$1" == "-v" || "$1" == "--version" ]]; then - _version ${0:t} -elif [[ "$1" == "help" || "$1" == "-h" || "$1" == "--help" ]]; then - _help ${0:t} -fi - -# Define cache files for blogs and pages -blog_cache_file="${config[project_root]}/.blog_cache" -pages_cache_file="${config[project_root]}/.pages_cache" - -# Let's check if qsgen2 can generate this site by checking if 'generator' is available -if [[ ! ${config[project_generator]} ]] || [[ -d $(pwd)/.git ]]; then - _msg debug "_qsgen2_msg_3" - exit -fi - -# We define the variable 'engine' based on what's in the 'config' file. -if [[ ${config[project_generator]} == "native" ]]; then - # Usage: ${engine} ${1} - Where 1 is the file you want to convert +# Set up the appropriate engine and file extension +if [[ ${config[project_generator]} == "qstags" ]]; then engine=_qstags export file_ext="qst" elif [[ ${config[project_generator]} == "markdown" ]]; then - if [[ ! -f /usr/local/bin/pandoc ]]; then - _msg other "_qsgen2_msg_4" - _msg other "https://github.com/jgm/pandoc/releases" - exit + if ! command -v pandoc &>/dev/null; then + _msg error i18n pandoc.install + _msg info i18n pandoc.download + exit 1 else - # Usage: ${engine} ${1} - Where 1 is the file you want parsed - engine="/usr/local/bin/pandoc" - engine_opts= + engine="pandoc" export file_ext="md" fi else - _msg debug "_qsgen2_msg_5" - exit + _msg error i18n generator.not_found + exit 1 fi -## -# @brief Run the configured engine to process the input file. -# @param input The input file to be processed. +_msg debug i18n debug.using_engine "$engine" "$file_ext" + +function _generate_sample_page() { + # Usage: _generate_sample_page + # This function generates a sample page + + local sample_page="${config[project_root]}/pages/about.${file_ext}" + + if [[ ! -f "${sample_page}" ]]; then + _msg info i18n info.creating_sample_page + + _atomic_write "${sample_page}" "# $(i18n page.about_me_title) + +## $(i18n page.welcome_title) + +$(i18n page.welcome_message \"${sample_page}") + +## $(i18n page.my_story_title) + +$(i18n page.my_story_content) + +## $(i18n page.skills_title) + +- $(i18n page.skill_webdev) +- $(i18n page.skill_design) +- $(i18n page.skill_opensource) + +## $(i18n page.contact_title) + +$(i18n page.contact_content) + +## $(i18n page.about_site_title) + +$(i18n page.about_site_content)" + + if [[ $? -ne 0 ]]; then + _msg error i18n error.create_sample_page_failed "${sample_page}" + return 1 + fi + + _msg success i18n success.sample_page_created "${sample_page}" + else + _msg debug i18n debug.sample_page_exists "${sample_page}" + fi + + return 0 +} + +function _generate_sample_blog_post() { + # Usage: _generate_sample_blog_post + # This function generates a sample blog post + + local sample_post="${config[project_root]}/blog/hello-world.${file_ext}" + + if [[ ! -f "${sample_post}" ]]; then + _msg info i18n info.creating_sample_post + + _atomic_write "${sample_post}" "# $(i18n blog.hello_world_title) + +*$(i18n blog.published_on) $(date +'%Y-%m-%d')* + +$(i18n blog.welcome_message) + +## $(i18n blog.getting_started) + +$(i18n blog.edit_this_post \"${sample_post}") + +## $(i18n blog.features) + +- $(i18n blog.feature_markdown) +- $(i18n blog.feature_easy_customize) +- $(i18n blog.feature_fast_lightweight) + +## $(i18n blog.next_steps) + +1. $(i18n blog.step_edit_post) +2. $(i18n blog.step_add_posts) +3. $(i18n blog.step_customize_theme) +4. $(i18n blog.step_publish_site) + +$(i18n blog.happy_blogging)" + + if [[ $? -ne 0 ]]; then + _msg error i18n error.create_sample_post_failed "${sample_post}" + return 1 + fi + + _msg success i18n success.sample_post_created "${sample_post}" + else + _msg debug i18n debug.sample_post_exists "${sample_post}" + fi + + return 0 +} + +function _generate_blog_index() { + # Usage: _generate_blog_index + # This function generates the blog index page + + local blog_index="${config[project_root]}/blog/index.${file_ext}" + + if [[ ! -f "${blog_index}" ]]; then + _msg info i18n info.creating_blog_index + _atomic_write "${blog_index}" "# ${config[site_name]:-Blog} + +${config[site_tagline]:+> ${config[site_tagline]}} + +## $(i18n blog.latest_posts) + +- [$(i18n blog.sample_post) 1](blog/post1.${file_ext}) +- [$(i18n blog.sample_post) 2](blog/post2.${file_ext}) + +## $(i18n blog.categories) + +- [$(i18n blog.sample_category) 1](blog/category1.${file_ext}) +- [$(i18n blog.sample_category) 2](blog/category2.${file_ext}) + +## $(i18n blog.archives) + +- [2023](blog/2023.${file_ext}) +- [2024](blog/2024.${file_ext}) + +## $(i18n blog.tags) + +- [tag1](blog/tag1.${file_ext}) +- [tag2](blog/tag2.${file_ext}) + +## $(i18n blog.about) + +$(i18n blog.about_text \"${blog_index}")" + + if [[ $? -ne 0 ]]; then + _msg error i18n error.create_blog_index_failed "${blog_index}" + return 1 + fi + + _msg success i18n success.blog_index_created "${blog_index}" + else + _msg debug i18n debug.blog_index_exists "${blog_index}" + fi + + return 0 +} + function _run_engine() { # Usage: _run_engine - local debug=false + # This function runs the appropriate engine on the input file - if [[ ${config[project_generator]} == "native" ]]; then - ${engine} ${1} + if [[ ${config[project_generator]} == "qstags" ]]; then + if [[ ! -x "$engine" ]]; then + _msg error i18n error.engine_not_found "$engine" + return 1 + fi + "$engine" "$1" elif [[ ${config[project_generator]} == "markdown" ]]; then - echo "${1} | ${engine} ${engine_opts}" + if ! command -v "$engine" &>/dev/null; then + _msg error i18n error.engine_not_found "$engine" + return 1 + fi + "$engine" -f markdown -t html "$1" else - _msg debug "ERROR running engine: ${engine}!" - _msg info "Usage: _run_engine " - exit + _msg error i18n error.unknown_generator "${config[project_generator]}" + return 1 fi } @@ -193,8 +705,6 @@ export blogdate=$(strftime "%a-%Y-%b-%d") # Let's create arrays of all the files we'll be working on -## -# @brief List all page files and store them in an array. function _list_pages() { if [[ ${globaldebug} == "true" ]]; then @@ -227,8 +737,6 @@ function _list_pages() { } -## -# @brief List all blog files and store them in an array. function _list_blogs() { if [[ ${globaldebug} == "true" ]]; then @@ -263,8 +771,71 @@ function _list_blogs() { } -## -# @brief Cache the state of blog files and identify changes. +# BLOG CACHE +blog_cache_file="${config[project_root]}/.blogindex.cache" + +function _update_blog_cache() { + # This function updates the blog cache with the current blog index content + if [[ ${globaldebug} == "true" ]]; then + local debug=true + else + local debug=false + fi + + if (${debug}) _msg debug "Updating blog cache at ${blog_cache_file}" + + # Get the current blog index content + local blog_index_content="$(<${config[project_root]}/blog/index.tmp.html)" + + # Store the content in the cache file + echo "${blog_index_content}" > "${blog_cache_file}" + + if (${debug}) _msg debug "Blog cache updated with ${#blog_index_content} bytes" +} + +function _load_blog_cache() { + # Loads the blog index from cache if it exists + if [[ -f "${blog_cache_file}" ]]; then + if (${debug}) _msg debug "Loading blog index from cache" + cat "${blog_cache_file}" + return 0 + fi + return 1 +} + +function _is_blog_cache_stale() { + # Returns 0 (success) if cache is stale or doesn't exist, 1 (failure) otherwise + if [[ ${globaldebug} == "true" ]]; then + local debug=true + else + local debug=false + fi + + # If we have new or updated blogs, cache is considered stale + if [[ ${new_updated_blogs} == "true" ]]; then + if (${debug}) _msg debug "Blog cache stale: New or updated blogs detected" + return 0 + fi + + # If cache file doesn't exist, it's stale + if [[ ! -f "${blog_cache_file}" ]]; then + if (${debug}) _msg debug "Blog cache stale: Cache file does not exist" + return 0 + fi + + # Check if cache is older than 1 hour (3600 seconds) + local cache_mtime=$(stat -c %Y "${blog_cache_file}" 2>/dev/null || echo 0) + local current_time=$(date +%s) + + if (( current_time - cache_mtime > 3600 )); then + if (${debug}) _msg debug "Blog cache stale: Cache is older than 1 hour" + return 0 + fi + + if (${debug}) _msg debug "Blog cache is fresh" + return 1 +} + function _blog_cache() { if [[ ${globaldebug} == "true" ]]; then @@ -276,7 +847,7 @@ function _blog_cache() { _list_blogs # Create an associative array for the blog cache - typeset -A blog_cache + typeset -gA config_cache # Load the existing blog cache if [[ -f $blog_cache_file ]]; then @@ -318,9 +889,8 @@ function _blog_cache() { } -## -# @brief Cache the state of page files and identify changes. -# @return Array of pages to be processed. +# PAGES CACHE +# Returns the array pages_array() function _pages_cache() { if [[ ${globaldebug} == "true" ]]; then @@ -330,7 +900,7 @@ function _pages_cache() { fi # Create an associative array for the pages cache - typeset -A pages_cache + typeset -gA config_cache _list_pages @@ -374,10 +944,6 @@ function _pages_cache() { } -## -# @brief Update #updated and #version tags in the provided content. -# @param content The content to be updated. -# @return The updated content. function _last_updated() { # This function updates #updated and #version tags in the provided string for buffers @@ -403,9 +969,6 @@ function _last_updated() { } -## -# @brief Update #updated and #version tags in the provided file. -# @param file_path The path to the file to be updated. function _f_last_updated() { # Updates #updated and #version tags in the provided file using Zsh @@ -437,10 +1000,6 @@ function _f_last_updated() { } -## -# @brief Convert the filename to lowercase and replace spaces with dashes. -# @param filename The original filename. -# @return The modified filename. function _file_to_lower() { local filename="${1}" @@ -456,8 +1015,6 @@ function _file_to_lower() { } -## -# @brief Generate all new and updated pages. function _pages() { # This function generates all the new and updated Pages @@ -548,29 +1105,33 @@ function _pages() { if (${debug}) _msg debug "${0:t}_msg_16" page_content=$( _image "${page_content}" ) fi - if [[ $( echo ${page_content} | grep \#ytvideo ) ]]; then + if [[ $( echo ${page_content} | grep \#linkimg ) ]]; then if (${debug}) _msg debug "${0:t}_msg_17" + page_content=$( _linkimg "${page_content}" ) + fi + if [[ $( echo ${page_content} | grep \#ytvideo ) ]]; then + if (${debug}) _msg debug "${0:t}_msg_18" page_content=$( _youtube "${page_content}" ) fi # Replace every #pagetitle in pages_tpl - if (${debug}) _msg debug "${0:t}_msg_18" + if (${debug}) _msg debug "${0:t}_msg_19" 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" + if (${debug}) _msg debug "${0:t}_msg_20" # 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 "${0:t}_msg_20" + if (${debug}) _msg debug "${0:t}_msg_21" pages_tpl=$( _last_updated ${pages_tpl} ) # Always use lowercase for file names - if (${debug}) _msg debug "${0:t}_msg_21" + if (${debug}) _msg debug "${0:t}_msg_22" pages_title_lower=$( _file_to_lower "${pages_in_array}" ) # Clean up unused tags, if any - if (${debug}) _msg debug "${0:t}_msg_22" + if (${debug}) _msg debug "${0:t}_msg_23" pages_tpl=$( _cleanup "${pages_tpl}" ) # Write pages_tpl to disk @@ -580,9 +1141,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}" && ${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}) _msg sub "${0:t}_msg_24" " ${pages_in_array}" + if (${debug}) _msg sub "${0:t}_msg_25" " ${config[site_blog]}" + if (${debug}) _msg sub "${0:t}_msg_26" if (${debug}) ls -l ${config[project_root]}/blog/index.tmp.html _add_blog_list_to_index fi @@ -595,23 +1156,21 @@ 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 [[ ${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" + _msg std "${0:t}_msg_27" + if (${debug}) _msg sub "${0:t}_msg_28" " ${pages_in_array}" + if (${debug}) _msg sub "${0:t}_msg_29" " ${config[site_blog]}" + if (${debug}) _msg sub "${0:t}_msg_30" if (${debug}) ls -l ${config[project_root]}/blog/index.tmp.html _add_blog_list_to_index fi - _msg sub "${0:t}_msg_29" + _msg sub "${0:t}_msg_31" export new_updated_pages=false fi } -## -# @brief Generate or update blog files or export metadata based on argument. function _blogs() { # This function either generates blog files or exports metadata based on the argument @@ -638,175 +1197,239 @@ function _blogs() { if (( ${#make_blog_array[@]} > 0 )); then - # Declare the array to hold metadata strings for each blog - BLOG_META_STR_ARRAY=() - - # Regular blog creation process - + # Declare arrays to hold blog content and metadata + typeset -ga BLOG_META_STR_ARRAY + typeset -A blog_contents + typeset -A blog_metadata + + # Array to store PIDs of background jobs + local pids=() + # Counter for active jobs + local active_jobs=0 + # Maximum number of parallel jobs (configurable, default to number of CPU cores) + local max_jobs=${config[parallel_jobs]:-$(nproc)} + + # Load template once before processing if [[ -f ${config[project_root]}/themes/${config[site_theme]}/blogs.tpl ]]; then local blog_tpl=$(<"${config[project_root]}/themes/${config[site_theme]}/blogs.tpl") else _msg info "${0:t}_msg_5" exit fi - - for blog in "${make_blog_array[@]}"; do - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg info "**************************FOR LOOP START*********************************" - if (${debug}) _msg info "*************************************************************************" - if (${debug}) _msg debug "${0:t}_msg_6" " ${blog}" - - local content="$(<"${blog}")" - local sdate btitle ingress body blog_index blog_dir blog_url + + # Create a FIFO for inter-process communication + local fifo=$(mktemp -u) + mkfifo "${fifo}" + + # Function to process a single blog file + _process_blog() { + local blog="$1" + local debug="$2" + local blog_tpl="$3" - # Initialize variables to track if DATE and BLOG_TITLE are found - local date_found=false - local title_found=false - - # Process content line by line - while IFS= read -r line - do - # Check for the DATE line - if [[ "${line}" == "DATE "* ]]; then - 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 "${0:t}_msg_8" - title_found=true - fi - # If both DATE and BLOG_TITLE are found, no need to continue checking - if [[ "${date_found}" == true && "${title_found}" == true ]]; then - break - fi - done <<< "${content}" - - # Check if DATE or BLOG_TITLE metadata is missing and log message - if [[ "${date_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_9" " ${blog}." - continue # Skip this file and move to the next - fi - if [[ "${title_found}" == false ]]; then - if (${debug}) _msg debug "${0:t}_msg_10" " ${blog}." - continue # Skip this file and move to the next - fi - - # Extract blog information - sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) ) - if [[ ${config[project_generator]} == "native" ]]; then - if (${debug}) _msg debug "* qstags: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == "BLOG_TITLE "* ]]; then - btitle="${line#BLOG_TITLE }" - break - fi - done <<< "$content" - elif [[ ${config[project_generator]} == "markdown" ]]; then - if (${debug}) _msg debug "* markdown: Fetching BLOG_TITLE" - while IFS= read -r line; do - if [[ "$line" == \#* ]]; then - btitle="${line#\#}" # Remove the first '#' character - btitle="${btitle#\#}" # Remove the second '#' character if present - btitle="${btitle#"${btitle%%[![:space:]]*}"}" # Trim leading whitespace - break # Exit the loop after finding the first heading - fi - done <<< "$content" - fi - if (${debug}) _msg debug "* Fetching INGRESS" - ingress=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | sed "s|\ \#INGRESS_STOP||" | sed "s|^\ ||" ) - if (${debug}) _msg debug "* Fetching BODY" - body=$( echo ${content} | sed "s/'/\\\'/g" | xargs | grep -Po "#BODY_START\K(.*?)#BODY_STOP" | sed "s|\ \#BODY_STOP||" | sed "s|^\ ||" ) - - blog_index=$(echo "${btitle:l}" | sed 's/ /_/g; s/,//g; s/\.//g; s/://g; s/[()]//g') - - blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" - blog_url="${blog_dir}/${blog_index}.html" - - 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 "${0:t}_msg_12" " ${blog}" - - _msg std " - ${btitle}" - - # Prepare the blog template - if (${debug}) _msg debug "${0:t}_msg_14" " ${blog}" - local blog_content=$( - echo "${blog_tpl}" | \ - perl -pe "\ - s|BLOGTITLE|${btitle}|g; \ - s|BLOGURL|${blog_url}|g; \ - s|\QINGRESS\E|${ingress}|g; \ - s|\QBODY\E|${body}|g \ - ") - blog_content="${blog_content//CALNDAY/${sdate[4]}}" - blog_content="${blog_content//CALYEAR/${sdate[2]}}" - blog_content="${blog_content//CALMONTH/${sdate[3]}}" - blog_content="${blog_content//CALADAY/${sdate[1]}}" - - if (${debug}) _msg debug "${0:t}_msg_15" " ${engine} " "${0:t}_msg_15_1" " ${blog}" - blog_content=$( _run_engine "${blog_content}" ) - # Look for links, images and videos and convert them if present. - if (${debug}) _msg debug "${0:t}_msg_16" - if [[ $( echo ${blog_content} | grep \#link ) ]]; then - 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 "${0:t}_msg_18" - blog_content=$(_image "${blog_content}") - fi - if [[ $( echo ${blog_content} | grep \#ytvideo ) ]]; then - if (${debug}) _msg debug "${0:t}_msg_19" - blog_content=$(_youtube "${blog_content}") - fi - - # Replace every #tagline in blog_content - if (${debug}) _msg debug "${0:t}_msg_20" - blog_content=$( echo ${blog_content} | perl -pe "s|#tagline|${config[site_tagline]}|gs; s|#sitename|${config[site_name]}|gs; s|#pagetitle|${page_title}|gs" ) + # Process in a subshell to avoid variable conflicts + ( + # Process blog in memory + local content="$(<"${blog}")" + local sdate btitle ingress body blog_index blog_dir blog_url + local date_found=false + local title_found=false - if (${debug}) _msg debug "* Running _last_updated" - blog_content=$(_last_updated "${blog_content}") - if (${debug}) _msg debug "* Running _cleanup" - blog_content=$(_cleanup "${blog_content}") - - # Create directory if it doesn't exist - if (${debug}) _msg debug "${0:t}_msg_21" " ${config[site_root]}${blog_dir}" - [[ ! -d "${config[site_root]}/${blog_dir}" ]] && mkdir -p "${config[site_root]}/${blog_dir}" - - # Write to file - if (${debug}) _msg debug "${0:t}_msg_22" " ${config[site_root]}${blog_url}" - echo "${blog_content}" > "${config[site_root]}${blog_url}" - - unset sdate btitle ingress body blog_index blog_dir blog_url - + # Process content line by line + while IFS= read -r line; do + [[ "${line}" == "DATE "* ]] && { date_found=true; sdate=(${line#DATE }); } + [[ "${line}" == "BLOG_TITLE "* ]] && { title_found=true; btitle="${line#BLOG_TITLE }"; } + [[ "${date_found}" == true && "${title_found}" == true ]] && break + done <<< "${content}" + + # Skip if required metadata is missing + [[ "${date_found}" != true || "${title_found}" != true ]] && return 1 + + # Extract blog content + ingress=$(echo "${content}" | sed "s/'/\\\'/g" | xargs | + grep -Po "#INGRESS_START\K(.*?)#INGRESS_STOP" | + sed "s|\ \#INGRESS_STOP||; s|^\ ||") + + body=$(echo "${content}" | sed "s/'/\\\'/g" | xargs | + grep -Po "#BODY_START\K(.*?)#BODY_STOP" | + sed "s|\ \#BODY_STOP||; s|^\ ||") + + # Process blog metadata + sdate=($(echo ${sdate} | sed 's|-| |g')) + blog_index=$(echo "${btitle:l}" | sed 's/ /_/g; s/[,.:()]//g') + blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" + blog_url="${blog_dir}/${blog_index}.html" + + # Generate blog content with template + local blog_content=$(echo "${blog_tpl}" | \ + perl -pe " + s|BLOGTITLE|${btitle}|g; + s|BLOGURL|${blog_url}|g; + s|\QINGRESS\E|${ingress}|g; + s|\QBODY\E|${body}|g") + + # Apply template variables + blog_content="${blog_content//CALNDAY/${sdate[4]}}" + blog_content="${blog_content//CALYEAR/${sdate[2]}}" + blog_content="${blog_content//CALMONTH/${sdate[3]}}" + blog_content="${blog_content//CALADAY/${sdate[1]}}" + + # Process content with engine and plugins + blog_content=$(_run_engine "${blog_content}") + [[ "${blog_content}" == *"#link"* ]] && blog_content=$(_link "${blog_content}") + [[ "${blog_content}" == *"#showimg"* ]] && blog_content=$(_image "${blog_content}") + [[ "${blog_content}" == *"#linkimg"* ]] && blog_content=$(_linkimg "${blog_content}") + [[ "${blog_content}" == *"#ytvideo"* ]] && blog_content=$(_youtube "${blog_content}") + + # Apply site-wide variables + blog_content=$(echo "${blog_content}" | \ + perl -pe "s|#tagline|${config[site_tagline]}|gs; + s|#sitename|${config[site_name]}|gs; + s|#pagetitle|${page_title}|gs") + + # Final processing + blog_content=$(_last_updated "${blog_content}") + blog_content=$(_cleanup "${blog_content}") + + # Output metadata and content through FIFO + echo "${blog}:" + echo " dir: ${blog_dir}" + echo " url: ${blog_url}" + echo " title: ${btitle}" + echo " content: |" + echo " ${blog_content//$'\n'/$'\n '}" + echo "---" + ) > "${fifo}.${blog//\//_}" & + + return $? + } + + # Start a background process to read from FIFO + local reader_pid + ( + while IFS= read -r line; do + if [[ $line == *":" ]]; then + current_blog="${line%:}" + elif [[ $line == " dir: "* ]]; then + blog_metadata["${current_blog}_dir"]="${line# dir: }" + elif [[ $line == " url: "* ]]; then + blog_metadata["${current_blog}_url"]="${line# url: }" + elif [[ $line == " title: "* ]]; then + blog_metadata["${current_blog}_title"]="${line# title: }" + elif [[ $line == " content: |" ]]; then + blog_content="" + while IFS= read -r content_line; do + [[ $content_line == " "* ]] || break + blog_content+="${content_line# }\n" + done + blog_contents["${current_blog}"]="${blog_content%\n}" + fi + done < <(cat "${fifo}".* 2>/dev/null) + ) & + reader_pid=$! + + # Export functions and variables needed in subshells + export -f _run_engine _link _image _linkimg _youtube _last_updated _cleanup + export config + + # Process blogs in parallel + for blog in "${make_blog_array[@]}"; do + # Wait for a slot if we've reached max jobs + while (( active_jobs >= max_jobs )); do + # Check for completed jobs + local new_pids=() + local completed=0 + for pid in "${pids[@]}"; do + if kill -0 "$pid" 2>/dev/null; then + new_pids+=("$pid") + else + ((completed++)) + fi + done + pids=("${new_pids[@]}") + ((active_jobs -= completed)) + + # If still at max, wait a bit + (( active_jobs >= max_jobs )) && sleep 0.1 + done + + # Start a new job + if (${debug}) _msg debug "Processing blog: ${blog}" + _process_blog "${blog}" "${debug}" "${blog_tpl}" & + pids+=($!) + ((active_jobs++)) done + + # Wait for all background jobs to complete + wait "${pids[@]}" 2>/dev/null + + # Signal the reader to finish + wait $reader_pid 2>/dev/null + + # Write all blogs to disk in a single pass + for blog in "${!blog_contents[@]}"; do + local dir="${blog_metadata[${blog}_dir]}" + local url="${blog_metadata[${blog}_url]}" + local title="${blog_metadata[${blog}_title]}" + local content="${blog_contents[$blog]}" + + # Skip if required fields are missing + if [[ -z "$dir" || -z "$url" || -z "$content" ]]; then + _msg warning "Skipping blog post due to missing metadata: ${blog}" + continue + fi + + # Construct the full output path safely + local output_path + output_path=$(_safe_path "${config[site_root]}" "${url#/}") || { + _msg error "Invalid output path for blog: $url" + continue + } + + # Create output directory if it doesn't exist + local output_dir + output_dir=$(dirname -- "$output_path") + if ! mkdir -p -- "$output_dir"; then + _msg error "Failed to create directory: $output_dir" + continue + fi + + # Write the blog content safely + if ! _safe_write "$content" "$output_path"; then + _msg error "Failed to write blog post: $output_path" + continue + fi + + # Add to metadata array for index generation + BLOG_META_STR_ARRAY+=("SDATA:${dir}||BTITLE:${title}||INGRESS:${content}||URL:${url}") + + if (${debug}); then + _msg debug "Successfully wrote blog post: $output_path" + fi + done + + # Clean up FIFO files + rm -f "${fifo}" "${fifo}".* 2>/dev/null + # Process each blog in parallel # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post export BLOG_META_STR_ARRAY - if (${debug}) _msg debug "${0:t}_msg_23" + if (${debug}) _msg debug "${0:t}_msg_24" export new_updated_blogs=true else - _msg sub "${0:t}_msg_24" + _msg sub "${0:t}_msg_25" export new_updated_blogs=false fi if [[ ${new_updated_blogs} == "true" ]]; then - if (${debug}) _msg sub "${0:t}_msg_25" - _blog_idx_for_index if (${debug}) _msg sub "${0:t}_msg_26" + _blog_idx_for_index + if (${debug}) _msg sub "${0:t}_msg_27" _blog_index fi } -## -# @brief Generate the file blog/index.tmp.html. function _blog_idx_for_index() { # This function generates the file blog/index.tmp.html @@ -881,51 +1504,65 @@ function _blog_idx_for_index() { if (${debug}) _msg debug "${0:t}_msg_8" " ${config[project_root]}/blog/index.tmp.html" #if (${debug}) _msg debug "${0:t}_msg_9" " ${blog_list_content}" echo ${blog_list_content} > ${config[project_root]}/blog/index.tmp.html + _update_blog_cache } -## -# @brief Generate the www_root/blog/index.html file. function _blog_index() { - if [[ ${globaldebug} == "true" ]]; then local debug=true else local debug=false fi - # This function generates the www_root/blog/index.html file that gets its data from _blog_list_for_index() - # ${new_updated_blogs} comes from the function _blogs if anything new or updated is detected - if ([[ ${config[site_blog]} == "false" ]] && [[ ${new_updated_blogs} = "true" ]]); then - - if (${debug}) _msg debug "${0:t}_msg_1" "${config[site_blog]}" - 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" " ${config[site_blog]}" - - _msg std "${0:t}_msg_5" " ${config[site_root]}/blog/index.html" - + # Check if we need to update the blog index + if [[ ${new_updated_blogs} == "true" ]] || _is_blog_cache_stale; then + if (${debug}) _msg debug "Generating new blog index" + + # Get the template local blog_index_tpl=$(<${config[project_root]}/themes/${config[site_theme]}/blog_index.tpl) - local blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) - - if (${debug}) _msg debug "${0:t}_msg_6" - local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${config[site_name]}|gs; s|#tagline|${config[site_tagline]}|gs") - if (${debug}) _msg debug "${0:t}_msg_7" " ${config[project_root]}/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 "${0:t}_msg_8" " ${config[site_root]}/blog/index.html" - _msg debug "${0:t}_msg_9" " ${#blog_index_content}" + + # Get the blog list content + local blog_index_list + if [[ ${new_updated_blogs} == "true" ]]; then + # If we have new/updated blogs, use the fresh content + blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) + else + # Otherwise try to load from cache + blog_index_list=$(_load_blog_cache) || { + # If cache load fails, use the fresh content + blog_index_list=$(<${config[project_root]}/blog/index.tmp.html) + } fi - echo "$blog_index_content" > ${config[site_root]}/blog/index.html - _f_last_updated ${config[site_root]}/blog/index.html - + + # Generate the final content + local blog_index_content=$(echo "${blog_index_tpl}" | \ + perl -pe "s|#sitename|${config[site_name]}|gs; s|#tagline|${config[site_tagline]}|gs") + blog_index_content=$(awk -v new_body="$blog_index_list" '{sub(/BODY/, new_body)} 1' <(echo "${blog_index_content}")) + + # Create output directory if it doesn't exist + mkdir -p "${config[site_root]}/blog" + + # Write the index file + echo "$blog_index_content" > "${config[site_root]}/blog/index.html" + _f_last_updated "${config[site_root]}/blog/index.html" + + # Update the cache with the new content + _update_blog_cache + + if (${debug}); then + _msg debug "Generated new blog index at ${config[site_root]}/blog/index.html" + _msg debug "Blog index size: ${#blog_index_content} bytes" + fi + else + # Use cached content + if (${debug}) _msg debug "Using cached blog index" + local cached_content=$(_load_blog_cache) + mkdir -p "${config[site_root]}/blog" + echo "$cached_content" > "${config[site_root]}/blog/index.html" fi - } -## -# @brief Add the blog list to the index file if blog_in_index is true. function _add_blog_list_to_index() { if [[ ${globaldebug} == "true" ]]; then @@ -942,8 +1579,6 @@ function _add_blog_list_to_index() { } -## -# @brief Generate the sitemap files if conditions are met. function _sitemap() { if [[ ${globaldebug} == "true" ]]; then @@ -952,8 +1587,12 @@ function _sitemap() { local debug=false fi - # Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file. - if ([[ ${config[site_sitemap]} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] )) || [[ ${sitemap_force} == "true" ]]; then + # Check if sitemap is set to true and if there are updated Blogs, Pages, or if cache is stale + if ([[ ${config[site_sitemap]} == "true" ]] && + ([[ ${new_updated_blogs} == "true" ]] || + [[ ${new_updated_pages} == "true" ]] || + _is_blog_cache_stale)) || + [[ ${sitemap_force} == "true" ]]; then setopt extendedglob @@ -1036,6 +1675,9 @@ function _sitemap() { # End of the XML file echo '' >> "${sitemap_page}" _msg std " - ${p_file}" + + # Update the blog cache after generating sitemap + _update_blog_cache if (${debug}); then _msg debug "${0:t}_msg_2" " ${sitemap_file}"; fi @@ -1067,10 +1709,6 @@ function _sitemap() { } -## -# @brief Convert #link tags to clickable HTML links. -# @param content The content containing #link tags. -# @return The content with #link tags replaced by HTML links. function _link() { # This converts #link tags to actual clickable links in a provided string @@ -1113,10 +1751,6 @@ function _link() { } -## -# @brief Convert #showimg tags to HTML img tags. -# @param content The content containing #showimg tags. -# @return The content with #showimg tags replaced by HTML img tags. function _image() { # This replaces #showimg tags with actual HTML img tags in a provided string @@ -1161,10 +1795,49 @@ function _image() { } -## -# @brief Embed a YouTube video in the provided content. -# @param content The content containing #ytvideo tags. -# @return The content with #ytvideo tags replaced by YouTube iframe embeds. +function _linkimg() { + # This function replaces #linkimg tags with tags around tags + + if [[ ${globaldebug} == "true" ]]; then + local debug=true + else + local debug=false + fi + + local content="${1}" + local modified_content="" + + # Process the content line by line + echo "${content}" | while IFS= read -r line; do + if [[ ${line} == *"#linkimg"* ]]; then + if (${debug}) _msg debug "${0:t}_msg_1" " ${line}" + + # Extract link, image, and alt text + local img_link=$(echo "${line}" | awk -F'#linkimg ' '{print $2}') + local img_url=$(echo "${img_link}" | awk -F'¤' '{print $1}') + local img_alt=$(echo "${img_link}" | awk -F'¤' '{print $2}') + + # Determine the source of the image + local real_image="" + if [[ ${img_url} =~ ^https?:// ]]; then + real_image=${img_url} + elif [[ ${img_url} =~ ^\/ ]]; then + real_image=${img_url} + else + real_image="/images/${img_url}" + fi + + # Form the replacement HTML link and image tag + local img_tag="\"${img_alt}\"" + line=${line//"#linkimg ${img_link}"/${img_tag}} + fi + modified_content+="${line}\n" + done + + # Return the modified content + echo -e "${modified_content}" +} + function _youtube() { # This embeds a YouTube video in a provided string @@ -1197,10 +1870,6 @@ function _youtube() { } -## -# @brief Remove leftover tags from the content. -# @param content The content to be cleaned. -# @return The cleaned content. function _cleanup() { # This removes tags used in the templates that may be left over for some reason @@ -1221,6 +1890,7 @@ function _cleanup() { -e "s|#showimg\ ||g" \ -e "s|#ytvideo\ ||g" \ -e "s|#link\ ||g" \ + -e "s|#linkimg\ ||g" \ ) # Return the cleaned content @@ -1228,10 +1898,6 @@ function _cleanup() { } -## -# @brief Convert QStags to HTML using Perl. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. function _p_qstags() { if [[ ${globaldebug} == "true" ]]; then @@ -1294,12 +1960,228 @@ function _p_qstags() { } -## -# @brief Convert QStags to HTML using Zsh regex module. -# @param content The content containing QStags. -# @return The content with QStags converted to HTML. -function _qstags() { +############################################################################### +# MARKUP CONVERSION FUNCTIONS +# These functions handle conversion between QSTags and Markdown formats +############################################################################### + +# _convert_markup - Main function for converting between QSTags and Markdown +# +# This function provides a unified interface for converting between QSTags (used internally +# by qsgen2) and Markdown (a more standard markup format). It supports both single file +# and batch processing modes. +# +# Usage: +# _convert_markup [--to-markdown|--to-qstags] [--all] [input_file] [output_file] +# +# Options: +# --to-markdown Convert from QSTags to Markdown format +# --to-qstags Convert from Markdown to QSTags format +# --all Process all .qst and .blog files in the project +# +# If no files are provided, reads from stdin and writes to stdout. +# If no mode is specified, auto-detects based on file extension or content. +# +# Examples: +# # Convert a single file +# _convert_markup --to-markdown page.qst page.md +# +# # Convert all files in batch mode +# _convert_markup --to-markdown --all + local mode="" + local process_all=false + local input_file="-" # Default to stdin + local output_file="-" # Default to stdout + # Parse arguments + while [[ $# -gt 0 ]]; do + case "$1" in + --to-markdown) + mode="to_markdown" + shift + ;; + --to-qstags) + mode="to_qstags" + shift + ;; + --all) + process_all=true + shift + ;; + *) + if [[ -z "$input_file" || "$input_file" == "-" ]]; then + input_file="$1" + else + output_file="$1" + fi + shift + ;; + esac + done + + # If --all is specified, process all .qst and .blog files + if [[ "$process_all" == true ]]; then + if [[ -z "$mode" ]]; then + _msg error "Please specify --to-markdown or --to-qstags with --all" + return 1 + fi + + local target_ext="md" # Always use .md for markdown output + if [[ "$mode" == "to_qstags" ]]; then + # For QSTags output, we need to know if it's a page or blog post + # This will be handled in the file processing loops + : + fi + + # Process pages (.qst files) + local page_count=0 + local blog_count=0 + + # Process pages + for page in "${config[project_root]}"/*.qst; do + [[ -f "$page" ]] || continue + local output_file + if [[ "$mode" == "to_markdown" ]]; then + output_file="${page%.qst}.md" + else + output_file="${page%.qst}.qst" # Keep original extension + fi + _msg info "Converting ${page##*/} to ${output_file##*/}" + _convert_single_file "$page" "$output_file" "$mode" + ((page_count++)) + done + + # Process blog posts + if [[ -d "${config[project_root]}/blog" ]]; then + for blog in "${config[project_root]}/blog/"*.blog; do + [[ -f "$blog" ]] || continue + local output_file + if [[ "$mode" == "to_markdown" ]]; then + output_file="${blog%.blog}.md" + else + output_file="${blog%.blog}.blog" # Keep original extension + fi + _msg info "Converting ${blog##*/} to ${output_file##*/}" + _convert_single_file "$blog" "$output_file" "$mode" + ((blog_count++)) + done + fi + + _msg success "Converted $page_count pages and $blog_count blog posts" + return 0 + fi + + # If no mode specified, try to auto-detect + if [[ -z "$mode" ]]; then + if [[ "$input_file" != "-" ]] && [[ "$input_file" == *.md || "$input_file" == *.markdown ]]; then + mode="to_qstags" + else + mode="to_markdown" + fi + fi + + # Process a single file + _convert_single_file "$input_file" "$output_file" "$mode" +} + +function _convert_single_file() { + local input_file="$1" + local output_file="$2" + local mode="$3" + + # Read input + local content + if [[ "$input_file" == "-" ]]; then + content=$(cat -) + else + [[ -f "$input_file" ]] || { _msg error "Input file not found: $input_file"; return 1; } + content=$(<"$input_file") + fi + + # Conversion logic + # + # The conversion uses sed with extended regular expressions to perform pattern + # matching and substitution. Each pattern handles a specific QSTag or Markdown + # construct, converting it to the target format. + # + # Note: The order of replacements is significant as some patterns may be + # prefixes of others. + case "$mode" in + to_markdown) + # Convert QSTags to Markdown + # + # Pattern explanations: + # s/#BR/\n/g - Line breaks + # s/#BD(.*?)#EBD/**\1**/g - Bold text + # s/#I(.*?)#EI/*\1*/g - Italic text + # s/#P\s*/\n\n/g; s/#EP//g - Paragraphs + # s/#Q\s*/> /g; s/#EQ//g - Blockquotes + # s/#C(.*?)#EC/`\1`/g - Inline code + # s/#H1\s*/# /g; s/#EH1//g - Headers (H1-H6) + # ... and so on for other QSTags + content=$(echo "$content" | sed -E '\ + s/#BR/\n/g;\ + s/#BD(.*?)#EBD/**\1**/g;\ + s/#I(.*?)#EI/*\1*/g;\ + s/#P\s*/\n\n/g; s/#EP//g;\ + s/#Q\s*/> /g; s/#EQ//g;\ + s/#C(.*?)#EC/`\1`/g;\ + s/#H1\s*/# /g; s/#EH1//g;\ + s/#H2\s*/## /g; s/#EH2//g;\ + s/#H3\s*/### /g; s/#EH3//g;\ + s/#H4\s*/#### /g; s/#EH4//g;\ + s/#H5\s*/##### /g; s/#EH5//g;\ + s/#H6\s*/###### /g; s/#EH6//g;\ + s/#STRONG(.*?)#ESTRONG/**\1**/g;\ + s/#EM(.*?)#SEM/*\1*/g;\ + s/#UL\s*/\n/g; s/#EUL//g;\ + s/#OL\s*/\n/g; s/#EOL//g;\ + s/#LI\s*/- /g; s/#ELI//g;\ + s/#TBL\s*/\n/g; s/#ETBL//g;\ + s/#TR//g; s/#ETR//g;\ + s/#TD/| /g; s/#ETD/ |/g;\ + s/#TH/| **/g; s/#ETH/** |/g;\ + s/#LT//g; s/#NUM/#/g\ + ') + ;; + + to_qstags) + # Convert Markdown to QSTags + # + # This is the inverse of the to_markdown conversion, translating + # Markdown syntax back to QSTags. The patterns are designed to handle + # the most common Markdown constructs while being reasonably robust + # against variations in whitespace and formatting. + # + # Note: Some Markdown features may not have direct QSTag equivalents + # and will be preserved as plain text. + content=$(echo "$content" | sed -E '\ + s/\*\*(.*?)\*\*/#BD\1#EBD/g;\ + s/\*(.*?)\*/#I\1#EI/g;\ + s/^# (.*)$/#H1 \1#EH1/g;\ + s/^## (.*)$/#H2 \1#EH2/g;\ + s/^### (.*)$/#H3 \1#EH3/g;\ + s/^#### (.*)$/#H4 \1#EH4/g;\ + s/^##### (.*)$/#H5 \1#EH5/g;\ + s/^###### (.*)$/#H6 \1#EH6/g;\ + s/^> (.*)$/#Q \1#EQ/g;\ + s/`([^`]+)`/#C\1#EC/g;\ + s/^\s*[-*+]\s+(.*)$/#LI \1#ELI/g;\ + s/\n\s*\n/#P\n/g;\ + s//#GT/g\ + ') + ;; + esac + + # Write output + if [[ "$output_file" == "-" ]]; then + echo "$content" + else + echo "$content" > "$output_file" + fi +} + +function _qstags() { # This function uses the regex module from Zsh to parse the QStags if [[ ${globaldebug} == "true" ]]; then @@ -1337,7 +2219,7 @@ function _qstags() { "#SPN" "" "#ESPN" "\n" "#UL" "
      " "#EUL" "
    \n" "#OL" "
      " "#EOL" "
    \n" - "#LI" "
  • " "#ELI" "
  • \n" + "#LI" "
  • " "#ELI" "
  • \n" "#UD" "" "#EUD" "\n" "#TBL" "" "#ETBL" "
    \n" "#TR" "" "#ETR" "\n" diff --git a/config.example b/site.conf.example similarity index 100% rename from config.example rename to site.conf.example