git.iko.soy/typeable/pandoc
on master help sign in
Removed writerSourceURL, add source URL to common state.
f3a8003John MacFarlane
src/Text/Pandoc/App.hs+8−17
@@ -78,7 +78,8 @@ import Text.Pandoc.Builder (setMeta)
78import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getLog,
78import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getLog,
79 setResourcePath, getMediaBag, setTrace, report,
79 setResourcePath, getMediaBag, setTrace, report,
80 setUserDataDir, readFileStrict, readDataFile,
80 setUserDataDir, readFileStrict, readDataFile,
81− readDefaultDataFile, setTranslations)
81+ readDefaultDataFile, setTranslations,
82+ setInputFiles, setOutputFile)
82import Text.Pandoc.Highlighting (highlightingStyles)
83import Text.Pandoc.Highlighting (highlightingStyles)
83import Text.Pandoc.BCP47 (parseBCP47, Lang(..))
84import Text.Pandoc.BCP47 (parseBCP47, Lang(..))
84import Text.Pandoc.Lua (runLuaFilter, LuaException(..))
85import Text.Pandoc.Lua (runLuaFilter, LuaException(..))
@@ -169,14 +170,13 @@ pdfWriterAndProg mWriter mEngine = do
169
170
170convertWithOpts :: Opt -> IO ()
171convertWithOpts :: Opt -> IO ()
171convertWithOpts opts = do
172convertWithOpts opts = do
172− let args = optInputFiles opts
173 let outputFile = fromMaybe "-" (optOutputFile opts)
173 let outputFile = fromMaybe "-" (optOutputFile opts)
174 let filters = optFilters opts
174 let filters = optFilters opts
175 let verbosity = optVerbosity opts
175 let verbosity = optVerbosity opts
176
176
177 when (optDumpArgs opts) $
177 when (optDumpArgs opts) $
178 do UTF8.hPutStrLn stdout outputFile
178 do UTF8.hPutStrLn stdout outputFile
179− mapM_ (UTF8.hPutStrLn stdout) args
179+ mapM_ (UTF8.hPutStrLn stdout) (optInputFiles opts)
180 exitSuccess
180 exitSuccess
181
181
182 epubMetadata <- case optEpubMetadata opts of
182 epubMetadata <- case optEpubMetadata opts of
@@ -197,7 +197,7 @@ convertWithOpts opts = do
197 let filters' = if needsCiteproc then "pandoc-citeproc" : filters
197 let filters' = if needsCiteproc then "pandoc-citeproc" : filters
198 else filters
198 else filters
199
199
200− let sources = case args of
200+ let sources = case optInputFiles opts of
201 [] -> ["-"]
201 [] -> ["-"]
202 xs | optIgnoreArgs opts -> ["-"]
202 xs | optIgnoreArgs opts -> ["-"]
203 | otherwise -> xs
203 | otherwise -> xs
@@ -261,15 +261,6 @@ convertWithOpts opts = do
261 _ -> e
261 _ -> e
262
262
263 let standalone = optStandalone opts || not (isTextFormat format) || pdfOutput
263 let standalone = optStandalone opts || not (isTextFormat format) || pdfOutput
264− let sourceURL = case sources of
265− [] -> Nothing
266− (x:_) -> case parseURI x of
267− Just u
268− | uriScheme u `elem` ["http:","https:"] ->
269− Just $ show u{ uriQuery = "",
270− uriFragment = "" }
271− _ -> Nothing
272−
273 let addStringAsVariable varname s vars = return $ (varname, s) : vars
264 let addStringAsVariable varname s vars = return $ (varname, s) : vars
274
265
275 highlightStyle <- lookupHighlightStyle $ optHighlightStyle opts
266 highlightStyle <- lookupHighlightStyle $ optHighlightStyle opts
@@ -347,6 +338,8 @@ convertWithOpts opts = do
347
338
348 runIO' $ do
339 runIO' $ do
349 setUserDataDir datadir
340 setUserDataDir datadir
341+ setInputFiles (optInputFiles opts)
342+ setOutputFile (optOutputFile opts)
350
343
351 variables <-
344 variables <-
352 withList (addStringAsVariable "sourcefile")
345 withList (addStringAsVariable "sourcefile")
@@ -449,7 +442,6 @@ convertWithOpts opts = do
449 , writerColumns = optColumns opts
442 , writerColumns = optColumns opts
450 , writerEmailObfuscation = optEmailObfuscation opts
443 , writerEmailObfuscation = optEmailObfuscation opts
451 , writerIdentifierPrefix = optIdentifierPrefix opts
444 , writerIdentifierPrefix = optIdentifierPrefix opts
452− , writerSourceURL = sourceURL
453 , writerHtmlQTags = optHtmlQTags opts
445 , writerHtmlQTags = optHtmlQTags opts
454 , writerTopLevelDivision = optTopLevelDivision opts
446 , writerTopLevelDivision = optTopLevelDivision opts
455 , writerListings = optListings opts
447 , writerListings = optListings opts
@@ -509,7 +501,7 @@ convertWithOpts opts = do
509 setResourcePath (optResourcePath opts)
501 setResourcePath (optResourcePath opts)
510 doc <- sourceToDoc sources >>=
502 doc <- sourceToDoc sources >>=
511 ( (if isJust (optExtractMedia opts)
503 ( (if isJust (optExtractMedia opts)
512− then fillMediaBag (writerSourceURL writerOptions)
504+ then fillMediaBag
513 else return)
505 else return)
514 >=> return . flip (foldr addMetadata) metadata
506 >=> return . flip (foldr addMetadata) metadata
515 >=> applyLuaFilters datadir (optLuaFilters opts) format
507 >=> applyLuaFilters datadir (optLuaFilters opts) format
@@ -545,8 +537,7 @@ convertWithOpts opts = do
545 if optSelfContained opts && htmlFormat
537 if optSelfContained opts && htmlFormat
546 -- TODO not maximally efficient; change type
538 -- TODO not maximally efficient; change type
547 -- of makeSelfContained so it works w/ Text
539 -- of makeSelfContained so it works w/ Text
548− then T.pack <$> makeSelfContained writerOptions
540+ then T.pack <$> makeSelfContained (T.unpack output)
549− (T.unpack output)
550 else return output
541 else return output
551
542
552type Transform = Pandoc -> Pandoc
543type Transform = Pandoc -> Pandoc
src/Text/Pandoc/Class.hs+37−17
@@ -66,7 +66,9 @@ module Text.Pandoc.Class ( PandocMonad(..)
66 , getUserDataDir
66 , getUserDataDir
67 , fetchItem
67 , fetchItem
68 , getInputFiles
68 , getInputFiles
69+ , setInputFiles
69 , getOutputFile
70 , getOutputFile
71+ , setOutputFile
70 , setResourcePath
72 , setResourcePath
71 , getResourcePath
73 , getResourcePath
72 , PandocIO(..)
74 , PandocIO(..)
@@ -251,12 +253,29 @@ insertMedia fp mime bs = do
251 let mb' = MB.insertMedia fp mime bs mb
253 let mb' = MB.insertMedia fp mime bs mb
252 setMediaBag mb'
254 setMediaBag mb'
253
255
254−getInputFiles :: PandocMonad m => m (Maybe [FilePath])
256+getInputFiles :: PandocMonad m => m [FilePath]
255getInputFiles = getsCommonState stInputFiles
257getInputFiles = getsCommonState stInputFiles
256
258
259+setInputFiles :: PandocMonad m => [FilePath] -> m ()
260+setInputFiles fs = do
261+ let sourceURL = case fs of
262+ [] -> Nothing
263+ (x:_) -> case parseURI x of
264+ Just u
265+ | uriScheme u `elem` ["http:","https:"] ->
266+ Just $ show u{ uriQuery = "",
267+ uriFragment = "" }
268+ _ -> Nothing
269+
270+ modifyCommonState $ \st -> st{ stInputFiles = fs
271+ , stSourceURL = sourceURL }
272+
257getOutputFile :: PandocMonad m => m (Maybe FilePath)
273getOutputFile :: PandocMonad m => m (Maybe FilePath)
258getOutputFile = getsCommonState stOutputFile
274getOutputFile = getsCommonState stOutputFile
259
275
276+setOutputFile :: PandocMonad m => Maybe FilePath -> m ()
277+setOutputFile mbf = modifyCommonState $ \st -> st{ stOutputFile = mbf }
278+
260setResourcePath :: PandocMonad m => [FilePath] -> m ()
279setResourcePath :: PandocMonad m => [FilePath] -> m ()
261setResourcePath ps = modifyCommonState $ \st -> st{stResourcePath = ps}
280setResourcePath ps = modifyCommonState $ \st -> st{stResourcePath = ps}
262
281
@@ -289,12 +308,14 @@ data CommonState = CommonState { stLog :: [LogMessage]
289 -- ^ A list of log messages in reverse order
308 -- ^ A list of log messages in reverse order
290 , stUserDataDir :: Maybe FilePath
309 , stUserDataDir :: Maybe FilePath
291 -- ^ Directory to search for data files
310 -- ^ Directory to search for data files
311+ , stSourceURL :: Maybe String
312+ -- ^ Absolute URL + dir of 1st source file
292 , stMediaBag :: MediaBag
313 , stMediaBag :: MediaBag
293 -- ^ Media parsed from binary containers
314 -- ^ Media parsed from binary containers
294 , stTranslations :: Maybe
315 , stTranslations :: Maybe
295 (Lang, Maybe Translations)
316 (Lang, Maybe Translations)
296 -- ^ Translations for localization
317 -- ^ Translations for localization
297− , stInputFiles :: Maybe [FilePath]
318+ , stInputFiles :: [FilePath]
298 -- ^ List of input files from command line
319 -- ^ List of input files from command line
299 , stOutputFile :: Maybe FilePath
320 , stOutputFile :: Maybe FilePath
300 -- ^ Output file from command line
321 -- ^ Output file from command line
@@ -311,9 +332,10 @@ data CommonState = CommonState { stLog :: [LogMessage]
311instance Default CommonState where
332instance Default CommonState where
312 def = CommonState { stLog = []
333 def = CommonState { stLog = []
313 , stUserDataDir = Nothing
334 , stUserDataDir = Nothing
335+ , stSourceURL = Nothing
314 , stMediaBag = mempty
336 , stMediaBag = mempty
315 , stTranslations = Nothing
337 , stTranslations = Nothing
316− , stInputFiles = Nothing
338+ , stInputFiles = []
317 , stOutputFile = Nothing
339 , stOutputFile = Nothing
318 , stResourcePath = ["."]
340 , stResourcePath = ["."]
319 , stVerbosity = WARNING
341 , stVerbosity = WARNING
@@ -473,20 +495,19 @@ getUserDataDir = getsCommonState stUserDataDir
473-- | Fetch an image or other item from the local filesystem or the net.
495-- | Fetch an image or other item from the local filesystem or the net.
474-- Returns raw content and maybe mime type.
496-- Returns raw content and maybe mime type.
475fetchItem :: PandocMonad m
497fetchItem :: PandocMonad m
476− => Maybe String
477− -> String
498+ => String
478 -> m (B.ByteString, Maybe MimeType)
499 -> m (B.ByteString, Maybe MimeType)
479−fetchItem sourceURL s = do
500+fetchItem s = do
480 mediabag <- getMediaBag
501 mediabag <- getMediaBag
481 case lookupMedia s mediabag of
502 case lookupMedia s mediabag of
482 Just (mime, bs) -> return (BL.toStrict bs, Just mime)
503 Just (mime, bs) -> return (BL.toStrict bs, Just mime)
483− Nothing -> downloadOrRead sourceURL s
504+ Nothing -> downloadOrRead s
484
505
485downloadOrRead :: PandocMonad m
506downloadOrRead :: PandocMonad m
486− => Maybe String
487− -> String
507+ => String
488 -> m (B.ByteString, Maybe MimeType)
508 -> m (B.ByteString, Maybe MimeType)
489−downloadOrRead sourceURL s =
509+downloadOrRead s = do
510+ sourceURL <- getsCommonState stSourceURL
490 case (sourceURL >>= parseURIReference' .
511 case (sourceURL >>= parseURIReference' .
491 ensureEscaped, ensureEscaped s) of
512 ensureEscaped, ensureEscaped s) of
492 (Just u, s') -> -- try fetching from relative path at source
513 (Just u, s') -> -- try fetching from relative path at source
@@ -637,10 +658,9 @@ withPaths (p:ps) action fp =
637-- | Fetch local or remote resource (like an image) and provide data suitable
658-- | Fetch local or remote resource (like an image) and provide data suitable
638-- for adding it to the MediaBag.
659-- for adding it to the MediaBag.
639fetchMediaResource :: PandocMonad m
660fetchMediaResource :: PandocMonad m
640− => Maybe String -> String
641− -> m (FilePath, Maybe MimeType, BL.ByteString)
661+ => String -> m (FilePath, Maybe MimeType, BL.ByteString)
642−fetchMediaResource sourceUrl src = do
662+fetchMediaResource src = do
643− (bs, mt) <- downloadOrRead sourceUrl src
663+ (bs, mt) <- downloadOrRead src
644 let ext = fromMaybe (takeExtension src)
664 let ext = fromMaybe (takeExtension src)
645 (mt >>= extensionFromMimeType)
665 (mt >>= extensionFromMimeType)
646 let bs' = BL.fromChunks [bs]
666 let bs' = BL.fromChunks [bs]
@@ -650,15 +670,15 @@ fetchMediaResource sourceUrl src = do
650
670
651-- | Traverse tree, filling media bag for any images that
671-- | Traverse tree, filling media bag for any images that
652-- aren't already in the media bag.
672-- aren't already in the media bag.
653−fillMediaBag :: PandocMonad m => Maybe String -> Pandoc -> m Pandoc
673+fillMediaBag :: PandocMonad m => Pandoc -> m Pandoc
654−fillMediaBag sourceURL d = walkM handleImage d
674+fillMediaBag d = walkM handleImage d
655 where handleImage :: PandocMonad m => Inline -> m Inline
675 where handleImage :: PandocMonad m => Inline -> m Inline
656 handleImage (Image attr lab (src, tit)) = catchError
676 handleImage (Image attr lab (src, tit)) = catchError
657 (do mediabag <- getMediaBag
677 (do mediabag <- getMediaBag
658 case lookupMedia src mediabag of
678 case lookupMedia src mediabag of
659 Just (_, _) -> return $ Image attr lab (src, tit)
679 Just (_, _) -> return $ Image attr lab (src, tit)
660 Nothing -> do
680 Nothing -> do
661− (fname, mt, bs) <- fetchMediaResource sourceURL src
681+ (fname, mt, bs) <- fetchMediaResource src
662 insertMedia fname mt bs
682 insertMedia fname mt bs
663 return $ Image attr lab (fname, tit))
683 return $ Image attr lab (fname, tit))
664 (\e ->
684 (\e ->
src/Text/Pandoc/Lua/PandocModule.hs+2−4
@@ -136,11 +136,9 @@ mediaDirectoryFn mbRef = do
136
136
137insertResource :: IORef MB.MediaBag
137insertResource :: IORef MB.MediaBag
138 -> String
138 -> String
139− -> OrNil String
140 -> Lua NumResults
139 -> Lua NumResults
141−insertResource mbRef src sourceUrlOrNil = do
140+insertResource mbRef src = do
142− (fp, mimeType, bs) <- liftIO . runIOorExplode $
141+ (fp, mimeType, bs) <- liftIO . runIOorExplode $ fetchMediaResource src
143− fetchMediaResource (toMaybe sourceUrlOrNil) src
144 liftIO $ print (fp, mimeType)
142 liftIO $ print (fp, mimeType)
145 insertMediaFn mbRef fp (OrNil mimeType) bs
143 insertMediaFn mbRef fp (OrNil mimeType) bs
146
144
src/Text/Pandoc/Options.hs−2
@@ -207,7 +207,6 @@ data WriterOptions = WriterOptions
207 , writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
207 , writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
208 , writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
208 , writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
209 -- and for footnote marks in markdown
209 -- and for footnote marks in markdown
210− , writerSourceURL :: Maybe String -- ^ Absolute URL + directory of 1st source file
211 , writerCiteMethod :: CiteMethod -- ^ How to print cites
210 , writerCiteMethod :: CiteMethod -- ^ How to print cites
212 , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
211 , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
213 , writerSlideLevel :: Maybe Int -- ^ Force header level of slides
212 , writerSlideLevel :: Maybe Int -- ^ Force header level of slides
@@ -244,7 +243,6 @@ instance Default WriterOptions where
244 , writerColumns = 72
243 , writerColumns = 72
245 , writerEmailObfuscation = NoObfuscation
244 , writerEmailObfuscation = NoObfuscation
246 , writerIdentifierPrefix = ""
245 , writerIdentifierPrefix = ""
247− , writerSourceURL = Nothing
248 , writerCiteMethod = Citeproc
246 , writerCiteMethod = Citeproc
249 , writerHtmlQTags = False
247 , writerHtmlQTags = False
250 , writerSlideLevel = Nothing
248 , writerSlideLevel = Nothing
src/Text/Pandoc/PDF.hs+3−4
@@ -129,7 +129,7 @@ makePDF program writer opts verbosity mediabag doc = do
129 else withTempDir
129 else withTempDir
130 resourcePath <- getResourcePath
130 resourcePath <- getResourcePath
131 liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
131 liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
132− doc' <- handleImages verbosity opts resourcePath mediabag tmpdir doc
132+ doc' <- handleImages verbosity resourcePath mediabag tmpdir doc
133 source <- runIOorExplode $ do
133 source <- runIOorExplode $ do
134 setVerbosity verbosity
134 setVerbosity verbosity
135 writer opts doc'
135 writer opts doc'
@@ -141,18 +141,17 @@ makePDF program writer opts verbosity mediabag doc = do
141 _ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
141 _ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
142
142
143handleImages :: Verbosity
143handleImages :: Verbosity
144− -> WriterOptions
145 -> [FilePath]
144 -> [FilePath]
146 -> MediaBag
145 -> MediaBag
147 -> FilePath -- ^ temp dir to store images
146 -> FilePath -- ^ temp dir to store images
148 -> Pandoc -- ^ document
147 -> Pandoc -- ^ document
149 -> IO Pandoc
148 -> IO Pandoc
150−handleImages verbosity opts resourcePath mediabag tmpdir doc = do
149+handleImages verbosity resourcePath mediabag tmpdir doc = do
151 doc' <- runIOorExplode $ do
150 doc' <- runIOorExplode $ do
152 setVerbosity verbosity
151 setVerbosity verbosity
153 setResourcePath resourcePath
152 setResourcePath resourcePath
154 setMediaBag mediabag
153 setMediaBag mediabag
155− fillMediaBag (writerSourceURL opts) doc >>=
154+ fillMediaBag doc >>=
156 extractMedia tmpdir
155 extractMedia tmpdir
157 walkM (convertImages verbosity tmpdir) doc'
156 walkM (convertImages verbosity tmpdir) doc'
158
157
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -850,7 +850,7 @@ csvTableDirective top fields rawcsv = do
850 rawcsv' <- case trim <$>
850 rawcsv' <- case trim <$>
851 lookup "file" fields `mplus` lookup "url" fields of
851 lookup "file" fields `mplus` lookup "url" fields of
852 Just u -> do
852 Just u -> do
853− (bs, _) <- fetchItem Nothing u
853+ (bs, _) <- fetchItem u
854 return $ UTF8.toString bs
854 return $ UTF8.toString bs
855 Nothing -> return rawcsv
855 Nothing -> return rawcsv
856 let res = parseCSV opts (T.pack $ case explicitHeader of
856 let res = parseCSV opts (T.pack $ case explicitHeader of
src/Text/Pandoc/Readers/Txt2Tags.hs+2−8
@@ -70,14 +70,8 @@ instance Default T2TMeta where
70-- | Get the meta information required by Txt2Tags macros
70-- | Get the meta information required by Txt2Tags macros
71getT2TMeta :: PandocMonad m => m T2TMeta
71getT2TMeta :: PandocMonad m => m T2TMeta
72getT2TMeta = do
72getT2TMeta = do
73− mbInps <- P.getInputFiles
73+ inps <- P.getInputFiles
74− let inps = case mbInps of
74+ outp <- fromMaybe "" <$> P.getOutputFile
75− Just x -> x
76− Nothing -> []
77− mbOutp <- P.getOutputFile
78− let outp = case mbOutp of
79− Just x -> x
80− Nothing -> ""
81 curDate <- formatTime defaultTimeLocale "%F" <$> P.getZonedTime
75 curDate <- formatTime defaultTimeLocale "%F" <$> P.getZonedTime
82 let getModTime = fmap (formatTime defaultTimeLocale "%T") .
76 let getModTime = fmap (formatTime defaultTimeLocale "%T") .
83 P.getModificationTime
77 P.getModificationTime
src/Text/Pandoc/SelfContained.hs+54−56
@@ -42,10 +42,11 @@ import qualified Data.ByteString.Char8 as B
42import qualified Data.ByteString.Lazy as L
42import qualified Data.ByteString.Lazy as L
43import Data.Char (isAlphaNum, isAscii, toLower)
43import Data.Char (isAlphaNum, isAscii, toLower)
44import Data.List (isPrefixOf)
44import Data.List (isPrefixOf)
45−import Network.URI (URI (..), escapeURIString, parseURI)
45+import Network.URI (escapeURIString)
46import System.FilePath (takeDirectory, takeExtension, (</>))
46import System.FilePath (takeDirectory, takeExtension, (</>))
47import Text.HTML.TagSoup
47import Text.HTML.TagSoup
48−import Text.Pandoc.Class (PandocMonad (..), fetchItem, report)
48+import Text.Pandoc.Class (PandocMonad (..), fetchItem, report,
49+ getInputFiles, setInputFiles)
49import Text.Pandoc.Error
50import Text.Pandoc.Error
50import Text.Pandoc.Logging
51import Text.Pandoc.Logging
51import Text.Pandoc.MIME (MimeType)
52import Text.Pandoc.MIME (MimeType)
@@ -68,29 +69,29 @@ makeDataURI (mime, raw) =
68 then mime ++ ";charset=utf-8"
69 then mime ++ ";charset=utf-8"
69 else mime -- mime type already has charset
70 else mime -- mime type already has charset
70
71
71−convertTags :: PandocMonad m => Maybe String -> [Tag String] -> m [Tag String]
72+convertTags :: PandocMonad m => [Tag String] -> m [Tag String]
72−convertTags _ [] = return []
73+convertTags [] = return []
73−convertTags sourceURL (t@TagOpen{}:ts)
74+convertTags (t@TagOpen{}:ts)
74− | fromAttrib "data-external" t == "1" = (t:) <$> convertTags sourceURL ts
75+ | fromAttrib "data-external" t == "1" = (t:) <$> convertTags ts
75−convertTags sourceURL (t@(TagOpen tagname as):ts)
76+convertTags (t@(TagOpen tagname as):ts)
76 | tagname `elem`
77 | tagname `elem`
77 ["img", "embed", "video", "input", "audio", "source", "track"] = do
78 ["img", "embed", "video", "input", "audio", "source", "track"] = do
78 as' <- mapM processAttribute as
79 as' <- mapM processAttribute as
79− rest <- convertTags sourceURL ts
80+ rest <- convertTags ts
80 return $ TagOpen tagname as' : rest
81 return $ TagOpen tagname as' : rest
81 where processAttribute (x,y) =
82 where processAttribute (x,y) =
82 if x == "src" || x == "data-src" || x == "href" || x == "poster"
83 if x == "src" || x == "data-src" || x == "href" || x == "poster"
83 then do
84 then do
84− enc <- getDataURI sourceURL (fromAttrib "type" t) y
85+ enc <- getDataURI (fromAttrib "type" t) y
85 return (x, enc)
86 return (x, enc)
86 else return (x,y)
87 else return (x,y)
87−convertTags sourceURL (t@(TagOpen "script" as):TagClose "script":ts) =
88+convertTags (t@(TagOpen "script" as):TagClose "script":ts) =
88 case fromAttrib "src" t of
89 case fromAttrib "src" t of
89− [] -> (t:) <$> convertTags sourceURL ts
90+ [] -> (t:) <$> convertTags ts
90 src -> do
91 src -> do
91 let typeAttr = fromAttrib "type" t
92 let typeAttr = fromAttrib "type" t
92− res <- getData sourceURL typeAttr src
93+ res <- getData typeAttr src
93− rest <- convertTags sourceURL ts
94+ rest <- convertTags ts
94 case res of
95 case res of
95 Left dataUri -> return $ TagOpen "script"
96 Left dataUri -> return $ TagOpen "script"
96 (("src",dataUri) : [(x,y) | (x,y) <- as, x /= "src"]) :
97 (("src",dataUri) : [(x,y) | (x,y) <- as, x /= "src"]) :
@@ -110,21 +111,21 @@ convertTags sourceURL (t@(TagOpen "script" as):TagClose "script":ts) =
110 (("src",makeDataURI (mime, bs)) :
111 (("src",makeDataURI (mime, bs)) :
111 [(x,y) | (x,y) <- as, x /= "src"]) :
112 [(x,y) | (x,y) <- as, x /= "src"]) :
112 TagClose "script" : rest
113 TagClose "script" : rest
113−convertTags sourceURL (t@(TagOpen "link" as):ts) =
114+convertTags (t@(TagOpen "link" as):ts) =
114 case fromAttrib "href" t of
115 case fromAttrib "href" t of
115− [] -> (t:) <$> convertTags sourceURL ts
116+ [] -> (t:) <$> convertTags ts
116 src -> do
117 src -> do
117− res <- getData sourceURL (fromAttrib "type" t) src
118+ res <- getData (fromAttrib "type" t) src
118 case res of
119 case res of
119 Left dataUri -> do
120 Left dataUri -> do
120− rest <- convertTags sourceURL ts
121+ rest <- convertTags ts
121 return $ TagOpen "link"
122 return $ TagOpen "link"
122 (("href",dataUri) : [(x,y) | (x,y) <- as, x /= "href"]) :
123 (("href",dataUri) : [(x,y) | (x,y) <- as, x /= "href"]) :
123 rest
124 rest
124 Right (mime, bs)
125 Right (mime, bs)
125 | "text/css" `isPrefixOf` mime
126 | "text/css" `isPrefixOf` mime
126 && not ("</" `B.isInfixOf` bs) -> do
127 && not ("</" `B.isInfixOf` bs) -> do
127− rest <- convertTags sourceURL $
128+ rest <- convertTags $
128 dropWhile (==TagClose "link") ts
129 dropWhile (==TagClose "link") ts
129 return $
130 return $
130 TagOpen "style" [("type", mime)]
131 TagOpen "style" [("type", mime)]
@@ -132,16 +133,16 @@ convertTags sourceURL (t@(TagOpen "link" as):ts) =
132 : TagClose "style"
133 : TagClose "style"
133 : rest
134 : rest
134 | otherwise -> do
135 | otherwise -> do
135− rest <- convertTags sourceURL ts
136+ rest <- convertTags ts
136 return $ TagOpen "link"
137 return $ TagOpen "link"
137 (("href",makeDataURI (mime, bs)) :
138 (("href",makeDataURI (mime, bs)) :
138 [(x,y) | (x,y) <- as, x /= "href"]) : rest
139 [(x,y) | (x,y) <- as, x /= "href"]) : rest
139−convertTags sourceURL (t:ts) = (t:) <$> convertTags sourceURL ts
140+convertTags (t:ts) = (t:) <$> convertTags ts
140
141
141cssURLs :: PandocMonad m
142cssURLs :: PandocMonad m
142− => Maybe String -> FilePath -> ByteString -> m ByteString
143+ => FilePath -> ByteString -> m ByteString
143−cssURLs sourceURL d orig = do
144+cssURLs d orig = do
144− res <- runParserT (parseCSSUrls sourceURL d) () "css" orig
145+ res <- runParserT (parseCSSUrls d) () "css" orig
145 case res of
146 case res of
146 Left e -> do
147 Left e -> do
147 report $ CouldNotParseCSS (show e)
148 report $ CouldNotParseCSS (show e)
@@ -149,17 +150,16 @@ cssURLs sourceURL d orig = do
149 Right bs -> return bs
150 Right bs -> return bs
150
151
151parseCSSUrls :: PandocMonad m
152parseCSSUrls :: PandocMonad m
152− => Maybe String -> FilePath -> ParsecT ByteString () m ByteString
153+ => FilePath -> ParsecT ByteString () m ByteString
153−parseCSSUrls sourceURL d = B.concat <$> P.many
154+parseCSSUrls d = B.concat <$> P.many
154− (pCSSWhite <|> pCSSComment <|> pCSSImport sourceURL d <|>
155+ (pCSSWhite <|> pCSSComment <|> pCSSImport d <|> pCSSUrl d <|> pCSSOther)
155− pCSSUrl sourceURL d <|> pCSSOther)
156
156
157−pCSSImport :: PandocMonad m => Maybe String -> FilePath
157+pCSSImport :: PandocMonad m
158− -> ParsecT ByteString () m ByteString
158+ => FilePath -> ParsecT ByteString () m ByteString
159−pCSSImport sourceURL d = P.try $ do
159+pCSSImport d = P.try $ do
160 P.string "@import"
160 P.string "@import"
161 P.spaces
161 P.spaces
162− res <- (pQuoted <|> pUrl) >>= handleCSSUrl sourceURL d
162+ res <- (pQuoted <|> pUrl) >>= handleCSSUrl d
163 P.spaces
163 P.spaces
164 P.char ';'
164 P.char ';'
165 P.spaces
165 P.spaces
@@ -184,9 +184,9 @@ pCSSOther = do
184 (B.singleton <$> P.char '/')
184 (B.singleton <$> P.char '/')
185
185
186pCSSUrl :: PandocMonad m
186pCSSUrl :: PandocMonad m
187− => Maybe String -> FilePath -> ParsecT ByteString () m ByteString
187+ => FilePath -> ParsecT ByteString () m ByteString
188−pCSSUrl sourceURL d = P.try $ do
188+pCSSUrl d = P.try $ do
189− res <- pUrl >>= handleCSSUrl sourceURL d
189+ res <- pUrl >>= handleCSSUrl d
190 case res of
190 case res of
191 Left b -> return b
191 Left b -> return b
192 Right (mt,b) -> do
192 Right (mt,b) -> do
@@ -215,41 +215,41 @@ pUrl = P.try $ do
215 return (url, fallback)
215 return (url, fallback)
216
216
217handleCSSUrl :: PandocMonad m
217handleCSSUrl :: PandocMonad m
218− => Maybe String -> FilePath -> (String, ByteString)
218+ => FilePath -> (String, ByteString)
219 -> ParsecT ByteString () m
219 -> ParsecT ByteString () m
220 (Either ByteString (MimeType, ByteString))
220 (Either ByteString (MimeType, ByteString))
221−handleCSSUrl sourceURL d (url, fallback) = do
221+handleCSSUrl d (url, fallback) = do
222 -- pipes are used in URLs provided by Google Code fonts
222 -- pipes are used in URLs provided by Google Code fonts
223 -- but parseURI doesn't like them, so we escape them:
223 -- but parseURI doesn't like them, so we escape them:
224 case escapeURIString (/='|') (trim url) of
224 case escapeURIString (/='|') (trim url) of
225 '#':_ -> return $ Left fallback
225 '#':_ -> return $ Left fallback
226 'd':'a':'t':'a':':':_ -> return $ Left fallback
226 'd':'a':'t':'a':':':_ -> return $ Left fallback
227 u -> do let url' = if isURI u then u else d </> u
227 u -> do let url' = if isURI u then u else d </> u
228− res <- lift $ getData sourceURL "" url'
228+ res <- lift $ getData "" url'
229 case res of
229 case res of
230 Left uri -> return $ Left (B.pack $ "url(" ++ uri ++ ")")
230 Left uri -> return $ Left (B.pack $ "url(" ++ uri ++ ")")
231 Right (mt, raw) -> do
231 Right (mt, raw) -> do
232 -- note that the downloaded CSS may
232 -- note that the downloaded CSS may
233 -- itself contain url(...).
233 -- itself contain url(...).
234 b <- if "text/css" `isPrefixOf` mt
234 b <- if "text/css" `isPrefixOf` mt
235− then cssURLs sourceURL d raw
235+ then cssURLs d raw
236 else return raw
236 else return raw
237 return $ Right (mt, b)
237 return $ Right (mt, b)
238
238
239−getDataURI :: PandocMonad m => Maybe String -> MimeType -> String -> m String
239+getDataURI :: PandocMonad m => MimeType -> String -> m String
240−getDataURI sourceURL mimetype src = do
240+getDataURI mimetype src = do
241− res <- getData sourceURL mimetype src
241+ res <- getData mimetype src
242 case res of
242 case res of
243 Left uri -> return uri
243 Left uri -> return uri
244 Right x -> return $ makeDataURI x
244 Right x -> return $ makeDataURI x
245
245
246getData :: PandocMonad m
246getData :: PandocMonad m
247− => Maybe String -> MimeType -> String
247+ => MimeType -> String
248 -> m (Either String (MimeType, ByteString))
248 -> m (Either String (MimeType, ByteString))
249−getData _ _ src@('d':'a':'t':'a':':':_) = return $ Left src-- already data: uri
249+getData _ src@('d':'a':'t':'a':':':_) = return $ Left src-- already data: uri
250−getData sourceURL mimetype src = do
250+getData mimetype src = do
251 let ext = map toLower $ takeExtension src
251 let ext = map toLower $ takeExtension src
252− (raw, respMime) <- fetchItem sourceURL src
252+ (raw, respMime) <- fetchItem src
253 let raw' = if ext == ".gz"
253 let raw' = if ext == ".gz"
254 then B.concat $ L.toChunks $ Gzip.decompress $ L.fromChunks
254 then B.concat $ L.toChunks $ Gzip.decompress $ L.fromChunks
255 $ [raw]
255 $ [raw]
@@ -259,15 +259,13 @@ getData sourceURL mimetype src = do
259 $ "Could not determine mime type for `" ++ src ++ "'"
259 $ "Could not determine mime type for `" ++ src ++ "'"
260 (x, Nothing) -> return x
260 (x, Nothing) -> return x
261 (_, Just x ) -> return x
261 (_, Just x ) -> return x
262− let cssSourceURL = case parseURI src of
263− Just u
264− | uriScheme u `elem` ["http:","https:"] ->
265− Just $ show u{ uriPath = "",
266− uriQuery = "",
267− uriFragment = "" }
268− _ -> Nothing
269 result <- if "text/css" `isPrefixOf` mime
262 result <- if "text/css" `isPrefixOf` mime
263+ then do
264+ oldInputs <- getInputFiles
265+ setInputFiles [src]
270− then cssURLs cssSourceURL (takeDirectory src) raw'
266+ res <- cssURLs (takeDirectory src) raw'
267+ setInputFiles oldInputs
268+ return res
271 else return raw'
269 else return raw'
272 return $ Right (mime, result)
270 return $ Right (mime, result)
273
271
@@ -275,8 +273,8 @@ getData sourceURL mimetype src = do
275
273
276-- | Convert HTML into self-contained HTML, incorporating images,
274-- | Convert HTML into self-contained HTML, incorporating images,
277-- scripts, and CSS using data: URIs.
275-- scripts, and CSS using data: URIs.
278−makeSelfContained :: PandocMonad m => WriterOptions -> String -> m String
276+makeSelfContained :: PandocMonad m => String -> m String
279−makeSelfContained opts inp = do
277+makeSelfContained inp = do
280 let tags = parseTags inp
278 let tags = parseTags inp
281− out' <- convertTags (writerSourceURL opts) tags
279+ out' <- convertTags tags
282 return $ renderTags' out'
280 return $ renderTags' out'
src/Text/Pandoc/Writers/Docx.hs+1−1
@@ -1295,7 +1295,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
1295 Just (_,_,_,elt,_) -> return [elt]
1295 Just (_,_,_,elt,_) -> return [elt]
1296 Nothing -> do
1296 Nothing -> do
1297 catchError
1297 catchError
1298− (do (img, mt) <- P.fetchItem (writerSourceURL opts) src
1298+ (do (img, mt) <- P.fetchItem src
1299 ident <- ("rId"++) `fmap` ((lift . lift) getUniqueId)
1299 ident <- ("rId"++) `fmap` ((lift . lift) getUniqueId)
1300 let (xpt,ypt) = desiredSizeInPoints opts attr
1300 let (xpt,ypt) = desiredSizeInPoints opts attr
1301 (either (const def) id (imageSize opts img))
1301 (either (const def) id (imageSize opts img))
src/Text/Pandoc/Writers/EPUB.hs+1−1
@@ -918,7 +918,7 @@ modifyMediaRef opts oldsrc = do
918 case lookup oldsrc media of
918 case lookup oldsrc media of
919 Just (n,_) -> return n
919 Just (n,_) -> return n
920 Nothing -> catchError
920 Nothing -> catchError
921− (do (img, mbMime) <- P.fetchItem (writerSourceURL opts) oldsrc
921+ (do (img, mbMime) <- P.fetchItem oldsrc
922 let new = "media/file" ++ show (length media) ++
922 let new = "media/file" ++ show (length media) ++
923 fromMaybe (takeExtension (takeWhile (/='?') oldsrc))
923 fromMaybe (takeExtension (takeWhile (/='?') oldsrc))
924 (('.':) <$> (mbMime >>= extensionFromMimeType))
924 (('.':) <$> (mbMime >>= extensionFromMimeType))
src/Text/Pandoc/Writers/FB2.hs+1−1
@@ -255,7 +255,7 @@ fetchImage href link = do
255 else return Nothing
255 else return Nothing
256 (True, Just _) -> return Nothing -- not base64-encoded
256 (True, Just _) -> return Nothing -- not base64-encoded
257 _ -> do
257 _ -> do
258− catchError (do (bs, mbmime) <- P.fetchItem Nothing link
258+ catchError (do (bs, mbmime) <- P.fetchItem link
259 case mbmime of
259 case mbmime of
260 Nothing -> do
260 Nothing -> do
261 report $ CouldNotDetermineMimeType link
261 report $ CouldNotDetermineMimeType link
src/Text/Pandoc/Writers/ICML.hs+1−1
@@ -543,7 +543,7 @@ styleToStrAttr style =
543imageICML :: PandocMonad m => WriterOptions -> Style -> Attr -> Target -> WS m Doc
543imageICML :: PandocMonad m => WriterOptions -> Style -> Attr -> Target -> WS m Doc
544imageICML opts style attr (src, _) = do
544imageICML opts style attr (src, _) = do
545 imgS <- catchError
545 imgS <- catchError
546− (do (img, _) <- P.fetchItem (writerSourceURL opts) src
546+ (do (img, _) <- P.fetchItem src
547 case imageSize opts img of
547 case imageSize opts img of
548 Right size -> return size
548 Right size -> return size
549 Left msg -> do
549 Left msg -> do
src/Text/Pandoc/Writers/ODT.hs+1−1
@@ -180,7 +180,7 @@ addLang lang = everywhere' (mkT updateLangAttr)
180-- | transform both Image and Math elements
180-- | transform both Image and Math elements
181transformPicMath :: PandocMonad m => WriterOptions ->Inline -> O m Inline
181transformPicMath :: PandocMonad m => WriterOptions ->Inline -> O m Inline
182transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = catchError
182transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = catchError
183− (do (img, mbMimeType) <- P.fetchItem (writerSourceURL opts) src
183+ (do (img, mbMimeType) <- P.fetchItem src
184 (ptX, ptY) <- case imageSize opts img of
184 (ptX, ptY) <- case imageSize opts img of
185 Right s -> return $ sizeInPoints s
185 Right s -> return $ sizeInPoints s
186 Left msg -> do
186 Left msg -> do
src/Text/Pandoc/Writers/RTF.hs+1−1
@@ -56,7 +56,7 @@ import Text.Printf (printf)
56-- If file not found or filetype not jpeg or png, leave the inline unchanged.
56-- If file not found or filetype not jpeg or png, leave the inline unchanged.
57rtfEmbedImage :: PandocMonad m => WriterOptions -> Inline -> m Inline
57rtfEmbedImage :: PandocMonad m => WriterOptions -> Inline -> m Inline
58rtfEmbedImage opts x@(Image attr _ (src,_)) = catchError
58rtfEmbedImage opts x@(Image attr _ (src,_)) = catchError
59− (do result <- P.fetchItem (writerSourceURL opts) src
59+ (do result <- P.fetchItem src
60 case result of
60 case result of
61 (imgdata, Just mime)
61 (imgdata, Just mime)
62 | mime == "image/jpeg" || mime == "image/png" -> do
62 | mime == "image/jpeg" || mime == "image/png" -> do
test/Tests/Readers/Muse.hs+2−4
@@ -13,10 +13,8 @@ import Text.Pandoc.Class
13
13
14muse :: Text -> Pandoc
14muse :: Text -> Pandoc
15muse = purely $ \s -> do
15muse = purely $ \s -> do
16− putCommonState
16+ setInputFiles ["in"]
17− def { stInputFiles = Just ["in"]
17+ setOutputFile (Just "out")
18− , stOutputFile = Just "out"
19− }
20 readMuse def s
18 readMuse def s
21
19
22infix 4 =:
20infix 4 =:
test/Tests/Readers/Txt2Tags.hs+2−4
@@ -14,10 +14,8 @@ import Text.Pandoc.Class
14t2t :: Text -> Pandoc
14t2t :: Text -> Pandoc
15-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
15-- t2t = handleError . readTxt2Tags (T2TMeta "date" "mtime" "in" "out") def
16t2t = purely $ \s -> do
16t2t = purely $ \s -> do
17− putCommonState
17+ setInputFiles ["in"]
18− def { stInputFiles = Just ["in"]
18+ setOutputFile (Just "out")
19− , stOutputFile = Just "out"
20− }
21 readTxt2Tags def s
19 readTxt2Tags def s
22
20
23infix 4 =:
21infix 4 =:
test/pandoc.tixnew file+1
@@ -0,0 +1 @@
1+Tix [ TixModule "pandoc-2.0-3BMtEkU5Hqi529URohVtzN/Text.Pandoc.Class" 286124609 1293 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,16,98,98,98,98,16,0,0,16,16,98,114,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,36,36,0,36,36,36,36,729,729,729,729,729,729,729,236,0,0,0,236,493,493,729,729,729,2877,1411,2877,2877,2877,2877,2877,2877,2877,2339,2339,2339,2339,2339,220,220,35,35,35,255,255,255,255,255,220,0,220,220,255,475,22,22,22,0,0,0,22,22,22,0,0,0,0,98,98,98,0,831,831,98,98,98,98,98,98,1488,1488,1488,1488,1488,1488,1488,98,98,98,98,98,98,98,98,48,48,0,0,0,0,0,0,0,0,0,0,48,48,48,48,0,0,0,0,0,0,0,98,98,98,98,0,98,98,98,98,0,0,98,82,48,82,82,98,98,98,0,0,0,98,98,98,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,98,98,98,98,98,2339,1411,53,1411,1411,2339,2339,0,11,11,11,11,11,0,6,0,0,0,0,0,0,6,0,0,0,0,6,6,6,98,2437,2437,2339,2339,2339,2339,2339,2339,98,98,98,98,0,0,0,0,0,0,98,98,98,98,98,98,0,0,0,0,0,0,0,2339,1411,1028,1411,1411,2339,2339,4280,4280,4280,4280,4280,4280,4280,4280,4280,36,36,4280,4280,3903,0,0,0,0,3903,3903,4280,4280,4280,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2339,2339,2339,2339,1411,406,1411,1411,2339,2339,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2877,2877,11,11,0,0,98,98,0,0,98,98,40931,40931,4720,4720,45426,50121,50121,50121,11303,11303,8136,11303,11303,11303,0,0,0,0,0,0,0,0,0,0,0,0,0,2339,2339,11,2339,2339,0,0,2339,2339,2339,0,31,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,34,34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,2496,2496,2496,1536,1536,1536,1536,18,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9004,9004,9004,978,978,978,978,3,3,3,3,36,36,36,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11501,11501,11501,305,305,305,305,15,15,15,15,40931,40931,40931,40931,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40931,40931,40931,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,36,36,36,11,11,11,11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,98,98,98,98,376,376,376,376,376,0,0,0,0,0,0,0,0,2339,2339,2339,2339,2339,11303,11303,8136,11303,11303,11303,11303,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,0,53,11,0,0,0,0,0,1411,1411], TixModule "pandoc-2.0-3BMtEkU5Hqi529URohVtzN/Text.Pandoc.Writers.HTML" 519911631 3376 [68,470,470,470,470,470,470,68,56,56,56,56,68,68,68,68,68,68,470,470,470,470,0,0,0,35,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2496,415,334,253,1494,2496,2496,33,33,33,33,33,33,33,33,33,33,33,33,33,33,6,6,6,6,6,6,6,6,0,0,0,0,0,0,0,0,0,0,0,33,33,52,52,52,52,0,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,104,104,104,12,12,12,12,12,12,4,4,4,4,4,4,4,4,4,4,88,104,104,52,52,52,52,52,52,16,16,16,16,16,10,2273,2273,2273,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,809,809,809,809,22,787,22,22,22,22,0,22,22,22,22,22,22,22,0,0,0,0,0,0,0,0,0,22,787,787,787,787,809,809,809,809,824,0,824,824,824,824,824,824,824,824,824,824,2218,2218,2218,674,1544,674,674,674,2218,2218,2218,2218,222,1996,222,222,222,222,222,2218,2218,2218,2218,2218,2218,838,2166,674,2166,2166,2166,2166,30,30,30,30,30,0,30,0,30,30,30,30,30,30,30,30,30,30,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,6,10,0,16,52,10,52,52,52,0,52,52,52,52,52,52,52,52,52,52,590,590,590,590,10863,10863,10863,10863,0,10863,0,10863,10863,10863,10863,121,121,121,121,121,121,121,121,121,15,890,6,890,15,9,6,9,6,15,15,15,9,6,9,9,9,9,9,9,6,6,6,0,6,0,0,0,0,0,0,6,6,6,6,6,6,6,15,15,890,890,890,875,15,875,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,890,890,890,890,1585,1585,1585,1585,1585,1585,688,688,688,688,688,688,688,688,688,403,403,403,403,403,403,403,285,285,285,285,285,285,285,82,82,82,82,82,43531,43531,43531,43531,43449,43449,82,82,82,82,82,43531,0,43613,313,2499,2499,1002,2499,2499,2499,2499,1002,690,312,690,690,690,690,690,690,690,690,312,312,312,1002,1002,2499,2499,1497,1002,1497,1002,1002,1002,2499,2499,2499,2499,2499,2499,2499,2499,2499,2499,2499,2499,797,797,797,124,673,124,673,797,797,801,124,677,677,677,677,677,415,262,415,262,801,801,801,2499,2499,2499,2499,2499,797,801,797,801,801,801,801,801,801,801,801,801,801,801,801,801,801,801,801,801,801,801,0,27,27,27,27,27,27,27,27,27,27,21,6,21,6,6,6,6,27,27,27,27,0,27,0,0,27,0,27,27,27,27,27,27,21,6,21,21,21,21,21,21,21,21,21,21,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,27,27,27,27,0,0,445,3778,3778,6,37,37,0,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,27,27,27,27,27,27,0,0,0,0,0,0,0,0,0,3509,3509,3509,3509,0,3509,0,0,3509,3509,0,635,3509,3509,3509,3509,3509,3509,3509,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,165,165,0,165,165,165,83,0,83,0,0,0,83,83,83,83,165,165,165,165,165,165,165,165,165,165,165,0,111,111,165,0,165,0,0,0,0,0,0,165,165,165,165,0,165,165,165,0,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,165,165,165,165,165,165,165,165,165,165,165,165,452,452,452,402,50,402,402,402,402,50,50,50,50,15,15,15,15,50,35,35,35,0,0,35,50,0,50,0,0,0,0,0,0,0,0,50,0,0,0,50,50,50,50,50,50,452,452,195,195,195,195,117,78,117,78,195,195,195,216,216,216,30,30,30,30,30,10,20,20,20,20,20,20,20,10,10,10,20,216,216,216,10,206,30,30,30,30,30,10,20,10,20,30,10,10,10,206,216,216,216,10,206,10,10,10,10,10,10,10,10,10,206,216,216,216,216,216,216,0,20,20,20,0,216,0,216,20,216,0,0,216,216,216,196,196,196,0,0,0,0,196,196,0,196,196,196,196,196,196,196,196,196,196,196,196,196,196,20,20,20,20,20,0,20,20,20,20,20,20,20,20,216,216,125,125,125,125,125,0,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,0,737,737,0,737,737,737,737,0,0,0,0,0,0,0,737,0,737,0,0,0,0,0,0,0,0,0,0,0,0,0,0,737,737,737,737,737,737,737,737,0,737,0,0,0,737,737,426,426,237,237,44,44,15,15,15,15,0,0,0,0,737,737,737,737,153,403,403,403,403,403,403,403,150,285,285,285,255,285,102,0,102,102,102,102,102,102,285,285,285,60,225,60,60,60,60,60,225,285,285,285,285,0,285,0,0,0,285,285,285,285,285,255,30,255,153,102,153,153,108,9,18,9,9,0,153,153,153,102,102,102,102,102,102,102,102,255,30,285,285,285,285,285,285,285,285,255,285,285,285,285,285,271,271,0,271,0,0,271,271,16,271,271,271,271,346,346,346,346,346,346,271,271,61,271,271,271,271,271,271,271,271,271,271,271,75,75,271,271,271,271,271,271,271,271,121,121,121,121,121,121,121,252,252,153,99,153,153,11,99,99,99,99,99,99,99,99,99,99,252,66,252,231,231,231,231,231,231,231,231,248,248,252,252,186,66,186,66,66,66,231,183,48,183,183,183,183,183,183,183,183,183,48,48,48,48,48,48,48,231,231,231,231,66,66,66,66,66,66,66,66,252,252,204,252,252,128,124,128,128,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,66,66,66,252,206,46,206,46,46,46,46,46,46,46,46,46,46,46,46,46,46,252,252,252,10265,4795,297,297,4795,4795,4795,1035,4718,4795,4795,4789,4789,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,75,0,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,0,0,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,0,0,0,0,75,75,75,75,75,75,75,75,75,75,75,1151,10562,10562,10562,10562,10562,10562,10562,10562,98,45941,45941,26523,26523,26523,26523,16206,16206,16206,16206,832,832,832,0,0,772,772,60,60,832,832,31,31,25,6,25,6,31,31,31,31,31,16,40,40,0,40,0,40,16,40,40,0,40,0,40,16,40,40,0,40,0,40,40,40,40,40,40,40,0,40,0,0,0,0,0,0,40,40,16,16,16,16,16,40,40,40,40,40,181,41,41,0,41,41,41,17,41,41,41,41,41,41,0,489,489,489,489,489,489,0,167,167,167,167,167,167,205,205,205,205,0,5,5,5,205,5,205,0,0,205,205,5,205,200,200,200,0,0,0,0,200,200,0,200,200,200,200,200,200,200,200,200,5,5,0,5,5,5,5,0,5,5,5,5,5,5,5,5,205,0,15,15,15,15,15,15,0,8,8,8,8,8,8,8,8,8,0,60,60,60,60,60,60,0,45,45,45,45,45,45,240,150,150,150,150,150,90,90,90,90,90,240,240,240,0,240,0,0,0,0,0,0,0,0,0,0,0,0,240,240,240,240,240,240,45,240,240,240,240,135,39,135,135,135,124,124,124,124,124,109,15,109,15,124,124,124,124,135,135,11,11,11,11,11,11,11,11,11,11,11,11,0,0,0,0,0,0,11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,124,124,124,0,124,124,124,124,124,124,124,124,124,15,9,6,9,6,15,15,124,124,109,15,15,15,15,15,124,124,124,135,135,15,15,15,0,15,0,0,0,0,15,0,15,15,15,15,15,15,15,804,804,804,30,774,0,30,30,30,30,30,30,30,30,30,30,0,774,774,144,774,774,144,144,144,0,144,0,144,144,144,144,144,144,144,144,144,630,774,774,774,774,774,774,774,774,774,774,774,774,774,774,774,774,53,721,53,53,53,53,53,53,721,721,721,721,774,774,0,774,774,774,774,774,774,774,639,135,639,135,135,135,135,135,774,774,774,52,52,52,0,52,52,52,52,52,52,52,52,52,52,0,52,0,0,0,0,0,52,52,52,52,52,52,52,52,15,37,15,15,15,15,52,52,52,52,52,0,52,52,52,52,52,0,52,52,52,52,52,52,52,40,12,40,12,52,52,52,52,52,52,52,52,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,75,0,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,0,75,0,75,75,75,75,75,75,75,75,75,0,0,0,0,0,75,75,75,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46035,46035,46035,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1541,4380,4380,736,736,736,736,736,36,36,36,736,736,0,0,0,0,0,0,0,0,0,736,736,0,736,736,736,36,736,736,36,36,36,736,736,736,736,736,736,736,0,736,0,0,736,736,736,736,736,736,736,0,0,0,736,736,736,736,736,0,736,736,736,736,736,736,736,0,0,0,3305,1619,1940,0,0,0,0,0,0,1940,3305,3305,296,3601,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,571,621,736,736,0,736,0,0,0,621,736,736,115,621,0,621,621,621,736,736,736,36,36,36,36,36,36,36,36,36,36,36,36,36,36,736,0,736,0,736,736,36,700,36,736,736,700,700,736,36,36,736,36,700,36,736,736,700,700,736,36,700,36,36,36,36,736,736,736,736,736,736,736,36,0,36,0,36,36,36,736,736,736,736,736,736,736,0,736,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,736,736,736,736,36,700,36,36,36,36,36,36,36,36,36,36,36,700,585,585,700,592,700,700,700,700,700,700,700,736,736,736,736,5116,891,0,0,0,0,0,39,39,0,39,39,59,891,59,59,59,59,39,59,59,59,59,59,59,59,59,59,59,18,18,18,18,18,18,18,891,891,891,891,891,891,873,18,873,18,18,18,891,891,891,891,891,0,0,0,891,0,891,0,0,0,0,0,0,59,891,891,891,159,159,891,891,891,18,448,891,891,891,891,891,15,891,891,891,891,891,891,891,891,39,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,39,39,39,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,0,0,0,0,28,39,39,39,59,59,20,39,20,20,20,20,20,20,0,20,39,59,59,59,39,20,39,39,39,39,20,59,59,59,59,0,59,59,59,59,59,59,59,59,0,0,59,59,59,0,0,59,59,59,59,59,20,39,39,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,890,59,890,890,890,890,890,890,890,890,890,890,890,831,831,831,831,59,59,59,59,59,59,59,59,59,59,59,59,59,59,39,20,39,39,0,20,20,20,20,20,20,20,20,20,20,0,20,20,20,20,20,20,20,20,20,59,59,59,59,59,59,59,59,59,59,890,890,890,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,590,20,59,39,0,0,0,15,572,590,590,850,143,850,850,850,0,0,0,0,0,22,16,22,22,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,18,18,0,18,0,0,0,0,18,18,18,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,965,965,59,59,59,59,59,59,0,0,736,736,1994,1994,150,150,2050,2050]]