added img handler for make.sh and removed redundant build scripts
This commit is contained in:
parent
c3341a6cb3
commit
903b24d681
74
build.sh
74
build.sh
@ -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
|
|
||||||
|
|
7
make.sh
7
make.sh
@ -4,6 +4,11 @@ rootDir='./_site/'
|
|||||||
mPageDir='./markdown/page/'
|
mPageDir='./markdown/page/'
|
||||||
mPostDir='./markdown/post/'
|
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() {
|
post() {
|
||||||
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
|
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
|
||||||
}
|
}
|
||||||
@ -14,11 +19,9 @@ style() {
|
|||||||
|
|
||||||
# Updating page style
|
# Updating page style
|
||||||
cp style.css $rootDir/page/style.css
|
cp style.css $rootDir/page/style.css
|
||||||
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/page/style.css
|
|
||||||
|
|
||||||
# Updating post style
|
# Updating post style
|
||||||
cp style.css $rootDir/post/style.css
|
cp style.css $rootDir/post/style.css
|
||||||
sed -i 's/(.\/fonts/(..\/fonts/g' $rootDir/post/style.css
|
|
||||||
}
|
}
|
||||||
|
|
||||||
page() {
|
page() {
|
||||||
|
41
makefile
41
makefile
@ -1,41 +0,0 @@
|
|||||||
# update style recipe and do some more code review
|
|
||||||
pd=pandoc
|
|
||||||
style=--css style.css
|
|
||||||
|
|
||||||
navbar='./templates/navbar.html'
|
|
||||||
|
|
||||||
# Builder directories
|
|
||||||
pageDir='./markdown/pages/'
|
|
||||||
postDir='./markdown/post/'
|
|
||||||
|
|
||||||
pages=$(wildcard './markdown/pages/'*md)
|
|
||||||
posts=$(wildcard markdown/post/*.md)
|
|
||||||
|
|
||||||
# Site directories
|
|
||||||
root='./tmp/'
|
|
||||||
sitePost=$(root)/post/
|
|
||||||
sitePage=$(root)/page/
|
|
||||||
|
|
||||||
.PHONY: posts pages
|
|
||||||
|
|
||||||
# Pattern matching things
|
|
||||||
$(sitePost)%.html: $(postDir)/%.md
|
|
||||||
$(pd) $< $(style) -s -o $@
|
|
||||||
|
|
||||||
$(sitePage)%.html: $(pageDir)/%.md
|
|
||||||
$(pd) $< $(style) -s -o $@
|
|
||||||
|
|
||||||
# Builder recipes for getting through all posts/pages
|
|
||||||
posts: $(posts:.md=.html)
|
|
||||||
|
|
||||||
pages: $(pages:.md=.html)
|
|
||||||
|
|
||||||
# xd
|
|
||||||
index: index.md
|
|
||||||
$(pd) index.md $(style) -s -o $(root)/index.html
|
|
||||||
# Injecting navbar into the index
|
|
||||||
sed -i '7r $(navbar)' $(root)/index.html
|
|
||||||
|
|
||||||
# neocites makes me login anyway
|
|
||||||
upload:
|
|
||||||
neocities push _site/
|
|
Loading…
Reference in New Issue
Block a user