improve commenting

This commit is contained in:
nytpu 2020-09-09 23:04:51 -06:00
parent 1da056ef83
commit 76fb49e3d8
Signed by untrusted user: nytpu
GPG Key ID: ECCDC07B337B8F5B
1 changed files with 13 additions and 9 deletions

View File

@ -15,21 +15,22 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# fill out variables here
# to customize, modify variables here and modify build_entries()
make_globals() { make_globals() {
global_title="yatg" global_title="yatg"
global_description="yet another tech gemlog" global_description="yet another tech gemlog"
global_url="gemini://nytpu.com/gemlog/" # link to base url of blog global_url="gemini://nytpu.com/gemlog/" # link to base url of gemlog
global_author="nytpu" global_author="nytpu"
global_author_email="alex@nytpu.com" global_author_email="alex@nytpu.com"
global_author_url="gemini://nytpu.com/" global_author_url="gemini://nytpu.com/" # homepage of author
global_license="CC by" global_license="CC by"
gemlog_feed="atom.xml" # filename of the atom feed gemlog_feed="atom.xml" # filename of the atom feed
number_of_feed_articles="50" # number of posts in rss feed number_of_feed_articles="50" # maximum number of posts added to atom feed
feed_base_url="https://nytpu.com/files/" # base url that the feed is hosted at feed_base_url="https://nytpu.com/files/" # base url that the feed is hosted at
index="index.gmi" # main page, not recommended to change index="index.gmi" # main page of gemlog, not recommended to change
# don't change these # don't change these
gemlog_sh_link="https://tildegit.org/nytpu/gemlog.sh" gemlog_sh_link="https://tildegit.org/nytpu/gemlog.sh"
@ -74,7 +75,8 @@ EOF
printf "</title>\n <id>$global_url${i#'./'}</id>\n" printf "</title>\n <id>$global_url${i#'./'}</id>\n"
printf " <link rel='alternate' href='$global_url${i#'./'}'/>\n <updated>" printf " <link rel='alternate' href='$global_url${i#'./'}'/>\n <updated>"
echo "$i" | perl -ne '/^(\d{4}-\d{2}-\d{2}).*/; print $1' | date "$date_format_8601" -f - | tr -d '\n' echo "$i" | perl -ne '/^(\d{4}-\d{2}-\d{2}).*/; print $1' | date "$date_format_8601" -f - | tr -d '\n'
printf "</updated>\n <summary>You need a gemini protocol client to view this post. If you have one installed, here is the link to the post: $global_url${i#'./'}\"&gt;$global_url${i#'./'}</summary>\n </entry>\n" # change or remove the <summary></summary> block if you want a different description or no description at all
printf "</updated>\n <summary>You need a gemini client to view this post. If you have one installed, here is the link to the post: $global_url${i#'./'}\"&gt;$global_url${i#'./'}</summary>\n </entry>\n"
n=$(( n + 1 )) n=$(( n + 1 ))
done < <(ls -r [[:digit:]]*.gmi) done < <(ls -r [[:digit:]]*.gmi)
@ -86,10 +88,10 @@ EOF
chmod 644 "$gemlog_feed" chmod 644 "$gemlog_feed"
} }
# change this to what you want
build_entries() { build_entries() {
echo "Building entries" echo "Building entries"
{ {
# header of the page (above the posts list)
sed 's/$/\r/g' << 'EOF' sed 's/$/\r/g' << 'EOF'
```yet another tech gemlog (yatg) by nytpu ```yet another tech gemlog (yatg) by nytpu
,───────────────. ,───────────────.
@ -110,7 +112,8 @@ EOF
pubdate=$(echo $i | perl -ne '/^(\d{4}-\d{2}-\d{2}).*/; print $1') pubdate=$(echo $i | perl -ne '/^(\d{4}-\d{2}-\d{2}).*/; print $1')
printf "=> $global_url$post $pubdate$title\r\n" printf "=> $global_url$post $pubdate$title\r\n"
done < <(ls -r [[:digit:]]*.gmi) done < <(ls -r [[:digit:]]*.gmi)
# footer of the page (below the list of posts)
printf "\r\n\r\n" printf "\r\n\r\n"
printf "=> / go home\r\n" printf "=> / go home\r\n"
printf "\r\n" printf "\r\n"
@ -128,7 +131,8 @@ toot() {
read -r -p "do you want to toot the newest post? [y/N] " response read -r -p "do you want to toot the newest post? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then then
printf "new blog post: ${title}\n\ngemini://nytpu.com/gemlog/${filename}" | toot post # change this if you want the toot to have different content
printf "new gemlog post: ${title}\n\ngemini://nytpu.com/gemlog/${filename}" | toot post
fi fi
} }