~sky/blog

blog/up-blog -rwxr-xr-x 1.5 KiB
bc8f5cd7Skyler Marks Fix link ordering to put 'index.html' and 'about.html' last. 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
BLOG_DIR=/home/skyler/blog/
STR1="<left><h5>Links by Publication Date</h5><ul>"
STR2="</ul></left>"
TEMP1='
<DOCTYPE html>
<html lang="en">
<head>
    	<meta charset="UTF-8">
    	<meta name="Description" content="Skyler Writing: A Blog.">
    	<title>Skyler Writing: A Blog</title>
    	<link rel="icon" href="logo.png">
    	<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
	<h1>
		'$1'
	</h1>
	<h2><em><u>

	</u></em></h2>
</header>
'
TEMP2='
<article>
	<h2>

	</h2>

	<p>


	</p>

</article>
'
cd $BLOG_DIR;
if [ -z "$1" ]; then
	printf "No args, running update script\n"
else
	NAME=$(date +'%F'):_${1// /_}
	printf "$TEMP1" > $BLOG_DIR/input/$NAME.head;
	nvim +15 $BLOG_DIR/input/$NAME.head
	printf "$TEMP2" > $BLOG_DIR/input/$NAME.html;
	nvim +3 $BLOG_DIR/input/$NAME.html;
fi

cd input;
> ../templates/links;
for i in *.html;
do
	TITLE=${i%%.html};
	HEADER=$TITLE.head
	TITLE=${TITLE//_/ };
	LINKS=$(cat ../templates/links);
	if [ "$i" = "index.html" ] || [ "$i" = "about.html" ]; then
		printf "$LINKS<li><a href = "https://blog.skylermarks.com/$i">$TITLE</a></li>\n" > ../templates/links;
	else
		printf "<li><a href = "https://blog.skylermarks.com/$i">$TITLE</a></li>\n$LINKS" > ../templates/links;
	fi
done;
for i in *.html;
do
	TITLE=${i%%.html};
	HEADER=$TITLE.head
	TITLE=${TITLE//_/ };
	printf "$(cat $HEADER) $STR1 $(cat ../templates/links) $STR2 $(cat ../templates/misc.html) $(cat $i) $(cat ../templates/footer.html)" > ../output/$i;
done;

cd $BLOG_DIR
cd output
scp -r ./* d2evs.net:/var/www/blog.skylermarks.com/