aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2019-07-13 20:54:26 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2019-07-14 18:22:52 +0300
commit0713cb65bc6fcea0c950d1afcdfdce412a8b56d4 (patch)
tree2b611ce16095dcf84db75c75eda22e1762ba71ef /src/Text/Pandoc/Readers
parentf6c92c7523a4070f13fbf193ef80ad7ac63f6693 (diff)
downloadpandoc-0713cb65bc6fcea0c950d1afcdfdce412a8b56d4.tar.gz
Muse: add RTL support
Closes #5551
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 568287929..ca7c94245 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -746,6 +746,8 @@ inline' = whitespace
<|> strikeoutTag
<|> verbatimTag
<|> classTag
+ <|> inlineRtl
+ <|> inlineLtr
<|> nbsp
<|> linkOrImage
<|> code
@@ -863,6 +865,16 @@ classTag = do
classes <- maybe [] words . lookup "name" <$> openTag "class"
fmap (B.spanWith ("", classes, [])) . mconcat <$> manyTill inline (closeTag "class")
+-- | Parse @\<\<\<RTL>>>@ text.
+inlineRtl :: PandocMonad m => MuseParser m (F Inlines)
+inlineRtl = try $
+ fmap (B.spanWith ("", [], [("dir", "rtl")])) . mconcat <$ string "<<<" <*> manyTill inline (string ">>>")
+
+-- | Parse @\<\<\<LTR>>>@ text.
+inlineLtr :: PandocMonad m => MuseParser m (F Inlines)
+inlineLtr = try $
+ fmap (B.spanWith ("", [], [("dir", "ltr")])) . mconcat <$ string ">>>" <*> manyTill inline (string "<<<")
+
-- | Parse "~~" as nonbreaking space.
nbsp :: PandocMonad m => MuseParser m (F Inlines)
nbsp = try $ pure (B.str "\160") <$ string "~~"