Muse reader: add underline support in Emacs Muse mode
This commit is contained in:
parent
4235c2d416
commit
ed261e5832
2 changed files with 11 additions and 1 deletions
|
@ -57,7 +57,7 @@ import Text.Pandoc.Logging
|
|||
import Text.Pandoc.Options
|
||||
import Text.Pandoc.Parsing
|
||||
import Text.Pandoc.Readers.HTML (htmlTag)
|
||||
import Text.Pandoc.Shared (crFilter)
|
||||
import Text.Pandoc.Shared (crFilter, underlineSpan)
|
||||
|
||||
-- | Read Muse from an input string and return a Pandoc document.
|
||||
readMuse :: PandocMonad m
|
||||
|
@ -577,6 +577,7 @@ inlineList = [ endline
|
|||
, strongTag
|
||||
, emph
|
||||
, emphTag
|
||||
, underlined
|
||||
, superscriptTag
|
||||
, subscriptTag
|
||||
, strikeoutTag
|
||||
|
@ -666,6 +667,11 @@ strong = fmap B.strong <$> emphasisBetween (string "**")
|
|||
emph :: PandocMonad m => MuseParser m (F Inlines)
|
||||
emph = fmap B.emph <$> emphasisBetween (char '*')
|
||||
|
||||
underlined :: PandocMonad m => MuseParser m (F Inlines)
|
||||
underlined = do
|
||||
guardDisabled Ext_amuse -- Supported only by Emacs Muse
|
||||
fmap underlineSpan <$> emphasisBetween (char '_')
|
||||
|
||||
emphTag :: PandocMonad m => MuseParser m (F Inlines)
|
||||
emphTag = inlineTag B.emph "em"
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import Tests.Helpers
|
|||
import Text.Pandoc
|
||||
import Text.Pandoc.Arbitrary ()
|
||||
import Text.Pandoc.Builder
|
||||
import Text.Pandoc.Shared (underlineSpan)
|
||||
-- import Text.Pandoc.Walk (walk)
|
||||
|
||||
amuse :: Text -> Pandoc
|
||||
|
@ -83,6 +84,9 @@ tests =
|
|||
"***strength***" =?>
|
||||
para (strong . emph $ "strength")
|
||||
|
||||
, test emacsMuse "Underline"
|
||||
("_Underline_" =?> para (underlineSpan "Underline"))
|
||||
|
||||
, "Superscript tag" =: "<sup>Superscript</sup>" =?> para (superscript "Superscript")
|
||||
|
||||
, "Subscript tag" =: "<sub>Subscript</sub>" =?> para (subscript "Subscript")
|
||||
|
|
Loading…
Add table
Reference in a new issue