#!/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