Changing the folder for drafts : drafts is for true drafts, and bases contains the markdown make ups in their final version
This commit is contained in:
parent
62c7e0b1cb
commit
5028924a84
46
bob
46
bob
@ -4,7 +4,6 @@ _get_blog_name()
|
|||||||
{
|
{
|
||||||
# Extract the configuration file
|
# Extract the configuration file
|
||||||
conf=`cat .blog.conf`
|
conf=`cat .blog.conf`
|
||||||
#echo $conf
|
|
||||||
name_regex="blog\:([a-zA-Z ]+)"
|
name_regex="blog\:([a-zA-Z ]+)"
|
||||||
|
|
||||||
# Echo the name of the blog, if any was given
|
# Echo the name of the blog, if any was given
|
||||||
@ -15,6 +14,7 @@ _get_blog_name()
|
|||||||
|
|
||||||
_get_dark_param()
|
_get_dark_param()
|
||||||
{
|
{
|
||||||
|
# Extract the configuration file
|
||||||
conf=`cat .blog.conf`
|
conf=`cat .blog.conf`
|
||||||
dark_regex="dark:(y|n|N)"
|
dark_regex="dark:(y|n|N)"
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ _get_dark_param()
|
|||||||
|
|
||||||
_get_blog_lang()
|
_get_blog_lang()
|
||||||
{
|
{
|
||||||
|
# Extract the configuration file
|
||||||
conf=`cat .blog.conf`
|
conf=`cat .blog.conf`
|
||||||
lang_regex="lang:([a-z]+)"
|
lang_regex="lang:([a-z]+)"
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ publish()
|
|||||||
|
|
||||||
# list all the drafts stored as most recently modified to
|
# list all the drafts stored as most recently modified to
|
||||||
# least recently modified, as it should appear on a blog
|
# least recently modified, as it should appear on a blog
|
||||||
drafts=`ls -t ./drafts/`
|
drafts=`ls -t ./bases/`
|
||||||
# echo $drafts
|
# echo $drafts
|
||||||
|
|
||||||
# Tranform the string into an array
|
# Tranform the string into an array
|
||||||
@ -118,7 +119,7 @@ publish()
|
|||||||
# Append the names to the array
|
# Append the names to the array
|
||||||
posts_names+=(${BASH_REMATCH[1]})
|
posts_names+=(${BASH_REMATCH[1]})
|
||||||
fi
|
fi
|
||||||
_create_posts "./drafts/${list[i]}" "$blog_name" "$lang" "$dark"
|
_create_posts "./bases/${list[i]}" "$blog_name" "$lang" "$dark"
|
||||||
done
|
done
|
||||||
|
|
||||||
# function to update the index.html
|
# function to update the index.html
|
||||||
@ -211,7 +212,7 @@ post_regex="([a-zA-Z\-]+)\.(md|markdown)"
|
|||||||
for (( i=0; i<${#drafts_list[@]}; i++ ));
|
for (( i=0; i<${#drafts_list[@]}; i++ ));
|
||||||
do
|
do
|
||||||
# Retrieve the date of the last modification of the draft
|
# Retrieve the date of the last modification of the draft
|
||||||
date=$(_get_last_modif_date "./drafts/${drafts_list[i]}")
|
date=$(_get_last_modif_date "./bases/${drafts_list[i]}")
|
||||||
|
|
||||||
# In case the next regex doesn't work, even though it's supposed to
|
# In case the next regex doesn't work, even though it's supposed to
|
||||||
# work everytime
|
# work everytime
|
||||||
@ -269,14 +270,15 @@ init()
|
|||||||
echo "Activate dark mode : (y/N)"
|
echo "Activate dark mode : (y/N)"
|
||||||
read dark
|
read dark
|
||||||
if [ -z $lang ]; then
|
if [ -z $lang ]; then
|
||||||
dark=N
|
dark=n
|
||||||
fi
|
fi
|
||||||
echo "dark:$dark" >> .blog.conf
|
echo "dark:$dark" >> .blog.conf
|
||||||
mkdir drafts
|
mkdir drafts
|
||||||
|
mkdir bases
|
||||||
mkdir posts
|
mkdir posts
|
||||||
mkdir css
|
mkdir css
|
||||||
_init_css
|
_init_css
|
||||||
_index "$blog" "$lang"
|
_index "$blog" "$lang" "$dark"
|
||||||
}
|
}
|
||||||
|
|
||||||
_init_css()
|
_init_css()
|
||||||
@ -433,6 +435,13 @@ _index()
|
|||||||
{
|
{
|
||||||
title=$1
|
title=$1
|
||||||
lang=$2
|
lang=$2
|
||||||
|
dark=$3
|
||||||
|
css="./css/indexstyle.css"
|
||||||
|
|
||||||
|
if [ $3 -eq "y" ]; then
|
||||||
|
css="./css/indexstyle.dark.css"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the first index file, empty of any posts
|
# Create the first index file, empty of any posts
|
||||||
cat > index.html << EOF
|
cat > index.html << EOF
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -495,31 +504,6 @@ usage()
|
|||||||
echo " publish publish the blog"
|
echo " publish publish the blog"
|
||||||
}
|
}
|
||||||
|
|
||||||
# while getopts ":ihpdm" opt; do
|
|
||||||
# case ${opt} in
|
|
||||||
# i )
|
|
||||||
# init
|
|
||||||
# ;;
|
|
||||||
# p )
|
|
||||||
# publish
|
|
||||||
# ;;
|
|
||||||
# h )
|
|
||||||
# usage
|
|
||||||
# ;;
|
|
||||||
# m )
|
|
||||||
# change_mode
|
|
||||||
# ;;
|
|
||||||
# d )
|
|
||||||
# delete_posts
|
|
||||||
# ;;
|
|
||||||
# \? )
|
|
||||||
# usage
|
|
||||||
# ;;
|
|
||||||
# : )
|
|
||||||
# usage
|
|
||||||
# ;;
|
|
||||||
# esac
|
|
||||||
# done
|
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
usage
|
usage
|
||||||
|
Loading…
Reference in New Issue
Block a user