From d777fe8bbecc3320cf95754dbe7f9eee21876770 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 3 Feb 2018 18:36:38 +0300 Subject: Muse writer: write image width specified in percent in Text::Amuse mode --- src/Text/Pandoc/Writers/Muse.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers/Muse.hs') diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index c3c1c3120..a1414abc5 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -48,6 +48,7 @@ import Data.List (intersperse, transpose, isInfixOf) import System.FilePath (takeExtension) import Text.Pandoc.Class (PandocMonad) import Text.Pandoc.Definition +import Text.Pandoc.ImageSize import Text.Pandoc.Options import Text.Pandoc.Pretty import Text.Pandoc.Shared @@ -384,14 +385,18 @@ 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 _ inlines (source, title)) = do +inlineToMuse (Image attr inlines (source, title)) = do + opts <- gets stOptions alt <- inlineListToMuse inlines let title' = if null title then if null inlines then "" else "[" <> alt <> "]" else "[" <> text title <> "]" - return $ "[[" <> text source <> "]" <> title' <> "]" + let width = case dimension Width attr of + Just (Percent x) | isEnabled Ext_amuse opts -> " " ++ show (round x :: Integer) + _ -> "" + return $ "[[" <> text (source ++ width) <> "]" <> title' <> "]" inlineToMuse (Note contents) = do -- add to notes in state notes <- gets stNotes -- cgit v1.2.3