diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2026-09-09 10:16:47 +0100 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2026-09-09 10:19:47 +0100 |
| commit | 9cdc0ad7c364357610d0743e390b49bae9e65a17 (patch) | |
| tree | 4f17d51d821896607e5f1d6a5527a67c3e65af2b /http/bin | |
| parent | f17462ba64e0b5a3df6aad055500af5a3d4f7d2c (diff) | |
| parent | dce85da71fe9ec8b41ad57ea86bbac448b143afe (diff) | |
corrects rss author: uses email
Diffstat (limited to 'http/bin')
| -rwxr-xr-x | http/bin/gmi2upphtml | 28 |
1 files changed, 18 insertions, 10 deletions
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 |
