diff options
| author | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-08 11:35:55 -0500 |
|---|---|---|
| committer | David Schlachter <t480-debian-git@schlachter.ca> | 2026-01-08 11:35:55 -0500 |
| commit | 4be46ea1449222be87c8ba4aa4d1d02187e5a6d8 (patch) | |
| tree | aa03e2d6163a899a94db327b30add194982a85ee /ui.go | |
| parent | c6ebb73c3ed6eefc9298a50397434e0fd0ace781 (diff) | |
Replace apostrophe HTML entity with apostrophe
Diffstat (limited to 'ui.go')
| -rw-r--r-- | ui.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -147,14 +147,24 @@ func (m model) View() string { } func formatDefinitionForDisplay(policy bluemonday.Policy, definition string, maxWidth int) string { + // Add a hypher to the start of each definition str := strings.ReplaceAll(definition, "<li class=sense>", "<li class=sense>- ") + + // Italicize examples str = strings.ReplaceAll(str, "\t<ul><li><i>", "\n\t<ul><li><i>\x1b[3;39;49m") str = strings.ReplaceAll(str, "</i></li></ul></li>", "</i></li></ul></li>\x1b[0m") + + // Remove all HTML tags str = policy.Sanitize(str) + + // Add some colour to the start of each definition str = strings.ReplaceAll(str, "\t- ", "\x1b[0;33;49m•\x1b[0m ") - width := min(maxWidth, 80) + // Replace common HTML entities + str = strings.ReplaceAll(str, "'", "’") + // Wrap + width := min(maxWidth, 80) return wordwrap.String(str, width) } |
