gopher using templates in repo

This commit is contained in:
Tilde Black Admin 2019-08-01 12:41:01 +00:00
parent 1a4a647618
commit 9e5acde134
5 changed files with 32 additions and 10 deletions

View File

@ -19,12 +19,12 @@ if [ "$remotesha" != "$localsha" ] || [ "$1" = "force" ]; then
git pull -q origin master 2> /dev/null
# build the web version
/usr/local/bin/mkdocs build > /dev/null 2> /dev/null
mkdocs build > /dev/null 2> /dev/null
# clear the gopher version
rm /var/gopher/docs/*.md
# copy files to the gopher version
cd "$HOME/docs/docs/" || exit 1
cd "${DOC_DIR}/docs/" || exit 1
cp ./*.md /var/gopher/docs/
fi

View File

@ -1,8 +1,9 @@
#!/bin/sh
all_users=$(grep /home < /etc/passwd | awk -F: '{print $1}')
output="/var/gopher/users.gophermap"
current_dir=$(dirname "$(readlink -f "$0")")
template_dir="${current_dir}/templates/gopher"
output="${template_dir}/users.gophermap"
printf "iUsers:\\n" > "$output"
printf "%s" "$all_users" | while read -r n; do
if [ -f "/var/gopher/users/${n}/gophermap" ]; then
@ -10,4 +11,4 @@ printf "%s" "$all_users" | while read -r n; do
fi
done
cat /var/gopher/head.gophermap /var/gopher/users.gophermap > /var/gopher/gophermap
cat "${template_dir}/head.gophermap" "${template_dir}/users.gophermap" > /var/gopher/gophermap

View File

@ -0,0 +1,11 @@
i _______ __ __ __ __ __ __ / null 70
i | |__| .--| .-----. | |--| .---.-.----| |--. / null 70
i |.| | | | | _ | -__|__| _ | | _ | __| < / null 70
i `-|. |-|__|__|_____|_____|__|_____|__|___._|____|__|__| / null 70
i |: | / null 70
i |::.| / null 70
i `---' / null 70
i / null 70
i / null 70
1Guides and Documentation /docs
i / null 70

View File

@ -0,0 +1,9 @@
iUsers:
1~fox /users/fox
1~joist /users/joist
1~bloat /users/bloat
1~brool /users/brool
1~tolyl /users/tolyl
1~poet /users/poet
1~fruit /users/fruit
1~betel /users/betel

View File

@ -2,7 +2,8 @@
all_users=$(grep /home < /etc/passwd | awk -F: '{print $1}' | sort)
current_dir=$(dirname "$(readlink -f "$0")")
output="${current_dir}/templates/web/users.partial"
template_dir="${current_dir}/templates/web"
output="${template_dir}/users.partial"
printf "<h3>Users:</h3>\\n" > "$output"
printf "<ul>\\n" >> "$output"
printf "%s" "$all_users" | while read -r n; do
@ -12,8 +13,8 @@ printf "%s" "$all_users" | while read -r n; do
done
printf "</ul>\\n" >> "$output"
cat "${current_dir}/templates/web/head.partial" \
"${current_dir}/templates/web/intro.partial" \
"${current_dir}/templates/web/users.partial" \
"${current_dir}/templates/web/foot.partial" > "/var/www/htdocs/index.html"
cat "${template_dir}/head.partial" \
"${template_dir}/intro.partial" \
"${template_dir}/users.partial" \
"${template_dir}/foot.partial" > "/var/www/htdocs/index.html"