diff options
author | NerdyPepper <[email protected]> | 2019-07-31 06:45:11 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-07-31 06:45:11 +0100 |
commit | 502f7102495cf7919b3be67d1bec43a7f3591ee1 (patch) | |
tree | b7e4691923af77ac1110d48eb51fb641e89ac6c5 /generate.sh | |
parent | 6b84f1f763df20e86f054eabecedd98db3ed4a30 (diff) |
first post is always maximized
Diffstat (limited to 'generate.sh')
-rwxr-xr-x | generate.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/generate.sh b/generate.sh index 103c4a5..3386198 100755 --- a/generate.sh +++ b/generate.sh | |||
@@ -11,11 +11,15 @@ post_wrapper() { | |||
11 | # 1 - post id | 11 | # 1 - post id |
12 | # 2 - post content | 12 | # 2 - post content |
13 | title="$( post_title $1 )" | 13 | title="$( post_title $1 )" |
14 | d="none"; | ||
15 | if [ "$4" = "1" ]; then | ||
16 | d="block" | ||
17 | fi | ||
14 | echo -ne " | 18 | echo -ne " |
15 | <div class=\"post\"> | 19 | <div class=\"post\"> |
16 | <div class=\"date\">$3</div> | 20 | <div class=\"date\">$3</div> |
17 | <a href=\"#$1\" class=\"post-link\" onClick=\"showPost('$1')\">$title</a> | 21 | <a href=\"#$1\" class=\"post-link\" onClick=\"showPost('$1')\">$title</a> |
18 | <div id=\"$1\" class=\"post-text\" style=\"display: none\"> | 22 | <div id=\"$1\" class=\"post-text\" style=\"display: $d\"> |
19 | $2 | 23 | $2 |
20 | <a href=\"#$1\" class=\"post-end-link\" onClick=\"showPost('$1')\">↑ Collapse</a> | 24 | <a href=\"#$1\" class=\"post-end-link\" onClick=\"showPost('$1')\">↑ Collapse</a> |
21 | <div class="separator"></div> | 25 | <div class="separator"></div> |
@@ -44,19 +48,26 @@ echo '</script> </head>' >> docs/index.html | |||
44 | echo " | 48 | echo " |
45 | <body> | 49 | <body> |
46 | <h1 class=\"heading\">n</h1> | 50 | <h1 class=\"heading\">n</h1> |
51 | " >> docs/index.html | ||
52 | |||
53 | |||
54 | # begin posts | ||
55 | echo " | ||
47 | <div class=\"posts\"> | 56 | <div class=\"posts\"> |
48 | " >> docs/index.html | 57 | " >> docs/index.html |
49 | 58 | ||
50 | # posts | 59 | # posts |
51 | posts=$(ls -t ./posts); | 60 | posts=$(ls -t ./posts); |
61 | first_visible="1" | ||
52 | for f in $posts; do | 62 | for f in $posts; do |
53 | file="./posts/"$f | 63 | file="./posts/"$f |
54 | echo "generating post $file" | 64 | echo "generating post $file" |
55 | id="${file##*/}" # ill name my posts just fine | 65 | id="${file##*/}" # ill name my posts just fine |
56 | html=$(lowdown "$file") | 66 | html=$(lowdown "$file") |
57 | post_date=$(date -r "$file" "+%d/%m %Y") | 67 | post_date=$(date -r "$file" "+%d/%m %Y") |
58 | post_div=$(post_wrapper "$id" "$html" "$post_date") | 68 | post_div=$(post_wrapper "$id" "$html" "$post_date" "$first_visible") |
59 | echo -ne "$post_div" >> docs/index.html | 69 | echo -ne "$post_div" >> docs/index.html |
70 | first_visible="0" | ||
60 | done | 71 | done |
61 | 72 | ||
62 | echo " | 73 | echo " |