diff options
author | Case Duckworth | 2020-06-08 00:14:10 -0500 |
---|---|---|
committer | Case Duckworth | 2020-06-08 00:14:10 -0500 |
commit | c96ced1f60f4f2560926ac6d965bb29fcef9ff84 (patch) | |
tree | e37d9e7f88ecc8bf834fb1ae661ff5291fc60c65 | |
parent | Add -servername to openssl command (diff) | |
download | bollux-c96ced1f60f4f2560926ac6d965bb29fcef9ff84.tar.gz bollux-c96ced1f60f4f2560926ac6d965bb29fcef9ff84.zip |
Add quote support to text/gemini typesetting
-rwxr-xr-x | bollux | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bollux b/bollux index 7aa2de8..55ae15b 100755 --- a/bollux +++ b/bollux | |||
@@ -715,6 +715,9 @@ typeset_gemini() { | |||
715 | '*'[[:space:]]*) | 715 | '*'[[:space:]]*) |
716 | gemini_list "$REPLY" $pre | 716 | gemini_list "$REPLY" $pre |
717 | ;; | 717 | ;; |
718 | '>'*) | ||
719 | gemini_quote "$REPLY" $pre | ||
720 | ;; | ||
718 | *) gemini_text "$REPLY" $pre ;; | 721 | *) gemini_text "$REPLY" $pre ;; |
719 | esac | 722 | esac |
720 | done | 723 | done |
@@ -776,6 +779,21 @@ gemini_list() { | |||
776 | fi | 779 | fi |
777 | } | 780 | } |
778 | 781 | ||
782 | gemini_quote() { | ||
783 | local re="^(>)[[:blank:]]*(.*)" | ||
784 | local s t a l | ||
785 | if ! ${2-false} && [[ "$1" =~ $re ]]; then | ||
786 | s="${BASH_REMATCH[1]}" | ||
787 | t="${BASH_REMATCH[2]}" | ||
788 | |||
789 | printf "\e[${C_SIGIL}m%${S_MARGIN}s " "$s" | ||
790 | printf -v l "\e[${C_LIST}m%s${C_RESET}\n" "$t" | ||
791 | fold_line "$WIDTH" "$l" | ||
792 | else | ||
793 | gemini_pre "$1" | ||
794 | fi | ||
795 | } | ||
796 | |||
779 | gemini_text() { | 797 | gemini_text() { |
780 | if ! ${2-false}; then | 798 | if ! ${2-false}; then |
781 | printf "%${S_MARGIN}s " ' ' | 799 | printf "%${S_MARGIN}s " ' ' |