updated the makefile and all that

This commit is contained in:
/dev/urandom 2020-03-14 20:27:53 +03:00
parent ea486d626a
commit 33251aa098
4 changed files with 45 additions and 12 deletions

View file

@ -11,23 +11,27 @@ PNGS = $(patsubst $(PAGEDIR)/%,$(OUTDIR)/%,$(_PNGS))
_PAGES = $(shell find $(PAGEDIR) -name \*.md) _PAGES = $(shell find $(PAGEDIR) -name \*.md)
PAGES_HTML = $(patsubst $(PAGEDIR)/%.md,$(OUTDIR)/%.html,$(_PAGES)) PAGES_HTML = $(patsubst $(PAGEDIR)/%.md,$(OUTDIR)/%.html,$(_PAGES))
_DIRECTORIES = $(shell find $(PAGEDIR)/* -type d)
DIRECTORIES = $(patsubst $(PAGEDIR)/, $(OUTDIR)/, $(_PAGES))
_STATIC = $(shell find static/ -name \*) _STATIC = $(shell find static/ -name \*)
OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC)) OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC))
.SUFFIXES: .SUFFIXES:
.PHONY: all upload .PHONY: all upload
all: $(PAGES_HTML) $(OUT_STATIC) all: $(PAGES_HTML) $(OUT_STATIC)
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl $(OUTDIR) upload:
./upload.sh
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
@mkdir -p $(@D)
theme -t $(TPLDIR)/default.tpl -o $@ $< theme -t $(TPLDIR)/default.tpl -o $@ $<
$(OUTDIR)/%: static/% $(OUTDIR)/%: static/%
@mkdir -p $(@D)
cp -r $< $@ cp -r $< $@
$(OUTDIR):
mkdir -p $(OUTDIR)
clean: clean:
rm -rf out/* rm -rf out/*

View file

@ -38,8 +38,20 @@ body a:visited {
.footer { .footer {
background: #d3d7cf; background: #d3d7cf;
color: #555753; color: #555753;
font-family: sans-serif: font-family: sans-serif;
font-size: 0.8em; font-size: 0.8em;
padding: 12pt 6pt;
}
.content {
margin: 0 6pt;
color: #2e3436;
}
.info, .warning, .error {
margin: 6pt;
padding: 6pt;
font-family: sans-serif;
} }
.info { .info {
@ -62,4 +74,9 @@ body a:visited {
color: white; color: white;
} }
.spoiler {
border-left: 4px solid #2e3436;
background: #d3d7cf;
color: #2e3436;
visibility: hidden;
}

View file

@ -5,8 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?theme title?></title> <title><?theme title?></title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all"> <link href="/style.css" rel="stylesheet" type="text/css" media="all">
<script src="/scripts.js"></script>
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<h2><a href="/">rnd's website</a> | </h2><h3><?theme title?></h3> <h2><a href="/">rnd's website</a> | </h2><h3><?theme title?></h3>
</div> </div>
@ -14,6 +15,7 @@
<?theme body?> <?theme body?>
</div> </div>
<div class="footer"> <div class="footer">
Website created and updated by /dev/urandom.
</div> </div>
</body> </body>
</html> </html>

View file

@ -12,19 +12,29 @@ source ./upload.pwd
LASTUPLOAD=`stat -c %Y upload.lasttime 2>/dev/null` LASTUPLOAD=`stat -c %Y upload.lasttime 2>/dev/null`
if [[ -z $LASTUPLOAD ]]; then LASTUPLOAD=0; fi if [[ -z $LASTUPLOAD ]]; then LASTUPLOAD=0; fi
echo "Last upload at $LASTUPLOAD" #echo "Last upload at $LASTUPLOAD"
FILES=`find out/ -type f` FILES=`find out/ -type f`
UPFILES=()
UPARGS=()
for f in $FILES; do for f in $FILES; do
MTIME=`stat -c %Y $f` MTIME=`stat -c %Y $f`
#echo "MTIME for $f: $MTIME" #echo "MTIME for $f: $MTIME"
if [[ $MTIME -gt $LASTUPLOAD ]]; then if [[ $MTIME -gt $LASTUPLOAD ]]; then
REMOTENAME="${f#out/}" REMOTENAME="${f#out/}"
echo "Uploading $REMOTENAME..." echo "File $REMOTENAME needs uploading"
curl -F "$REMOTENAME=@$f" "https://$N_USER:$N_PWD@neocities.org/api/upload" UPFILES+=("$REMOTENAME")
UPARGS+=("-F" "$REMOTENAME=@$f")
#curl -F "$REMOTENAME=@$f" "https://$N_USER:$N_PWD@neocities.org/api/upload"
fi fi
done done
touch upload.lasttime if [[ ${#UPARGS[@]} -gt 0 ]]; then
curl ${UPARGS[@]} "https://$N_USER:$N_PWD@neocities.org/api/upload" && touch upload.lasttime
else
echo "No files need to be uploaded."
fi