Initial commit.

This commit is contained in:
Marco Cawthorne 2023-02-24 21:22:46 -08:00
commit 4bbf327d35
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
65 changed files with 514 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
out/*

306
build.sh Executable file
View File

@ -0,0 +1,306 @@
#!/bin/dash
# arguments: filename
saferm()
{
if [ -f "$1" ]
then
rm "$1"
fi
}
safecat()
{
if [ -f "$1" ]
then
cat "$1"
fi
}
# arguments: inputname
pagedump()
{
# if we have pandoc...
if [ ! -z "$(command -v pandoc)" ]
then
# always check for markdown first
if [ -f "$1.md" ]
then
pandoc -t html -f markdown "$1.md"
return
fi
fi
# else, look for plain text... because we want to process newlines efficiently
if [ -f "$1.txt" ]
then
cat "$1.txt"
return
fi
# ...or HTML. last resort!
if [ -f "$1.html" ]
then
cat "$1.html"
return
fi
echo "ERROR: content for $1 is not present."
}
# arguments: filename, title, site
html_start()
{
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">" > "$1"
echo "<html lang=\"en\">" >> "$1"
echo "<head>" >> "$1"
echo "<title>$2</title>" >> "$1"
echo "<meta charset=\"utf-8\">" >> "$1"
echo "<meta HTTP-EQUIV=\"Expires\" CONTENT=\"$(date)\">" >> "$1"
echo "</head>" >> "$1"
echo "<body" >> "$1"
safecat "./sites/$3/etc/body" >> "$1"
echo ">" >> "$1"
echo "<center>" >> "$1"
echo "<font face=Arial>" >> "$1" # DC ignores this, but need this to look consistent on other browsers
pagedump "./sites/$3/header" >> "$1"
echo "<br>" >> "$1"
echo "<table width=\"600px\" border=\"0\">" >> "$1"
echo "<tr>" >> "$1"
echo "<td>" >> "$1"
## this is where the internal layout management starts
echo "<table>" >> "$1"
echo "<tbody>" >> "$1"
echo "<tr>" >> "$1"
# right nav-bar start (always needed for News)
#if [ -d "./sites/$3/pages_left" ]
#then
echo "<td " >> "$1"
safecat "./sites/$3/etc/navtd" >> "$1"
echo ">$(cat ./sites/$3/tmp_pagesl)</td>" >> "$1"
#fi
# right nav-bar end
echo "<td halign=left valign=top width=100%>" >> "$1"
# after this, we're expected to put content into this column...
}
# arguments: filename, site
html_end()
{
echo "</td>" >> "$1"
# end of content here!
# left nav-bar start
if [ -d "./sites/$2/pages_right" ]
then
echo "<td " >> "$1"
safecat "./sites/$2/etc/navtd" >> "$1"
echo ">$(cat ./sites/$2/tmp_pagesr)</td>" >> "$1"
fi
# left nav-bar end
# close row, then the whole table
echo "</tr>" >> "$1"
echo "</tbody>" >> "$1"
echo "</table>" >> "$1"
## this is where the internal layout management ends.
echo "</td>" >> "$1"
echo "</tr>" >> "$1"
echo "</table>" >> "$1"
echo "<br>" >> "$1"
pagedump "./sites/$2/footer" >> "$1"
echo "</font>" >> "$1" # not part of HTML 3.2
echo "</center>" >> "$1"
echo "</body>" >> "$1"
echo "</html>" >> "$1"
}
# arguments: site, filename, news-id
make_news_header()
{
AUTHOR=$(cat "./sites/$1/news/$3/author")
DATE=$(cat "./sites/$1/news/$3/date")
TITLE=$(cat "./sites/$1/news/$3/title")
if [ -z "$TITLE" ]
then
AUTHOR="Unknown Title"
fi
if [ -z "$AUTHOR" ]
then
AUTHOR="Unknown Author"
fi
if [ -z "$DATE" ]
then
DATE="Unknown Date"
fi
# all an anchor to a temp file from which we'll build our news listing
echo "<table" >> "$2"
safecat "./sites/$1/etc/table" >> "$2" # copy the table style
echo ">" >> "$2"
echo "<tbody>" >> "$2"
echo "<tr>" >> "$2"
echo "<td" >> "$2"
safecat "./sites/$1/etc/td" >> "$2" # copy the table style
echo ">" >> "$2"
echo "<a href=\"news-$3.html\"><strong>$TITLE</strong></a><br>" >> "$2"
echo "</td>" >> "$2"
echo "</tr>" >> "$2"
echo "<tr>" >> "$2"
echo "<td" >> "$2"
safecat "./sites/$1/etc/td" >> "$2" # copy the table style
echo ">" >> "$2"
echo "<small>Posted by $AUTHOR on $DATE</small>" >> "$2"
echo "</td>" >> "$2"
echo "</tr>" >> "$2"
echo "</tbody>" >> "$2"
echo "</table>" >> "$2"
}
# arguments: site-name (folder inside ./sites)
site_process()
{
TMP_NEWS="./sites/$1/tmp_news"
TMP_PAGES_R="./sites/$1/tmp_pagesr"
TMP_PAGES_L="./sites/$1/tmp_pagesl"
OUT_INDEX="./out/$1/index.html"
SITE_TITLE=$(cat "./sites/$1/domain")
# delete output dir if it exists#
if [ -d "./out/$1" ]
then
rm -rf "./out/$1"
fi
# create the output-dir for our site
mkdir -p "./out/$1"
# clean up 1
saferm "$TMP_NEWS"
saferm "$TMP_PAGES_R"
saferm "$TMP_PAGES_L"
# before we collect all pages, add a 'News' button:
echo "<a href=\"index.html\">&#8226; News</a><br>" >> "$TMP_PAGES_L"
# enumerate and list the right-aligned pages
if [ -d "./sites/$1/pages_right" ]
then
find ./sites/$1/pages_right -name title | sort | while read LINE
do
DIR=$(dirname "$LINE")
ID_NAME=$(basename "$DIR")
TITLE=$(cat "$DIR/title")
if [ -f "./sites/$1/pages_right/$ID_NAME/hidden" ]
then
continue
fi
echo "<a href=\"$ID_NAME.html\">&#8226; $TITLE</a><br>" >> "$TMP_PAGES_R"
done
fi
# enumerate and list the left-aligned pages
if [ -d "./sites/$1/pages_left" ]
then
find ./sites/$1/pages_left -name title | sort | while read LINE
do
DIR=$(dirname "$LINE")
ID_NAME=$(basename "$DIR")
TITLE=$(cat "$DIR/title")
if [ -f "./sites/$1/pages_left/$ID_NAME/hidden" ]
then
continue
fi
echo "<a href=\"$ID_NAME.html\">&#8226; $TITLE</a><br>" >> "$TMP_PAGES_L"
done
fi
# Collect all news articles
find ./sites/$1/news -name title | sort -r | while read LINE
do
DIR=$(dirname "$LINE")
ID_NAME=$(basename "$DIR")
TITLE=$(cat "$DIR/title")
OUTFILE="./out/$1/news-$ID_NAME.html"
# all an anchor to a temp file from which we'll build our news listing
make_news_header "$1" "$TMP_NEWS" "$ID_NAME"
echo "<br>" >> "$TMP_NEWS"
# generate the individual news page
html_start "$OUTFILE" "$TITLE" "$1"
make_news_header "$1" "$OUTFILE" "$ID_NAME"
pagedump "$DIR/content" >> "$OUTFILE"
html_end "$OUTFILE" "$1"
done
# build right-aligned pages
if [ -d "./sites/$1/pages_right" ]
then
find ./sites/$1/pages_right -name title | sort | while read LINE
do
DIR=$(dirname "$LINE")
ID_NAME=$(basename "$DIR")
TITLE=$(cat "$DIR/title")
OUTFILE="./out/$1/$ID_NAME.html"
# generate the individual news page
html_start "$OUTFILE" "$TITLE" "$1"
pagedump "$DIR/content" >> "$OUTFILE"
html_end "$OUTFILE" "$1"
done
fi
# Build left-aligned pages
if [ -d "./sites/$1/pages_left" ]
then
find ./sites/$1/pages_left -name title | sort | while read LINE
do
DIR=$(dirname "$LINE")
ID_NAME=$(basename "$DIR")
TITLE=$(cat "$DIR/title")
OUTFILE="./out/$1/$ID_NAME.html"
# generate the individual news page
html_start "$OUTFILE" "$TITLE" "$1"
pagedump "$DIR/content" >> "$OUTFILE"
html_end "$OUTFILE" "$1"
done
fi
# generate the index full of news-pages
html_start "$OUT_INDEX" "$SITE_TITLE" "$1"
cat "$TMP_NEWS" >> "$OUT_INDEX"
html_end "$OUT_INDEX" "$1"
# copy over data
if [ -d "./sites/$1/data" ]
then
rsync -ra "./sites/$1/data/" "./out/$1/"
fi
# clean up 2
saferm "$TMP_NEWS"
saferm "$TMP_PAGES_R"
saferm "$TMP_PAGES_L"
}
# iterate through all of the websites
find ./sites -name domain | while read SITE
do
DOMAIN=$(basename $(dirname "$SITE"))
site_process "$DOMAIN"
done

51
readme.txt Normal file
View File

@ -0,0 +1,51 @@
# DC WEB GEN 1.0
DC Web Gen is a static web page generator. Ideally, no HTML knowledge
is required.
As the name implies, it targets the SEGA Dreamcast. This means it
outputs an HTML3-ish type dialect.
# Features
- looks for plain text files and directories
- page content can be written purely using Markdown, Plain Text or HTML
- custom styling & colors done with ease
- dynamic parsing of pages with navigation on either left, right or
both sides
- support for multiple sites
- news/blog pages with their own archive
# Documentation
Create a sub-directory for your site under `./sites/`.
Under which you will need to create a file titled `domain`.
That should contain the name of your domain + tld.
You can then start producing content for your site.
The `./sites/???/news/` directory shall contain one sub-directory for every news/blog
article. In each of those sub-directories, we need 4 files. `author`, `date`, `title` and `content.md`. If you don't specify them, dcwebgen will fill them with 'Unknown' entries.
For pages, you can list them on either the left, right or both sides of the website.
Simply have a sub-directory under `./sites/???/pages_right/` or `./sites/???/pages_left/` with two files: `title` and `content.md`.
Instead of content.md, you can also have a `content.txt`, or `content.html`.
If you don't have the pandoc tool installed, you can only write using `content.html`.
Then, run `./build.sh` and it will put your website into the `./out/???/` directory.
# Custom styling
You can override specific parts of the website you generate.
`./sites/???/etc/body` - Set parameters on the body of the site (affects all)
`./sites/???/etc/navtd` - Set parameters on the navigation bar.
`./sites/???/etc/table` - Set parameters on tables.
`./sites/???/etc/td` - Set parameters on regular columns.
# LICENSE
Licensed under the ISC license. Everything in here was written by
eukara <marco@icculus.org>

1
sites/example.com/domain Normal file
View File

@ -0,0 +1 @@
example.com

View File

@ -0,0 +1,5 @@
bgcolor=black
text=white
alink=red
vlink=red
link=red

View File

@ -0,0 +1,2 @@
valign=top
nowrap

View File

@ -0,0 +1,3 @@
bgcolor=white
border=0
width=100%

1
sites/example.com/etc/td Normal file
View File

@ -0,0 +1 @@
bgcolor=black

View File

@ -0,0 +1 @@
Copyright (C) John Doe of example.com fame, 1970

View File

@ -0,0 +1,3 @@
# Super duper
## triple double
### quadruple site of fun!

View File

@ -0,0 +1 @@
Marco Cawthorne

View File

@ -0,0 +1,7 @@
You heard it *right*. You can write a bunch of stuff in here!
> Yeah? So what? You can get software written in Hugo that does the same thing!
Yeah? Cool.
~~This isn't even for you then. Go write something useful and stop bothering me!~~

View File

@ -0,0 +1 @@
Fri Feb 24 21:45:11 PST 2023

View File

@ -0,0 +1 @@
Multiple news articles are possible

View File

@ -0,0 +1 @@
Marco Cawthorne

View File

@ -0,0 +1,13 @@
This is the content of a news post.
Every news post has a **content.md** file, as well as a file describing the **author**, **title**, **date** fields.
Other than that, you should know that you can write everything freely in Markdown.
# Headline 1
## Headline 2
### Headline 3
[Some Link](about:blank)

View File

@ -0,0 +1 @@
Fri Feb 24 @ 17:25:12 PST 2023

View File

@ -0,0 +1 @@
Hello World!

View File

@ -0,0 +1,3 @@
# Information Bureau
This software has been tested.

View File

@ -0,0 +1 @@
Info...

View File

@ -0,0 +1,3 @@
# Oh hi!
You found the hidden page!

View File

@ -0,0 +1 @@
What? You found it!

View File

@ -0,0 +1,20 @@
# Legalese for you
The software is licensed under the ISC License.
```
Copyright (c) 2023 Marco Hladik marco@icculus.org
Permission to use, copy, modify, and distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF MIND, USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
```

View File

@ -0,0 +1 @@
Legal!

View File

@ -0,0 +1 @@
minimalist.de

View File

@ -0,0 +1 @@
Copyright (c) 2003 by Mr. Minimal

View File

@ -0,0 +1 @@
Mr. Minimal's minimalist.de

View File

@ -0,0 +1 @@
Mr. Minimal

View File

@ -0,0 +1,5 @@
It is starting.
Glad you're all here.
Check out more news soon.

View File

@ -0,0 +1 @@
2003-11-02

View File

@ -0,0 +1 @@
And so it begins...

View File

@ -0,0 +1 @@
Mr. Minimal

View File

@ -0,0 +1,3 @@
Thank you for all the kind words.
I will stop updating this page forever.

View File

@ -0,0 +1 @@
2003-11-03

View File

@ -0,0 +1 @@
And so it ends...

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1
sites/y2kfan.net/domain Normal file
View File

@ -0,0 +1 @@
The Y2K Fan

View File

@ -0,0 +1,5 @@
bgcolor="#485D71"
text="#5389A6"
link="#5389A6"
vlink="#5389A6"
alink="#5389A6"

View File

@ -0,0 +1,3 @@
valign=top
nowrap
bgcolor=#BFD4D2

View File

@ -0,0 +1,3 @@
bgcolor=#EFEFEF
border=0
width=100%

1
sites/y2kfan.net/etc/td Normal file
View File

@ -0,0 +1 @@
bgcolor=white

View File

@ -0,0 +1,4 @@
![](ruler_bottom.gif)
![](bottom.gif)
Copyright (c) Y2KFAN, LOL!

View File

@ -0,0 +1,2 @@
![](top.gif)
![](ruler_top.gif)

View File

@ -0,0 +1 @@
Tracy Stevens

View File

@ -0,0 +1,3 @@
Oh my gawd ^_^
I got a new phone!! I can send SMS now... and let you know how my goldfish are doing when I'm out and about! LOL! I guess that renders that kinda pointless... hrm...

View File

@ -0,0 +1 @@
Mar 12 1999 @ .414 beats

View File

@ -0,0 +1 @@
Got a new phone!

View File

@ -0,0 +1 @@
Steven Stevens

View File

@ -0,0 +1,4 @@
There's a new NFL game out on Dreamcast by 2K and it rocks!
It even has online multiplayer... like whoa. Now we can eat pizza
and play football without having to waste gas. Sweet.

View File

@ -0,0 +1 @@
Dec 24 2000 @ .124 beats

View File

@ -0,0 +1 @@
WHoa new games

View File

@ -0,0 +1,10 @@
# Consoles
There's only two consoles that matter right now...
- SEGA Dreamcast
- Sony PlayStation
The N64 does not matter... that's for babies. LOL!
-- Steven

View File

@ -0,0 +1 @@
Consoles

View File

@ -0,0 +1,6 @@
# Fashion
wear cute and bubbly stuff. like there's this sanrio sweater with hello kitty on them and I just love it. go check it out sometime on amazon:
[amazon.com](http://www.amazon.com/)

View File

@ -0,0 +1 @@
Fashion

View File

@ -0,0 +1,5 @@
# Cool Gadgets
Apparently Nintendo is working on a GameBoy that will hook up to the Dolphin and it's also gonna rub the floor with everything else... like yeah lol.
Go get a PDA if you want to do banking I guess. But an MP3 player would be sweet too. Everyone in High School wants one of those.

View File

@ -0,0 +1 @@
Cool Gadgets

View File

@ -0,0 +1,5 @@
# Steven, that's me!
I'm Steven. One of the many admins on y2kfan.net!
*nice to meet you!* - Steven

View File

@ -0,0 +1 @@
Steven?

View File

@ -0,0 +1,5 @@
# Yoo it's me Tracy!
another one of those pesky admins here.
*yup, that's me I guess* - Tracy

View File

@ -0,0 +1 @@
Tracy