mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
Fix small whitespace things.
This commit is contained in:
@@ -525,6 +525,3 @@ adjustLinksAndIds exts thisfile allfiles
|
||||
Image (fixAttrs attr) ils (fixURL url,tit)
|
||||
fixInline (Span attr ils) = Span (fixAttrs attr) ils
|
||||
fixInline x = x
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,4 +79,3 @@ toIETF "ukrainian" = "uk-UA"
|
||||
toIETF "vietnamese" = "vi-VN"
|
||||
toIETF "latin" = "la"
|
||||
toIETF x = x
|
||||
|
||||
|
||||
@@ -47,4 +47,3 @@ sandbox files action = do
|
||||
mapM_ logOutput
|
||||
(filter ((<= verbosity) . messageVerbosity) newMessages)
|
||||
return result
|
||||
|
||||
|
||||
@@ -631,4 +631,3 @@ parseFormatSpec = parse formatSpec ""
|
||||
case polarity of
|
||||
'+' -> (ext : extsToEnable, extsToDisable)
|
||||
_ -> (extsToEnable, ext : extsToDisable)
|
||||
|
||||
|
||||
@@ -237,4 +237,3 @@ lookupHighlightingStyle s
|
||||
Just sty -> return sty
|
||||
Nothing -> throwError $ PandocOptionError $ T.pack $
|
||||
"Unknown highlight-style " ++ s
|
||||
|
||||
|
||||
@@ -61,4 +61,3 @@ writeCustom luaFile opts doc = do
|
||||
push opts
|
||||
callTrace 2 1
|
||||
forcePeek $ peekText top
|
||||
|
||||
|
||||
@@ -54,4 +54,3 @@ simpleCiteIdentifier = do
|
||||
rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/") <|>
|
||||
try (oneOf ":/" <* lookAhead (char '/'))
|
||||
return $ T.pack $ firstChar:rest
|
||||
|
||||
|
||||
@@ -158,4 +158,3 @@ specFor opts = foldr ($) defaultSyntaxSpec exts
|
||||
[ (taskListSpec <>) | isEnabled Ext_task_lists opts ] ++
|
||||
[ (rebaseRelativePathsSpec <>)
|
||||
| isEnabled Ext_rebase_relative_paths opts ]
|
||||
|
||||
|
||||
@@ -132,6 +132,6 @@ pageref = do
|
||||
farg <- fieldArgument
|
||||
switches <- spaces *> many pagerefSwitch
|
||||
let isLink = case switches of
|
||||
("\\h", _) : _ -> True
|
||||
("\\h", _) : _ -> True
|
||||
_ -> False
|
||||
return (farg, isLink)
|
||||
|
||||
@@ -67,4 +67,3 @@ findAttrByName :: NameSpaces -> Text -> Text -> Element -> Maybe Text
|
||||
findAttrByName ns pref name el =
|
||||
let ns' = ns <> elemToNameSpaces el
|
||||
in findAttr (elemName ns' pref name) el
|
||||
|
||||
|
||||
@@ -1324,4 +1324,3 @@ block = do
|
||||
|
||||
blocks :: PandocMonad m => LP m Blocks
|
||||
blocks = mconcat <$> many block
|
||||
|
||||
|
||||
@@ -208,4 +208,3 @@ complexNatbibCitation inline mode = try $ do
|
||||
inNote :: Inlines -> Inlines
|
||||
inNote ils =
|
||||
note $ para $ ils <> str "."
|
||||
|
||||
|
||||
@@ -394,5 +394,3 @@ doAcronymPlural form = do
|
||||
return . mconcat $ [spanWith ("",[],[("acronym-label", untokenize acro),
|
||||
("acronym-form", "plural+" <> form)]) $
|
||||
mconcat [str $ untokenize acro, plural]]
|
||||
|
||||
|
||||
|
||||
@@ -218,5 +218,3 @@ italicize x@(Para [Image{}]) = x -- see #6925
|
||||
italicize (Para ils) = Para [Emph ils]
|
||||
italicize (Plain ils) = Plain [Emph ils]
|
||||
italicize x = x
|
||||
|
||||
|
||||
|
||||
@@ -469,5 +469,3 @@ siUnitMap = M.fromList
|
||||
, ("watt", str "W")
|
||||
, ("weber", str "Wb")
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -57,5 +57,3 @@ writeBibTeX' variant opts (Pandoc meta _) = do
|
||||
case writerTemplate opts of
|
||||
Nothing -> main
|
||||
Just tpl -> renderTemplate tpl context
|
||||
|
||||
|
||||
|
||||
@@ -14,4 +14,3 @@ CommonMark: <http://commonmark.org>
|
||||
module Text.Pandoc.Writers.CommonMark (writeCommonMark) where
|
||||
|
||||
import Text.Pandoc.Writers.Markdown (writeCommonMark)
|
||||
|
||||
|
||||
@@ -12,4 +12,3 @@ a Lua writer.
|
||||
module Text.Pandoc.Writers.Custom ( writeCustom ) where
|
||||
|
||||
import Text.Pandoc.Lua.Writer ( writeCustom )
|
||||
|
||||
|
||||
@@ -689,7 +689,7 @@ pandocToEPUB version opts doc = do
|
||||
navPointNode formatter (Div _ bs) =
|
||||
concat <$> mapM (navPointNode formatter) bs
|
||||
navPointNode _ _ = return []
|
||||
|
||||
|
||||
-- Create the tocEntry from the metadata together with the sections and title.
|
||||
tocEntry <- createTocEntry meta metadata plainTitle secs navPointNode
|
||||
|
||||
@@ -740,7 +740,7 @@ createCoverPage :: PandocMonad m =>
|
||||
-> (WriterOptions -> Pandoc -> m B8.ByteString)
|
||||
-> Text
|
||||
-> StateT EPUBState m ([Entry], [Entry])
|
||||
createCoverPage meta metadata opts' vars cssvars writeHtml plainTitle =
|
||||
createCoverPage meta metadata opts' vars cssvars writeHtml plainTitle =
|
||||
case epubCoverImage metadata of
|
||||
Nothing -> return ([],[])
|
||||
Just img -> do
|
||||
@@ -807,7 +807,7 @@ createChapterEntries opts' vars cssvars writeHtml chapters = do
|
||||
-- remove notes or we get doubled footnotes
|
||||
(Pandoc (setMeta "title"
|
||||
(walk removeNote $ fromList xs) nullMeta) bs,
|
||||
-- Check if the chapters belongs to the frontmatter,
|
||||
-- Check if the chapters belongs to the frontmatter,
|
||||
-- backmatter of bodymatter defaulting to the body
|
||||
case lookup "epub:type" kvs of
|
||||
Nothing -> "bodymatter"
|
||||
@@ -832,7 +832,7 @@ createChapterEntries opts' vars cssvars writeHtml chapters = do
|
||||
-- | Splits the blocks into chapters and creates a corresponding reftable
|
||||
createChaptersAndReftable :: WriterOptions -> [Block] -> ([Chapter], [(Text, Text)])
|
||||
createChaptersAndReftable opts secs = (chapters, reftable)
|
||||
where
|
||||
where
|
||||
chapterHeaderLevel = writerEpubChapterLevel opts
|
||||
|
||||
isChapterHeader :: Block -> Bool
|
||||
@@ -845,18 +845,18 @@ createChaptersAndReftable opts secs = (chapters, reftable)
|
||||
-- If the header is of the same level as chapters, create a chapter
|
||||
| chapterHeaderLevel == lvl =
|
||||
Chapter [d] : secsToChapters rest
|
||||
-- If the header is a level higher than chapters,
|
||||
-- If the header is a level higher than chapters,
|
||||
-- create a chapter of everything until the next chapter header.
|
||||
| chapterHeaderLevel > lvl =
|
||||
Chapter [Div attr (h:xs)] :
|
||||
secsToChapters ys ++ secsToChapters rest
|
||||
where (xs, ys) = break isChapterHeader bs
|
||||
secsToChapters bs =
|
||||
-- If this is the last block, keep it as is,
|
||||
-- If this is the last block, keep it as is,
|
||||
-- otherwise create a chapter for everything until the next chapter header.
|
||||
(if null xs then id else (Chapter xs :)) $ secsToChapters ys
|
||||
where (xs, ys) = break isChapterHeader bs
|
||||
|
||||
|
||||
-- Convert the sections to initial chapters
|
||||
chapters' = secsToChapters secs
|
||||
|
||||
@@ -879,7 +879,7 @@ createChaptersAndReftable opts secs = (chapters, reftable)
|
||||
_ -> id)
|
||||
[] (parseTags raw)
|
||||
extractLinkURL' _ _ = []
|
||||
|
||||
|
||||
-- Extract references for the reftable from Block elements
|
||||
extractLinkURL :: Int -> Block -> [(T.Text, T.Text)]
|
||||
extractLinkURL num (Div (ident, _, _) _)
|
||||
|
||||
@@ -486,7 +486,7 @@ inlineToICML opts style _ (Span (ident, _, kvs) lst) =
|
||||
in inlinesToICML opts (dynamicStyle <> style) ident lst
|
||||
-- ident will be the id of the span, that we need to use down in the hyperlink setter
|
||||
-- if T.null ident
|
||||
-- then
|
||||
-- then
|
||||
-- else do
|
||||
|
||||
-- | Convert a list of block elements to an ICML footnote.
|
||||
@@ -559,7 +559,7 @@ makeLinkDest ident cont = vcat [
|
||||
-- | Create the markup for the content (incl. named destinations)
|
||||
-- | NOTE: since we have no easy way to get actual named dests, we just create them for any short content blocks
|
||||
makeContent :: Text -> Doc Text -> Doc Text
|
||||
makeContent ident cont
|
||||
makeContent ident cont
|
||||
| isEmpty cont = empty
|
||||
| not (Text.null ident) = makeLinkDest ident cont
|
||||
| otherwise = inTagsSimple "Content" $ flush cont
|
||||
|
||||
@@ -78,5 +78,3 @@ instance Default WriterState
|
||||
, stIds = Set.empty
|
||||
, stNoteNum = 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -111,4 +111,3 @@ nodeToContent (Conduit.NodeElement el) =
|
||||
nodeToContent (Conduit.NodeContent t) =
|
||||
Just (Text (CData CDataText t Nothing))
|
||||
nodeToContent _ = Nothing
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
This code is taken from xml-light, released under the BSD3 license.
|
||||
-}
|
||||
module Text.Pandoc.XML.Light.Proc
|
||||
(
|
||||
(
|
||||
-- * Replacement for xml-light's Text.XML.Proc
|
||||
strContent
|
||||
, onlyElems
|
||||
@@ -135,5 +135,3 @@ lookupAttrBy p as = attrVal `fmap` find (p . attrKey) as
|
||||
-- satisfies the given predicate.
|
||||
findAttrBy :: (QName -> Bool) -> Element -> Maybe Text
|
||||
findAttrBy p e = lookupAttrBy p (elAttribs e)
|
||||
|
||||
|
||||
|
||||
@@ -189,5 +189,3 @@ fromXLContent :: XL.Content -> Content
|
||||
fromXLContent (XL.Elem el) = Elem $ fromXLElement el
|
||||
fromXLContent (XL.Text cd) = Text $ fromXLCData cd
|
||||
fromXLContent (XL.CRef s) = CRef (T.pack s)
|
||||
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ instance ToString [Block] where
|
||||
toString = toString . B.fromList
|
||||
|
||||
instance ToString Block where
|
||||
toString = toString . B.singleton
|
||||
toString = toString . B.singleton
|
||||
|
||||
instance ToString Inlines where
|
||||
toString = unpack . trimr . purely (writeNative def) . toPandoc
|
||||
|
||||
@@ -39,4 +39,3 @@ tests = map rtfTest [ "footnote"
|
||||
, "table_simple"
|
||||
, "table_error_codes"
|
||||
]
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ testTOC = [ givesTOC "empty case" $ mempty =?> bulletList []
|
||||
bulletList [plain "H1a" <> bulletList [plain "H2"]]
|
||||
, givesTOC "only referenced headers" $
|
||||
header 1 "H1a" <> headerId "h2" 2 "H2" =?>
|
||||
bulletList [plain "H1a" <>
|
||||
bulletList [plain "H1a" <>
|
||||
bulletList [plain $ linkId "toc-h2" "#h2" "" "H2"]]
|
||||
, givesTOC "section id used as backup" $
|
||||
divWith ("sec",["section"],[]) (header 1 "H1") =?>
|
||||
bulletList [plain $ linkId "toc-sec" "#sec" "" "H1"]
|
||||
bulletList [plain $ linkId "toc-sec" "#sec" "" "H1"]
|
||||
]
|
||||
|
||||
testCollapse :: [TestTree]
|
||||
|
||||
@@ -93,4 +93,3 @@ tests = [ testGroup "emphasis"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@@ -119,4 +119,3 @@ main = do
|
||||
fp <- getExecutablePath
|
||||
-- putStrLn $ "Using pandoc executable at " ++ fp
|
||||
defaultMain $ tests fp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user