aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-01-25 17:44:57 +0000
committerAkshay <[email protected]>2020-01-25 17:44:57 +0000
commitbfad52fec2a77888fc149a0ed4249af3509aef4a (patch)
treea1938052a50409323c478b12d1bd38ce2c13ca00
parent5924e263893ac8c47a22a78c88b46c585fc9e82b (diff)
include commit hashes
-rwxr-xr-xgenerate.sh16
-rw-r--r--post.esh13
-rw-r--r--posts/bash_harder_with_vim.md9
3 files changed, 26 insertions, 12 deletions
diff --git a/generate.sh b/generate.sh
index ee08a4b..a95fb06 100755
--- a/generate.sh
+++ b/generate.sh
@@ -10,11 +10,15 @@ title_wrapper() {
10link_wrapper() { 10link_wrapper() {
11 # 1 - id 11 # 1 - id
12 # 2 - title 12 # 2 - title
13 # 2 - date 13 # 3 - date
14 # 4 - commit hash
14 echo -ne " 15 echo -ne "
15 <div class=\"post\"> 16 <div class=\"post\">
16 <div class=\"date\">$3</div> 17 <div class=\"date\">
17 <a href=\"/posts/$1.html\" class=\"post-link\"> 18 $3
19 <span class=\"commit-hash\">$4</span>
20 </div>
21 <a href=\"/posts/$1\" class=\"post-link\">
18 <span class=\"post-link\">$2</span> 22 <span class=\"post-link\">$2</span>
19 </a> 23 </a>
20 </div> 24 </div>
@@ -65,12 +69,14 @@ for f in $posts; do
65 commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')" 69 commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')"
66 post_title=$(title_wrapper "$id") 70 post_title=$(title_wrapper "$id")
67 post_date=$(date -r "$file" "+%d/%m %Y") 71 post_date=$(date -r "$file" "+%d/%m %Y")
68 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date") 72 post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$commit")
69 73
70 echo -ne "$post_link" >> docs/index.html 74 echo -ne "$post_link" >> docs/index.html
71 75
76 id="${id%.*}"
77 mkdir -p "docs/posts/$id"
72 esh -s /bin/bash \ 78 esh -s /bin/bash \
73 -o "docs/posts/${id%.*}.html" \ 79 -o "docs/posts/$id/index.html" \
74 "./post.esh" \ 80 "./post.esh" \
75 file="$file" \ 81 file="$file" \
76 date="$post_date" \ 82 date="$post_date" \
diff --git a/post.esh b/post.esh
index 61516c0..7660113 100644
--- a/post.esh
+++ b/post.esh
@@ -13,14 +13,21 @@
13 <body> 13 <body>
14 <div class="posts"> 14 <div class="posts">
15 <div class="post"> 15 <div class="post">
16 <div class="date"><%= $date%></div> 16 <div class="date">
17 <span style="font-size: 2rem; font-weight: 600"> 17 <%= "$date"%>
18 <span class="commit-hash">
19 <a href="https://github.com/nerdypepper/site/blob/master/posts/<%basename "$file"%>" style="text-decoration: none">
20 <%= "$commit"%>
21 </a>
22 </span>
23 </div>
24 <span class="post-title">
18 <%= $title%> 25 <%= $title%>
19 </span> 26 </span>
20 <div class="post-text"> 27 <div class="post-text">
21 <% lowdown "$file"%> 28 <% lowdown "$file"%>
22 </div> 29 </div>
23 <a href="/" class="post-end-link">��� Back</a> 30 <a href="/" class="post-end-link">��� Back</a>
24 <div class="separator"></div> 31 <div class="separator"></div>
25 </div> 32 </div>
26 </div> 33 </div>
diff --git a/posts/bash_harder_with_vim.md b/posts/bash_harder_with_vim.md
index 4d60831..c7c292a 100644
--- a/posts/bash_harder_with_vim.md
+++ b/posts/bash_harder_with_vim.md
@@ -1,8 +1,9 @@
1Bash is tricky, don't let your editor get in your way. Here's a couple of neat 1Bash is tricky, don't let your editor get in your way. Here's a couple of neat
2additions you could make to your `vimrc` for a better shell programming 2additions you could make to your `vimrc` for a better shell programming
3experience. 3experience.
4* * * 4
5#### Man pages inside vim 5
6### Man pages inside vim
6 Source this script to get started: 7 Source this script to get started:
7 8
8``` 9```
@@ -16,9 +17,9 @@ By default, the manpage is opened in a horizontal split, I prefer using a new ta
16``` 17```
17let g:ft_man_open_mode = 'tab' 18let g:ft_man_open_mode = 'tab'
18``` 19```
19* * *
20 20
21#### Scratchpad to test your commands 21
22### Scratchpad to test your commands
22I often test my `sed` substitutions, here is 23I often test my `sed` substitutions, here is
23a sample from the script used to generate this site: 24a sample from the script used to generate this site:
24 25