More.
This commit is contained in:
1 parent
acbe5f1f0d
commit
1e38d03507
5 files changed
+8
-10
No files matched your search
@@ -163,12 +163,12 @@ accentWith :: PandocMonad m
|
||||
accentWith tok combiningAccent fallBack = try $ do
|
||||
ils <- tok
|
||||
case toList ils of
|
||||
[Str " "] -> return $ str $ T.singleton
|
||||
$ fromMaybe combiningAccent fallBack
|
||||
(Str (T.uncons -> Just (x, xs)) : ys) -> return $ fromList $
|
||||
-- try to normalize to the combined character:
|
||||
Str (Normalize.normalize Normalize.NFC
|
||||
(T.pack [x, combiningAccent]) <> xs) : ys
|
||||
[Space] -> return $ str $ T.singleton
|
||||
$ fromMaybe combiningAccent fallBack
|
||||
[] -> return $ str $ T.singleton
|
||||
$ fromMaybe combiningAccent fallBack
|
||||
_ -> return ils
|
||||
|
||||
@@ -200,7 +200,7 @@ addTitle :: Inlines -> Blocks -> Blocks
|
||||
addTitle ils bs =
|
||||
case B.toList bs of
|
||||
(Para xs : rest)
|
||||
-> B.fromList (Para (B.toList ils ++ (Space : xs)) : rest)
|
||||
-> B.fromList (Para (B.toList ils ++ (Str " " : xs)) : rest)
|
||||
_ -> B.para ils <> bs
|
||||
|
||||
addQed :: Blocks -> Blocks
|
||||
|
||||
@@ -393,7 +393,6 @@ parseCodeBlock = try $ do
|
||||
|
||||
getText :: Inline -> T.Text
|
||||
getText (Str s) = s
|
||||
getText Space = " "
|
||||
getText (Code _ s) = s
|
||||
getText SoftBreak = "\n"
|
||||
getText LineBreak = "\n"
|
||||
|
||||
@@ -18,7 +18,6 @@ module Text.Pandoc.Readers.TikiWiki ( readTikiWiki
|
||||
|
||||
import Control.Monad
|
||||
import Control.Monad.Except (throwError)
|
||||
import qualified Data.Foldable as F
|
||||
import Data.List (dropWhileEnd)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Text (Text)
|
||||
@@ -176,9 +175,9 @@ para = fmap (result . mconcat) ( many1Till inline endOfParaElement)
|
||||
endOfInput = try $ skipMany blankline >> skipSpaces >> eof
|
||||
endOfPara = try $ blankline >> skipMany1 blankline
|
||||
newBlockElement = try $ blankline >> skip blockElements
|
||||
result content = if F.all (==Space) content
|
||||
then mempty
|
||||
else B.para $ B.trimInlines content
|
||||
result content = case B.trimInlines content of
|
||||
ils | null ils -> mempty
|
||||
| otherwise -> B.para ils
|
||||
|
||||
-- ;item 1: definition 1
|
||||
-- ;item 2: definition 2-1
|
||||
|
||||
@@ -182,7 +182,7 @@ isDisplayMath (Math DisplayMath _) = True
|
||||
isDisplayMath (Span _ [Math DisplayMath _]) = True
|
||||
isDisplayMath _ = False
|
||||
|
||||
-- | Remove leading and trailing 'Space' and 'SoftBreak' elements.
|
||||
-- | Remove leading and trailing spaces and 'SoftBreak' elements.
|
||||
stripLeadingTrailingSpace :: [Inline] -> [Inline]
|
||||
stripLeadingTrailingSpace = go . reverse . go . reverse
|
||||
where go (Space:xs) = xs
|
||||
@@ -440,7 +440,7 @@ sectionToListItem opts (Div (ident,_,_)
|
||||
addNumber = if T.null num
|
||||
then id
|
||||
else (Span ("",["toc-section-number"],[])
|
||||
[Str num] :) . (Space :)
|
||||
[Str num] :) . (Str " " :)
|
||||
headerText' = addNumber $ walk (deLink . deNote) ils
|
||||
headerLink = if T.null ident
|
||||
then headerText'
|
||||
|
||||
Reference in new issue
Block a user