aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-05-07 14:54:20 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-05-07 14:54:20 +0300
commit58799234227200b480b21a8f6611bdf3b6e2528a (patch)
tree65ff8e0a6280cddd6550a4a687237212345b0c54 /src
parent621e86402339209ea340dd36dfbd3d9eefc28e85 (diff)
downloadpandoc-58799234227200b480b21a8f6611bdf3b6e2528a.tar.gz
Muse writer: add support for left-align and right-align classes
Address issue #4542
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 6ed6ed1ca..3681fcc0d 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -511,7 +511,7 @@ inlineToMuse (Link _ txt (src, _)) =
isImageUrl = (`elem` imageExtensions) . takeExtension
inlineToMuse (Image attr alt (source,'f':'i':'g':':':title)) =
inlineToMuse (Image attr alt (source,title))
-inlineToMuse (Image attr inlines (source, title)) = do
+inlineToMuse (Image attr@(_, classes, _) inlines (source, title)) = do
opts <- asks envOptions
alt <- local (\env -> env { envInsideLinkDescription = True }) $ inlineListToMuse inlines
let title' = if null title
@@ -522,7 +522,13 @@ inlineToMuse (Image attr inlines (source, title)) = do
let width = case dimension Width attr of
Just (Percent x) | isEnabled Ext_amuse opts -> " " ++ show (round x :: Integer)
_ -> ""
- return $ "[[" <> text (urlEscapeBrackets source ++ width) <> "]" <> title' <> "]"
+ let leftalign = if "align-left" `elem` classes
+ then " l"
+ else ""
+ let rightalign = if "align-right" `elem` classes
+ then " r"
+ else ""
+ return $ "[[" <> text (urlEscapeBrackets source ++ width ++ leftalign ++ rightalign) <> "]" <> title' <> "]"
inlineToMuse (Note contents) = do
-- add to notes in state
notes <- gets stNotes