Merge branch 'master' of gitlab.com:shockrahwow/shockrah-city

This commit is contained in:
Medium Fries 2019-03-21 13:35:02 -07:00
commit 98615782a7
3 changed files with 12 additions and 102 deletions

View File

@ -4,20 +4,10 @@ This is the source code for the website all packaged here.
Below is a description of what each directory contains and why.
## Build/Make Scripts
1. Yes I know there's two of them
2. Yes I know it's messy that they're both here/both used to build this site
3. No I don't really care at the moment to fix them.
## ~/
* `index.html` - the main page where most links can be found in the site
* `make.sh` - build file for basically everything
* `build.sh` - build script that basically does what `make.sh` but in a lazy(stupid) as hell way
## ./markdown
Container for all/post articles and/or posts to the site, including but not limited to the homepage, site philosophy post and others. These are then rendered into actual html files using the `make.sh` file.

View File

@ -1,74 +0,0 @@
# Because sometimes you just have to rebuild everything
rootDir='./_site/'
index() {
pandoc ./markdown/index.md --css style.css -s -o $rootDir/index.html
sed -i '7r ./templates/navbar.html' $rootDir/index.html
}
post() {
for file in ./markdown/post/*
do
fileName=$(basename $file)
pandoc $file --css style.css -s -o $rootDir/post/${fileName%.*}.html
done
}
page() {
for file in ./markdown/pages/*
do
pandoc $file --css style.css -s -o $rootDir/page/${fileName%.*}.html
done
}
img() {
cp -r img/ "$rootDir/img/"
}
style() {
# Updating index style
cp style.css $rootDir/style.css
# Updating page style
cp style.css $rootDir/page/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/page/style.css
# Updating post style
cp style.css $rootDir/post/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/post/style.css
}
yeet() {
post
page
style
# finally we'll upload the site itself to neocities
neocities push _site/
}
# Setups site directory from scratch
init() {
mkdir -p "$rootDir/page/" "$rootDir/post/" "$rootDir/fonts/" "$rootDir/img/"
cp -r img/ "$rootDir"
cp ./fonts/* "$rootDir/fonts/"
post
page
index
style
}
"$@"
if [ -z $1 ]
then
echo './build.sh init - create website from scratch'
echo './build.sh post - builds posts'
echo './build.sh page - builds pages'
echo './build.sh style - builds style'
echo './build.sh yeet - upload to neocties'
echo './build.sh img - currently super busted so don't bother
fi

30
make.sh
View File

@ -1,15 +1,16 @@
# compiles new post into target directory
rootDir='./_site/'
mPageDir='./markdown/page/'
mPostDir='./markdown/post/'
img() {
# each post/page should have their own directory with the same name as that post/page
cp -r img/$1 $rootDir/img/
}
post() {
# check directory existence
if [ -f markdown/post/$1 ]
then
# CSS file is always relative to the target html location
pandoc markdown/post/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
else
# error message incase file was not found
echo "File \"$1\" not found in markdown/post"
fi
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
}
style() {
@ -18,21 +19,14 @@ style() {
# Updating page style
cp style.css $rootDir/page/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/page/style.css
# Updating post style
cp style.css $rootDir/post/style.css
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/post/style.css
}
page() {
# we want to enforce maintainence of directory structure
if [ -f markdown/pages/$1 ]
then
pandoc markdown/pages/$1 --css style.css -s -o $rootDir/page/${1%.*}.html
else
echo "File \"$1\" not found in markdown/pages"
fi
pandoc $mPageDir/$1 --css style.css -s -o $rootDir/page/${1%.*}.html
}
# literally just updates the index file nothing else