Compare commits
2 commits
422ca7dfc3
...
a999748d8c
Author | SHA1 | Date | |
---|---|---|---|
Evilham | a999748d8c | ||
Evilham | 8169207a08 |
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: "eXOfàsia #1"
|
||||
title: "eXOfàsia ~#"
|
||||
author: {{author}}
|
||||
date: {{today}}
|
||||
tags: [{{projects}}]
|
||||
|
|
39
new_post.sh
Normal file → Executable file
39
new_post.sh
Normal file → Executable file
|
@ -1,30 +1,43 @@
|
|||
#!/bin/sh
|
||||
#!/bin/sh -eu
|
||||
|
||||
path_to_rendered_md="${1:-rendered.md}"
|
||||
if [ -z "${path_to_rendered_md}" ] || [ ! -f "${path_to_rendered_md}" ]; then
|
||||
cat >> /dev/stderr <<-EOM
|
||||
Please call as ./new_post.sh rendered.md
|
||||
EOM
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the number for the new issue
|
||||
var=$(find content/posts/ -maxdepth 3 -mindepth 3 | tail -n 1)
|
||||
current=${var#*-}
|
||||
number=$(($current+1))
|
||||
publications="$(find posts/ -maxdepth 1 -mindepth 1 -type d)"
|
||||
last_date="$(echo "${publications}" | tail -n 1 | cut -d '/' -f 2)"
|
||||
today="$(date +"%Y-%m-%d")"
|
||||
current_number="$(echo "${publications}" | grep -v "${today}" | wc -l)"
|
||||
next_number="$(($current_number+1))"
|
||||
|
||||
printf "\nGenerate TWIG #$number ..."
|
||||
printf "\nGenerate eXOfàsia ~${next_number} ..."
|
||||
|
||||
# Build path of the post
|
||||
echo "${today}"
|
||||
|
||||
year=$(date +"%Y")
|
||||
month=$(date +"%m")
|
||||
post=twig-$number
|
||||
path="./content/posts/$year/$month/$post"
|
||||
path="./posts/${today}"
|
||||
|
||||
printf "\n\nCreate directory: $path"
|
||||
mkdir -p $path
|
||||
|
||||
markdown=$path/index.md
|
||||
printf "\nCreate index.md: $markdown"
|
||||
touch $markdown
|
||||
markdown=$path/rendered.md
|
||||
printf "\nPlacing and patching rendered.md: $markdown"
|
||||
sed -E \
|
||||
-e "s/^title:[[:space:]]+\".*\"$/title: \"eXOfàsia ~${next_number}\"/" \
|
||||
-e "s/\{\{timestamp\}\}.<!--more-->/${last_date}/" \
|
||||
"${path_to_rendered_md}" > "${markdown}"
|
||||
|
||||
printf "\n\nEnter issue directory..."
|
||||
cd $path
|
||||
|
||||
printf "\n\nPaste the Hebbot curl command here to download all media files, and close the shell again with 'exit'."
|
||||
printf "\nYou can preview the issue by running 'hugo server -D'.\n\n"
|
||||
printf "\n\nPaste the Hebbot curl command here to download all media files, and close the shell again with 'exit'.\n"
|
||||
|
||||
# Enter new shell inside the issue directory
|
||||
exec bash
|
||||
exec env PS1="HEBBOT ${today} (eXOfàsia ~${next_number})$ " "${SHELL}"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: "eXOfàsia #1"
|
||||
title: "eXOfàsia ~2"
|
||||
author: evilham
|
||||
date: 2024-03-13
|
||||
tags: ["digicòria - Descentralització de la web", "Komunikilo", "XOB", "eXO-servers"]
|
||||
|
|
Loading…
Reference in a new issue