git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: Make external (absolute) links active.
de79021John MacFarlane
src/Text/Pandoc/Writers/EPUB.hs+2−2
@@ -46,7 +46,7 @@ import Text.Pandoc.UUID
46import Text.Pandoc.Writers.HTML
46import Text.Pandoc.Writers.HTML
47import Text.Pandoc.Writers.Markdown ( writePlain )
47import Text.Pandoc.Writers.Markdown ( writePlain )
48import Data.Char ( toLower )
48import Data.Char ( toLower )
49−import Network.URI ( unEscapeString )
49+import Network.URI ( unEscapeString, isRelativeReference )
50
50
51-- | Produce an EPUB file from a Pandoc document.
51-- | Produce an EPUB file from a Pandoc document.
52writeEPUB :: Maybe String -- ^ EPUB stylesheet specified at command line
52writeEPUB :: Maybe String -- ^ EPUB stylesheet specified at command line
@@ -271,7 +271,7 @@ transformInlines (MathML _) _ _ (x@(Math _ _) : xs) = do
271 result = if "<math" `isPrefixOf` mathml then inOps else mathml
271 result = if "<math" `isPrefixOf` mathml then inOps else mathml
272 return $ RawInline "html" result : xs
272 return $ RawInline "html" result : xs
273transformInlines _ _ _ (RawInline _ _ : xs) = return $ Str "" : xs
273transformInlines _ _ _ (RawInline _ _ : xs) = return $ Str "" : xs
274−transformInlines _ _ _ (Link lab (_,_) : xs) = return $ lab ++ xs
274+transformInlines _ _ _ (Link lab (src,_) : xs) | isRelativeReference src = return $ lab ++ xs
275transformInlines _ _ _ xs = return xs
275transformInlines _ _ _ xs = return xs
276
276
277transformBlock :: Block -> Block
277transformBlock :: Block -> Block