blob: fbb3155dcd3691e1732f835619824ffe14813b84 (
plain)
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
|
#!/usr/bin/env bash
# create text, assemble html file, add to articles, upload
#web is a symlink to $HOME/src/web/example.com
ROOT="$HOME/web"
mkdir -p $ROOT/.tmp
cd $ROOT/.tmp || exit
EDITTMP="tmp.txt"
EDITHTM="tmp.html"
DATE=$(date +%Y-%m-%d)
read -r -p "Enter title: " TITLE
read -r -e -i "$DATE" -p "Enter date: " input
read -r -p "Enter description: " DESCRIPTION
ARTICLEDATE="${input:-$DATE}"
YEAR=$(echo "$ARTICLEDATE" | cut -c 1-4)
DEST="$ROOT/articles/$YEAR"
echo "<h2>$TITLE</h2>" > $EDITTMP
echo "<h5>$ARTICLEDATE</h5>" >> $EDITTMP
echo "<h4>$DESCRIPTION</h4>" >> $EDITTMP
echo -e "<p> </p>\n" >> $EDITTMP
micro +6:1 "$EDITTMP"
md2html -o "$EDITHTM" "$EDITTMP"
FIXEDTITLE=${TITLE// /-}
ARTICLE="$FIXEDTITLE.html"
echo "<!doctype html>
<html lang=\"en\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" >
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<link rel=\"stylesheet\" href=\"/style.css\">
<link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\">
<title>$TITLE</title>
</head>
<body>
<header>
<h1>Bloggings</h1>
<a href=\"/index.php\">Back</a>
</header>
<main>
<article>" > "$ARTICLE"
cat "$EDITHTM" >> "$ARTICLE"
echo " </article>
</main>
<footer>
<p>ยง</p>
</footer>
</body>
</html>" >> "$ARTICLE"
prettier --write "$ARTICLE"
mv "$ARTICLE" "$DEST"
echo "saved as $DEST/$ARTICLE"
echo "--------------------------"
read -rp "Update the sitemap and rss feed, then upload to your server? ; " choix
if [ "$choix" != "n" ] ; then
blogsitemap; blogrss ; blogsend
fi
|