@@ -37,7 +37,7 @@ import Data.List ( intercalate )
3737import Control.Monad.State
3838import Text.Pandoc.Pretty
3939import Text.Pandoc.Templates ( renderTemplate )
40−import Network.URI ( isAbsoluteURI, unEscapeString )
40+import Network.URI ( isURI, unEscapeString )
4141
4242data WriterState =
4343 WriterState { stNextRef :: Int -- number of next URL reference
@@ -279,20 +279,17 @@ inlineToConTeXt (Link txt (src, _)) = do
279279 st <- get
280280 let next = stNextRef st
281281 put $ st {stNextRef = next + 1}
282− let ref ="urlref" ++ (show next)
283− let hyphenateURL x =
284− case x of
285− (Str str) -> if isAbsoluteURI str
286− then (RawInline "context" ("\\hyphenatedurl{" ++ str ++ "}"))
287− else x
288− _otherwise -> x
282+ let ref = "url" ++ show next
283+ let hyphenateURL (Str str) | isURI str =
284+ RawInline "context" ("\\hyphenatedurl{" ++ str ++ "}")
285+ hyphenateURL x = x
289286 label <- inlineListToConTeXt (bottomUp hyphenateURL $ normalize txt)
290287 return $ "\\useURL" <> brackets (text ref) <>
291288 brackets (text $ escapeStringUsing [('#',"\\#")] src) <>
292289 brackets empty <> brackets label <>
293290 "\\from" <> brackets (text ref)
294291inlineToConTeXt (Image _ (src, _)) = do
295− let src' = if isAbsoluteURI src
292+ let src' = if isURI src
296293 then src
297294 else unEscapeString src
298295 return $ braces $ "\\externalfigure" <> brackets (text src')