New function: _list_pages. Prepared to use Markdown as Pages.
This commit is contained in:
parent
cfec40e5bb
commit
2e74d5f5d6
27
qsgen2
27
qsgen2
@ -145,6 +145,7 @@ fi
|
|||||||
if [[ ${generator} == "native" ]]; then
|
if [[ ${generator} == "native" ]]; then
|
||||||
# Usage: ${engine} ${1} - Where 1 is the file you want to convert
|
# Usage: ${engine} ${1} - Where 1 is the file you want to convert
|
||||||
engine=_html
|
engine=_html
|
||||||
|
file_ext=tpl
|
||||||
elif [[ ${generator} == "markdown" ]]; then
|
elif [[ ${generator} == "markdown" ]]; then
|
||||||
if [[ ! -f /usr/bin/markdown ]]; then
|
if [[ ! -f /usr/bin/markdown ]]; then
|
||||||
_msg other "Please install the 'discount' package to use Markdown."
|
_msg other "Please install the 'discount' package to use Markdown."
|
||||||
@ -152,6 +153,7 @@ elif [[ ${generator} == "markdown" ]]; then
|
|||||||
else
|
else
|
||||||
# Usage: ${engine} ${1} - Where 1 is the file you want parsed
|
# Usage: ${engine} ${1} - Where 1 is the file you want parsed
|
||||||
engine=$( /usr/bin/markdown ${1} -d )
|
engine=$( /usr/bin/markdown ${1} -d )
|
||||||
|
file_ext=md
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (${debug}) _msg debug "Using the ${generator} engine"
|
if (${debug}) _msg debug "Using the ${generator} engine"
|
||||||
@ -168,6 +170,27 @@ export blogdate=$( date +%a-%Y-%b-%d )
|
|||||||
|
|
||||||
# Let's create arrays of all the files we'll be working on
|
# Let's create arrays of all the files we'll be working on
|
||||||
|
|
||||||
|
function _list_pages() {
|
||||||
|
local debug=false
|
||||||
|
|
||||||
|
export no_pages_found=false
|
||||||
|
|
||||||
|
# Temporarily set null_glob for this function
|
||||||
|
setopt local_options null_glob
|
||||||
|
|
||||||
|
# Check if there are any .blog files in the blog directory
|
||||||
|
local pages_files=(*.${file_ext})
|
||||||
|
if (( ${#pages_files} == 0 )); then
|
||||||
|
if (${debug}); then _msg debug "_list_pages: No Pages found."; fi
|
||||||
|
export no_pages_found=true
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in $( ls *.${file_ext} ); do
|
||||||
|
pages_file_array+=("$file")
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function _list_blogs() {
|
function _list_blogs() {
|
||||||
local debug=false
|
local debug=false
|
||||||
|
|
||||||
@ -255,8 +278,10 @@ function _pages_cache() {
|
|||||||
# Initialize the array for storing pages files to process
|
# Initialize the array for storing pages files to process
|
||||||
pages_array=()
|
pages_array=()
|
||||||
|
|
||||||
|
_list_pages
|
||||||
|
|
||||||
# Process pages files
|
# Process pages files
|
||||||
for file in $(ls -1bt *tpl); do
|
for file in ${pages_file_array[@]}; do
|
||||||
# Compute the current blog file hash
|
# Compute the current blog file hash
|
||||||
current_hash=$(md5sum "$file" | awk '{print $1}')
|
current_hash=$(md5sum "$file" | awk '{print $1}')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user