Tools used to make the micro fiction games jam website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

# make the entries in a given directory.
# file - the file that is holding all of the game data.
function mfentries -a file
# Set the variables that will be used to create a game entry
set -l name ""
set -l title ""
set -l web ""
set -l game ""
if test -z $file
set file entries.txt
# Create the entries index file
mfheader index.html
while read -l line
echo $line >> index.html
end < blurb.txt
# Parse each entry for the
while read -l line
switch $line
case "%%"
create_entry $name $web $title $game
set name ""
set title ""
set web ""
set game ""
case "NAME::*"
set name_data (string split "::" $line)
set name $name_data[2]
case "TITLE::*"
set title_data (string split "::" $line)
set title $title_data[2]
case "WEB::*"
set web_data (string split "::" $line)
set web $web_data[2]
case "*"
set game "$game\n$line"
end < $file
echo "<p><a href=\"\">home</a> | <a href=\"\">twitter</a> | <a href=\"\">email list</a> | <a href=\"\">source</a> </p>" >> index.html
mffooter index.html
# create the page for an entry
# nm - the name of the person who submitted it
# we - the web link to the oerson who submitted it
# ti - the title of thegame
# gm - the game text
function create_entry -a nm we ti gm
set fn (string replace -a ' ' _ (string trim $ti))
set fn (string replace -r -a '[:&$%$£\\\/\^\*\"\'\!]' '' $fn)
set fn "$fn.html"
set fn (string lower $fn)
if test -e $fn
echo -e " - \e[0;34m$fn\e[0;0m"
echo -e " + \e[0;32m$fn\e[0;0m"
mfheader $fn
echo "<h1>$ti</h1>" >> $fn
echo "<p>By: <a href=\"$we\">$nm</a> </p>" >> $fn
echo -e "<pre>$gm</pre>" >> $fn
echo "<p><a href=\"index.html\">back</a> | <a href=\"\">home</a> | <a href=\"\">twitter</a> | <a href=\"\">email list</a> | <a href=\"\">source</a></p>" >> $fn
mffooter $fn
echo "<a href=\"$fn\">$ti</a><br>" >> index.html