Italics for quotes - fixes #28

This commit is contained in:
makeworld 2020-07-02 14:29:33 -04:00
parent 6f1f14a67a
commit 61e54f4b8f
2 changed files with 5 additions and 3 deletions

View File

@ -124,18 +124,20 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
lines[i] = strings.TrimPrefix(lines[i], ">") lines[i] = strings.TrimPrefix(lines[i], ">")
lines[i] = strings.TrimPrefix(lines[i], " ") lines[i] = strings.TrimPrefix(lines[i], " ")
// Text is also made italic, lower down in code
// Anonymous function to allow recovery from potential WordWrap panic // Anonymous function to allow recovery from potential WordWrap panic
func() { func() {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
// Add unwrapped line instead // Add unwrapped line instead
wrappedLines = append(wrappedLines, "> "+lines[i]) wrappedLines = append(wrappedLines, "> [::i]"+lines[i]+"[::-]")
} }
}() }()
temp := cview.WordWrap(lines[i], width) temp := cview.WordWrap(lines[i], width)
for i := range temp { for i := range temp {
temp[i] = "> " + temp[i] temp[i] = "> [::i]" + temp[i] + "[::-]"
} }
wrappedLines = append(wrappedLines, temp...) wrappedLines = append(wrappedLines, temp...)
}() }()

View File

@ -5,5 +5,5 @@ package webbrowser
import "fmt" import "fmt"
func Open(url string) (string, error) { func Open(url string) (string, error) {
return "", fmt.Errorf("unsupported os for default HTTP handling. Set a command in the config") return "", fmt.Errorf("unsupported OS for default HTTP handling. Set a command in the config")
} }