From 903b24d68129ec5ee4aceaf25c2007f56912f806 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Wed, 13 Mar 2019 15:00:37 -0700 Subject: [PATCH] added img handler for make.sh and removed redundant build scripts --- build.sh | 74 -------------------------------------------------------- make.sh | 7 ++++-- makefile | 41 ------------------------------- 3 files changed, 5 insertions(+), 117 deletions(-) delete mode 100755 build.sh delete mode 100644 makefile diff --git a/build.sh b/build.sh deleted file mode 100755 index 9126dba..0000000 --- a/build.sh +++ /dev/null @@ -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 - diff --git a/make.sh b/make.sh index 5235bc8..5bea8c1 100755 --- a/make.sh +++ b/make.sh @@ -4,6 +4,11 @@ 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() { pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html } @@ -14,11 +19,9 @@ 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() { diff --git a/makefile b/makefile deleted file mode 100644 index b833d5c..0000000 --- a/makefile +++ /dev/null @@ -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/