diff options
author | defanor <defanor@uberspace.net> | 2017-11-21 11:33:40 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-11-21 11:33:40 +0300 |
commit | 6e76e630cf28d46d3f118687c6d5ba959b12de28 (patch) | |
tree | 70b7dd06a5f4e0dd4e3914752a87f6861229ba68 /Pancake/Rendering.hs | |
parent | 4c6d0ed3f7cfaf969ad110ab158216db86f2008f (diff) |
Restore ^{} for superscripts and similar text bits in Emacs
Superscripts and subscripts, as they were rendered, shorten lines in
GUI Emacs, breaking tables if those contained subscripts or
superscripts. In terminal Emacs, they were just indistinguishable from
regular text. And there was a minor hack for these.
Mostly undoing that (for strikethrough as well), though leaving slight
raising.
Diffstat (limited to 'Pancake/Rendering.hs')
-rw-r--r-- | Pancake/Rendering.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index 2c1823a..075fef0 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -209,11 +209,9 @@ unstyled = concatMap unstyled' unstyled' (Underline s) = unstyled' s unstyled' (Bold s) = unstyled' s unstyled' (Emph s) = unstyled' s - -- Better to cut shorter lines than longer ones, so assuming CLI - -- mode. - unstyled' (Strikethrough s) = "-" ++ unstyled' s ++ "-" - unstyled' (Subscript s) = "_{" ++ unstyled' s ++ "}" - unstyled' (Superscript s) = "^{" ++ unstyled' s ++ "}" + unstyled' (Strikethrough s) = unstyled' s + unstyled' (Subscript s) = unstyled' s + unstyled' (Superscript s) = unstyled' s unstyled' (Fg _ s) = unstyled' s unstyled' (Denote _ s) = unstyled' s @@ -287,9 +285,9 @@ readInline (P.Str s) | otherwise = pure [fromString s] readInline (P.Emph s) = concatMap (map Emph) <$> mapM readInline s readInline (P.Strong s) = concatMap (map Bold) <$> mapM readInline s -readInline (P.Strikeout s) = concatMap (map Strikethrough) <$> mapM readInline s -readInline (P.Superscript s) = concatMap (map Superscript) <$> mapM readInline s -readInline (P.Subscript s) = concatMap (map Subscript) <$> mapM readInline s +readInline (P.Strikeout s) = map Strikethrough <$> wrappedInlines "-" "-" s +readInline (P.Superscript s) = map Superscript <$> wrappedInlines "^{" "}" s +readInline (P.Subscript s) = map Subscript <$> wrappedInlines "_{" "}" s readInline (P.SmallCaps s) = wrappedInlines "\\sc{" "}" s readInline (P.Quoted P.SingleQuote s) = wrappedInlines "‘" "’" s readInline (P.Quoted P.DoubleQuote s) = wrappedInlines "“" "”" s |