diff options
-rw-r--r-- | docs/index.html | 16 | ||||
-rwxr-xr-x | generate.sh | 9 | ||||
-rw-r--r-- | posts/bash_harder_with_vim.md | 12 |
3 files changed, 21 insertions, 16 deletions
diff --git a/docs/index.html b/docs/index.html index cba94e8..200faef 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -28,12 +28,16 @@ function showPost(id) { | |||
28 | <div class="post"> | 28 | <div class="post"> |
29 | <div class="date">31/07 2019</div> | 29 | <div class="date">31/07 2019</div> |
30 | <a href="#bash_harder_with_vim.md" class="post-link" onClick="showPost('bash_harder_with_vim.md')">Bash Harder With Vim</a> | 30 | <a href="#bash_harder_with_vim.md" class="post-link" onClick="showPost('bash_harder_with_vim.md')">Bash Harder With Vim</a> |
31 | <div id="bash_harder_with_vim.md" class="post-text" style="display: block"> | 31 | <div id="bash_harder_with_vim.md" class="post-text" style="display: none"> |
32 | <p>Bash is tricky, don’t let your editor get in your way. Here’s a couple of neat | 32 | <p>Bash is tricky, don’t let your editor get in your way. Here’s a couple of neat |
33 | addtions you could make to your <code>vimrc</code> for a better shell programming | 33 | additions you could make to your <code>vimrc</code> for a better shell programming |
34 | experience.</p> | 34 | experience.</p> |
35 | 35 | ||
36 | <p><strong>Man pages inside vim</strong>. Source this script to get started: </p> | 36 | <hr/> |
37 | |||
38 | <h4 id="Man%20pages%20inside%20vim">Man pages inside vim</h4> | ||
39 | |||
40 | <p>Source this script to get started: </p> | ||
37 | 41 | ||
38 | <pre><code>runtime ftplugin/man.vim | 42 | <pre><code>runtime ftplugin/man.vim |
39 | </code></pre> | 43 | </code></pre> |
@@ -46,7 +50,11 @@ and the ability to jump around with <code>Ctrl-]</code> and <code>Ctrl-T</code>. | |||
46 | <pre><code>let g:ft_man_open_mode = 'tab' | 50 | <pre><code>let g:ft_man_open_mode = 'tab' |
47 | </code></pre> | 51 | </code></pre> |
48 | 52 | ||
49 | <p><strong>Scratchpad to test your commands</strong>. I often test my <code>sed</code> substitutions, here is | 53 | <hr/> |
54 | |||
55 | <h4 id="Scratchpad%20to%20test%20your%20commands">Scratchpad to test your commands</h4> | ||
56 | |||
57 | <p>I often test my <code>sed</code> substitutions, here is | ||
50 | a sample from the script used to generate this site: </p> | 58 | a sample from the script used to generate this site: </p> |
51 | 59 | ||
52 | <pre><code># a substitution to convert snake_case to Title Case With Spaces | 60 | <pre><code># a substitution to convert snake_case to Title Case With Spaces |
diff --git a/generate.sh b/generate.sh index 3386198..86f6f05 100755 --- a/generate.sh +++ b/generate.sh | |||
@@ -11,15 +11,11 @@ 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 | ||
18 | echo -ne " | 14 | echo -ne " |
19 | <div class=\"post\"> | 15 | <div class=\"post\"> |
20 | <div class=\"date\">$3</div> | 16 | <div class=\"date\">$3</div> |
21 | <a href=\"#$1\" class=\"post-link\" onClick=\"showPost('$1')\">$title</a> | 17 | <a href=\"#$1\" class=\"post-link\" onClick=\"showPost('$1')\">$title</a> |
22 | <div id=\"$1\" class=\"post-text\" style=\"display: $d\"> | 18 | <div id=\"$1\" class=\"post-text\" style=\"display: none\"> |
23 | $2 | 19 | $2 |
24 | <a href=\"#$1\" class=\"post-end-link\" onClick=\"showPost('$1')\">↑ Collapse</a> | 20 | <a href=\"#$1\" class=\"post-end-link\" onClick=\"showPost('$1')\">↑ Collapse</a> |
25 | <div class="separator"></div> | 21 | <div class="separator"></div> |
@@ -58,14 +54,13 @@ echo " | |||
58 | 54 | ||
59 | # posts | 55 | # posts |
60 | posts=$(ls -t ./posts); | 56 | posts=$(ls -t ./posts); |
61 | first_visible="1" | ||
62 | for f in $posts; do | 57 | for f in $posts; do |
63 | file="./posts/"$f | 58 | file="./posts/"$f |
64 | echo "generating post $file" | 59 | echo "generating post $file" |
65 | id="${file##*/}" # ill name my posts just fine | 60 | id="${file##*/}" # ill name my posts just fine |
66 | html=$(lowdown "$file") | 61 | html=$(lowdown "$file") |
67 | post_date=$(date -r "$file" "+%d/%m %Y") | 62 | post_date=$(date -r "$file" "+%d/%m %Y") |
68 | post_div=$(post_wrapper "$id" "$html" "$post_date" "$first_visible") | 63 | post_div=$(post_wrapper "$id" "$html" "$post_date") |
69 | echo -ne "$post_div" >> docs/index.html | 64 | echo -ne "$post_div" >> docs/index.html |
70 | first_visible="0" | 65 | first_visible="0" |
71 | done | 66 | done |
diff --git a/posts/bash_harder_with_vim.md b/posts/bash_harder_with_vim.md index 15933bf..4d60831 100644 --- a/posts/bash_harder_with_vim.md +++ b/posts/bash_harder_with_vim.md | |||
@@ -1,8 +1,9 @@ | |||
1 | Bash is tricky, don't let your editor get in your way. Here's a couple of neat | 1 | Bash is tricky, don't let your editor get in your way. Here's a couple of neat |
2 | addtions you could make to your `vimrc` for a better shell programming | 2 | additions you could make to your `vimrc` for a better shell programming |
3 | experience. | 3 | experience. |
4 | 4 | * * * | |
5 | **Man pages inside vim**. Source this script to get started: | 5 | #### Man pages inside vim |
6 | Source this script to get started: | ||
6 | 7 | ||
7 | ``` | 8 | ``` |
8 | runtime ftplugin/man.vim | 9 | runtime ftplugin/man.vim |
@@ -15,9 +16,10 @@ By default, the manpage is opened in a horizontal split, I prefer using a new ta | |||
15 | ``` | 16 | ``` |
16 | let g:ft_man_open_mode = 'tab' | 17 | let g:ft_man_open_mode = 'tab' |
17 | ``` | 18 | ``` |
19 | * * * | ||
18 | 20 | ||
19 | 21 | #### Scratchpad to test your commands | |
20 | **Scratchpad to test your commands**. I often test my `sed` substitutions, here is | 22 | I often test my `sed` substitutions, here is |
21 | a sample from the script used to generate this site: | 23 | a sample from the script used to generate this site: |
22 | 24 | ||
23 | ``` | 25 | ``` |