summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-02-03 18:36:38 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-02-03 18:36:38 +0300
commitd777fe8bbecc3320cf95754dbe7f9eee21876770 (patch)
tree85140ff0b5b65bef900ccb02957041986cd030ab /src/Text
parenteeafb3fa773e992174dd460d093653cd77255ce5 (diff)
Muse writer: write image width specified in percent in Text::Amuse mode
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs9
1 files changed, 7 insertions, 2 deletions
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