diff options
| author | John MacFarlane <[email protected]> | 2022-02-03 13:13:03 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-02-03 13:13:03 -0800 |
| commit | 9618b66fe8e9b19f77e978a0fdc8931671ee313c (patch) | |
| tree | df69215390a0655689ccde82378783e2e062827b | |
| parent | 0011c9520dc713f71d90adeddee8e5317ff69b0d (diff) | |
Whitespace fixes.
| -rw-r--r-- | src/Text/Pandoc/Writers/Markdown/Inline.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown/Inline.hs b/src/Text/Pandoc/Writers/Markdown/Inline.hs index c65b8d1c3..929912f99 100644 --- a/src/Text/Pandoc/Writers/Markdown/Inline.hs +++ b/src/Text/Pandoc/Writers/Markdown/Inline.hs @@ -100,7 +100,7 @@ escapeText opts = T.pack . go' . T.unpack escapeMarkuaString :: Text -> Text escapeMarkuaString s = foldr (uncurry T.replace) s [("--","~-~-"), ("**","~*~*"),("//","~/~/"),("^^","~^~^"),(",,","~,~,")] - + attrsToMarkdown :: Attr -> Doc Text attrsToMarkdown attribs = braces $ hsep [attribId, attribClasses, attribKeys] where attribId = case attribs of @@ -138,7 +138,7 @@ attrsToMarkua attributes attrKeyValues = case attributes of (_,_,[]) -> [] (_,_,keyvalues) -> map ((\(k,v) -> escAttr k - <> ": " <> escAttr v) . + <> ": " <> escAttr v) . preprocessKeyValues) keyvalues escAttr = mconcat . map escAttrChar . T.unpack escAttrChar '"' = literal "\"" @@ -162,7 +162,7 @@ attrsToMarkua attributes -- | Add a (key, value) pair to Pandoc attr type addKeyValueToAttr :: Attr -> (Text,Text) -> Attr -addKeyValueToAttr (ident,classes,kvs) (key,value) +addKeyValueToAttr (ident,classes,kvs) (key,value) | not (T.null key) && not (T.null value) = (ident, classes, (key,value): kvs) @@ -170,7 +170,7 @@ addKeyValueToAttr (ident,classes,kvs) (key,value) linkAttributes :: WriterOptions -> Attr -> Doc Text linkAttributes opts attr = - if (isEnabled Ext_link_attributes opts || + if (isEnabled Ext_link_attributes opts || isEnabled Ext_attributes opts) && attr /= nullAttr then attrsToMarkdown attr else empty @@ -493,18 +493,18 @@ inlineToMarkdown opts (Math InlineMath str) = do return $ "\\(" <> literal str <> "\\)" | isEnabled Ext_tex_math_double_backslash opts -> return $ "\\\\(" <> literal str <> "\\\\)" - | otherwise -> + | otherwise -> texMathToInlines InlineMath str >>= inlineListToMarkdown opts . (if variant == PlainText then makeMathPlainer else id) - + inlineToMarkdown opts (Math DisplayMath str) = do variant <- asks envVariant case () of _ | variant == Markua -> do - let attributes = attrsToMarkua (addKeyValueToAttr ("",[],[]) + let attributes = attrsToMarkua (addKeyValueToAttr ("",[],[]) ("format", "latex")) - return $ blankline <> attributes <> cr <> literal "```" <> cr + return $ blankline <> attributes <> cr <> literal "```" <> cr <> literal str <> cr <> literal "```" <> blankline | otherwise -> case writerHTMLMathMethod opts of WebTeX url -> (\x -> blankline <> x <> blankline) `fmap` @@ -670,13 +670,13 @@ inlineToMarkdown opts img@(Image attr alternate (source, tit)) else alternate linkPart <- inlineToMarkdown opts (Link attr txt (source, tit)) alt <- inlineListToMarkdown opts alternate - let attributes | variant == Markua = attrsToMarkua $ - addKeyValueToAttr (addKeyValueToAttr attr ("title", tit)) - ("alt", render (Just (writerColumns opts)) alt) + let attributes | variant == Markua = attrsToMarkua $ + addKeyValueToAttr (addKeyValueToAttr attr ("title", tit)) + ("alt", render (Just (writerColumns opts)) alt) | otherwise = empty return $ case variant of PlainText -> "[" <> linkPart <> "]" - Markua -> cr <> attributes <> cr <> literal "" <> cr _ -> "!" <> linkPart inlineToMarkdown opts (Note contents) = do |
