diff options
Diffstat (limited to 'http')
| -rwxr-xr-x | http/bin/gmi2upphtml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/http/bin/gmi2upphtml b/http/bin/gmi2upphtml index 433aa8d..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,11 +106,19 @@ while read line do if [ $is_in_preformatted_block -ne 0 ] then + 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)" = "\`\`\`" ] - echo "</code></pre>" + then + echo "${prefix}</code></pre>" is_in_preformatted_block=0 else - echo "$(escape_upphtml "${line}")" + echo "${prefix}$(escape_upphtml "${line}")" fi continue fi @@ -177,8 +186,8 @@ do if [ "$(echo "$line" | cut -c1-3)" = "\`\`\`" ] then close_all_open_blocks_except pre - echo "<pre><code>" is_in_preformatted_block=1 + is_first_line_of_preformatted_block=1 continue fi |
