diff options
| -rw-r--r-- | common/microlog/2026-09-08.gmi | 3 | ||||
| -rwxr-xr-x | http/bin/gmi2upphtml | 28 | ||||
| -rw-r--r-- | http/src/blog.upphtml | 2 | ||||
| -rw-r--r-- | http/src/microlog.upphtml | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/common/microlog/2026-09-08.gmi b/common/microlog/2026-09-08.gmi index 7ef1b45..ee58e79 100644 --- a/common/microlog/2026-09-08.gmi +++ b/common/microlog/2026-09-08.gmi @@ -11,7 +11,7 @@ echo "pushing changes to https://joeac.net and gemini://joeac.net" ssh <user>@<http_machine> 'git -C <dir> pull; make -C <dir>/gemini' git -C <dir> pull make -C <dir>/gemini -) 2>> $log 1>&2 +) 2>> $log 1>&2 & ``` A few tricks: @@ -21,3 +21,4 @@ A few tricks: * make sure `nginx` has a public key stored in the remote user's `~/.ssh/authorized_keys` file * any output to stdout or stderr goes back to the git-pusher's CLI * I've used a sub-shell and redirects to put logs in a logfile and not return them to the git-pusher +* I've also used the ampersand `&` operator so the git-pusher isn't hanging around waiting for the build to finish diff --git a/http/bin/gmi2upphtml b/http/bin/gmi2upphtml index ace3ef2..afaf9ef 100755 --- a/http/bin/gmi2upphtml +++ b/http/bin/gmi2upphtml @@ -5,6 +5,7 @@ post_title="${POST_TITLE:-}" is_in_list=0 is_in_link_block=0 is_in_preformatted_block=0 +is_first_line_of_preformatted_block=0 is_in_blockquote=0 if_in_list_then_close() @@ -105,7 +106,20 @@ while read line do if [ $is_in_preformatted_block -ne 0 ] then - echo "$(escape_upphtml "${line}")" + if [ $is_first_line_of_preformatted_block -ne 0 ] + then + prefix="<pre><code>" + is_first_line_of_preformatted_block=0 + else + prefix="" + fi + if [ "$(echo "$line" | cut -c1-3)" = "\`\`\`" ] + then + echo "${prefix}</code></pre>" + is_in_preformatted_block=0 + else + echo "${prefix}$(escape_upphtml "${line}")" + fi continue fi @@ -171,15 +185,9 @@ do if [ "$(echo "$line" | cut -c1-3)" = "\`\`\`" ] then - if [ $is_in_preformatted_block -eq 0 ] - then - close_all_open_blocks_except pre - echo "<pre><code>" - is_in_preformatted_block=1 - else - echo "</code></pre>" - is_in_preformatted_block=0 - fi + close_all_open_blocks_except pre + is_in_preformatted_block=1 + is_first_line_of_preformatted_block=1 continue fi diff --git a/http/src/blog.upphtml b/http/src/blog.upphtml index 8c0e429..f96f1df 100644 --- a/http/src/blog.upphtml +++ b/http/src/blog.upphtml @@ -53,7 +53,7 @@ for post in $POSTS; do if [ "$(echo "${post}" | cut -c1-4)" = "$year" ]; then title="$(grep "^export TITLE=" "${SRC}/blog/${post}" | cut -c15-)" title="$(echo ${title} | cut -c1-$(( ${#title} - 16 )) )" date_published="$(echo "${post}" | cut -c1-10)" -href="${SITE_URL}/blog/$(echo "$post" | cut -c1-10).html" +href="${SITE_URL}/blog/$(echo "$post" | cut -c1-10)" #! <li class='h-entry'> diff --git a/http/src/microlog.upphtml b/http/src/microlog.upphtml index aa3cfea..55c1dfc 100644 --- a/http/src/microlog.upphtml +++ b/http/src/microlog.upphtml @@ -55,7 +55,7 @@ for post in $POSTS; do if [ "$(echo "${post}" | cut -c1-4)" = "$year" ]; then title="$(grep "^export TITLE=" "${SRC}/microlog/${post}" | cut -c15-)" title="$(echo "${title}" | cut -c1-$(( ${#title} - 16)) )" date_published="$(echo "${post}" | cut -c1-10)" -href="${SITE_URL}/microlog/$(echo ${post} | cut -c1-$(( ${#post} - 17 )) ).html" +href="${SITE_URL}/microlog/$(echo ${post} | cut -c1-$(( ${#post} - 17 )) )" #! <li class='h-entry'> |
