2015-06-07 22:49:44 +00:00
|
|
|
#!/bin/sh
|
2021-10-20 00:48:26 -04:00
|
|
|
|
2021-11-02 19:39:00 -04:00
|
|
|
# this script creates a new news entry
|
|
|
|
# it's a little smarter than it used to be to account for per-platform, per-branch updates
|
|
|
|
# You can still run it with just ./create_new_entry.sh but it will fill in some
|
|
|
|
# of the necessary fields for you and. You can also now pass it environment variables TITLE,
|
|
|
|
# HREF, and AUTHOR to set the title, href, and author of the entry.
|
|
|
|
#
|
|
|
|
# Example usage:
|
|
|
|
# TITLE="Update for Windows Jpackage 1.5.1" AUTHOR=idk EDITOR=mousepad I2P_OS=win I2P_BRANCH=beta ./create_new_entry.sh
|
|
|
|
|
|
|
|
ENTRIES=data/$I2P_OS/$I2P_BRANCH/entries.html
|
2016-11-28 11:21:55 +00:00
|
|
|
UUIDGEN="`which uuidgen || which uuid`"
|
2021-11-02 19:39:00 -04:00
|
|
|
DATE=$(date +%Y-%m-%dT%H:00:00Z)
|
|
|
|
if [ -z "$HREF" ]; then
|
|
|
|
HREF="http://i2p-projekt.i2p/en/blog/post/"$(date +%Y)/$(date +%m)/$(date +%d)"/CHANGEME_URL_HERE"
|
|
|
|
fi
|
2022-05-20 09:54:50 -04:00
|
|
|
TITLE=${TITLE:-TITLE_HERE}
|
|
|
|
AUTHOR=${AUTHOR:-AUTHOR_HERE}
|
2015-06-07 23:02:19 +00:00
|
|
|
|
2022-05-20 09:54:50 -04:00
|
|
|
sed -i "3i <article\n id=\"urn:uuid:`$UUIDGEN`\"\n title=\"$TITLE\"\n href=\"$HREF\"\n author=\"$AUTHOR\"\n published=\"$DATE\"\n updated=\"$DATE\">\n<details>\n<summary>SUMMARY_HERE</summary>\n</details>\n<p>\n\n</p>\n</article>\n\n\n" $ENTRIES
|
2015-06-07 23:02:19 +00:00
|
|
|
|
|
|
|
if [ ! -z "$EDITOR" ]; then
|
|
|
|
case "$EDITOR" in
|
|
|
|
"nano" | "vim")
|
2015-06-10 12:48:20 +00:00
|
|
|
$EDITOR +13 $ENTRIES
|
2015-06-07 23:02:19 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
$EDITOR $ENTRIES
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2021-11-02 19:39:00 -04:00
|
|
|
|