@@ -386,20 +386,18 @@ inlineCommands = M.unions
386
386
, (" lowercase" , makeLowercase <$> tok)
387
387
, (" thanks" , skipopts >> note <$> grouped block)
388
388
, (" footnote" , skipopts >> footnote)
389
+ , (" newline" , pure B. linebreak)
390
+ , (" linebreak" , pure B. linebreak)
389
391
, (" passthrough" , fixPassthroughEscapes <$> tok)
390
392
-- \passthrough macro used by latex writer
391
393
-- for listings
392
394
, (" includegraphics" , do options <- option [] keyvals
393
- src <- braced
394
- mkImage options .
395
- unescapeURL .
396
- removeDoubleQuotes $ untokenize src)
395
+ src <- bracedFilename
396
+ mkImage options . unescapeURL $ src)
397
397
-- svg
398
398
, (" includesvg" , do options <- option [] keyvals
399
- src <- braced
400
- mkImage options .
401
- unescapeURL .
402
- removeDoubleQuotes $ untokenize src)
399
+ src <- bracedFilename
400
+ mkImage options . unescapeURL $ src)
403
401
-- hyperref
404
402
, (" url" , (\ url -> linkWith (" " ,[" uri" ],[] ) url " " (str url))
405
403
. unescapeURL . untokenize <$> bracedUrl)
@@ -438,6 +436,14 @@ inlineCommands = M.unions
438
436
, (" today" , today)
439
437
]
440
438
439
+ bracedFilename :: PandocMonad m => LP m Text
440
+ bracedFilename =
441
+ removeDoubleQuotes . T. strip . untokenize . filter (not . isComment) <$> braced
442
+
443
+ isComment :: Tok -> Bool
444
+ isComment (Tok _ Comment _) = True
445
+ isComment _ = False
446
+
441
447
today :: PandocMonad m => LP m Inlines
442
448
today =
443
449
text . T. pack . showGregorian . localDay . zonedTimeToLocalTime
@@ -719,7 +725,7 @@ rawBlockOr name fallback = do
719
725
doSubfile :: PandocMonad m => LP m Blocks
720
726
doSubfile = do
721
727
skipMany opt
722
- f <- T. unpack . removeDoubleQuotes . T. strip . untokenize <$> braced
728
+ f <- T. unpack <$> bracedFilename
723
729
oldToks <- getInput
724
730
setInput $ TokStream False []
725
731
insertIncluded (ensureExtension (/= " " ) " .tex" f)
@@ -737,15 +743,15 @@ include name = do
737
743
_ -> const False
738
744
skipMany opt
739
745
fs <- map (T. unpack . removeDoubleQuotes . T. strip) . T. splitOn " ," .
740
- untokenize <$> braced
746
+ untokenize . filter ( not . isComment) <$> braced
741
747
mapM_ (insertIncluded . ensureExtension isAllowed " .tex" ) fs
742
748
return mempty
743
749
744
750
usepackage :: (PandocMonad m , Monoid a ) => LP m a
745
751
usepackage = do
746
752
skipMany opt
747
753
fs <- map (T. unpack . removeDoubleQuotes . T. strip) . T. splitOn " ," .
748
- untokenize <$> braced
754
+ untokenize . filter ( not . isComment) <$> braced
749
755
let parsePackage f = do
750
756
TokStream _ ts <- getIncludedToks (ensureExtension (== " .sty" ) " .sty" f)
751
757
parseFromToks (do _ <- blocks
0 commit comments