blog-utils/gen-article-pelican.sh
2024-02-05 19:47:11 +01:00

49 lines
1.1 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#**************************#
# gen-article-pelican.sh #
# #
# author: rick@gnous.eu #
# licence: Apache-2.0 #
#**************************#
FILE="nouveau-billet.md"
AUTHOR="Moi"
STATUS="draft"
LANGUE="fr"
filemd=${1:-$FILE}
read -p "Titre de larticle : " titre
read -p "Date de larticle (vide pour aujourdhui) : " date
read -p "Catégorie : " categorie
read -p "Tags (les séparer par une ,) : " tags
read -p "URL : " url
read -p "Auteurs (séparez les différents auteurs par une ,) : " auteurs
read -p "Status (draft par défaut) : " statuspost
read -p "Langue (fr par défaut) : " langue
read -p "Sommaire : " sommaire
date=${date:-$(date +%Y-%m-%d)}
statuspost=${statuspost:-$STATUS}
langue=${langue:-$LANGUE}
auteurs=${auteurs:-$AUTHOR}
[[ $auteurs == *","* ]] && auteurs="Authors: $auteurs" || auteurs="Author: $auteurs"
echo "Title: $titre
Date: $date
Category: $categorie
Tags: $tags
Slug: $url
$auteurs
Lang: $langue
Status: $statuspost" > $filemd
if [ ! -z "$sommaire" ]
then
echo "Summary: $sommaire" >> $filemd
fi
echo -e "\n" >> $filemd