diff options
| author | John MacFarlane <[email protected]> | 2021-09-27 10:46:23 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2021-09-29 08:37:08 -0700 |
| commit | 11b8f67d16995f23fdbac55b8ec53f3177f4e01f (patch) | |
| tree | d3c18ceb6dddb6d728bc1542f28bd042336622f9 | |
| parent | 1ef55a8cf3d0b94b12eefd11aac44059000afdc6 (diff) | |
More progress.
Temporarily comment out a lot of markdown writer code.
| -rw-r--r-- | src/Text/Pandoc/Citeproc/BibTeX.hs | 18 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 3 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Markdown/Inline.hs | 3 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint/Presentation.hs | 2 |
5 files changed, 19 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs index 5c7bdd9b5..0fafea0ea 100644 --- a/src/Text/Pandoc/Citeproc/BibTeX.hs +++ b/src/Text/Pandoc/Citeproc/BibTeX.hs @@ -524,7 +524,8 @@ itemToReference locale variant item = do -- change numerical series title to e.g. 'series 3' let fixSeriesTitle [Str xs] | isNumber xs = - [Str (ordinalize locale xs), Space, Str (resolveKey' lang "jourser")] + [Str (ordinalize locale xs), Str " ", + Str (resolveKey' lang "jourser")] fixSeriesTitle xs = xs seriesTitle' <- (Just . B.fromList . fixSeriesTitle . B.toList @@ -770,7 +771,7 @@ blocksToInlines bs = adjustSpans :: Lang -> Inline -> Inline adjustSpans lang (Span ("",[],[("bibstring",s)]) _) = Str $ resolveKey' lang s -adjustSpans _ SoftBreak = Space +adjustSpans _ SoftBreak = Str " " adjustSpans _ x = x latex' :: Text -> Bib [Block] @@ -1088,17 +1089,17 @@ getLiteralList' f = do case x' of [Para xs] -> return $ B.fromList - $ intercalate [Str ";", Space] + $ intercalate [Str "; "] $ splitByAnd xs [Plain xs] -> return $ B.fromList - $ intercalate [Str ";", Space] + $ intercalate [Str "; "] $ splitByAnd xs _ -> mzero Nothing -> notFound f splitByAnd :: [Inline] -> [[Inline]] -splitByAnd = splitOn [Space, Str "and", Space] +splitByAnd = splitOn [Str " and "] toLiteralList :: [Block] -> Bib [Inlines] toLiteralList [Para xs] = @@ -1150,7 +1151,7 @@ addSpaceAfterPeriod = go . splitStrWhen (=='.') , isLetter c , isUpper c , isUpper d - = Str (T.singleton c):Str ".":Space:go (Str (T.singleton d):xs) + = Str (T.singleton c):Str ". ":go (Str (T.singleton d):xs) go (x:xs) = x:go xs emptyName :: Name @@ -1188,7 +1189,10 @@ toName _ ils@(Str ys:_) | T.any (== '=') ys = do , nameDroppingParticle = Nothing } addPart ag (Str "suffix" : Str "=" : xs) = ag{ nameSuffix = Just $ stringify xs } - addPart ag (Space : xs) = addPart ag xs + addPart ag (Str t : xs) + = case T.takeWhile (== ' ') t of + t' | T.null t' -> addPart ag xs + | otherwise -> addPart ag (Str (T.dropWhile (== ' ') t) : xs) addPart ag _ = ag return $ foldl' addPart emptyName commaParts -- First von Last diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index baf72aaf8..4af64efc5 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -523,7 +523,7 @@ ttfamily = code . stringify . toList <$> tok processHBox :: Inlines -> Inlines processHBox = walk convert where - convert Space = Str $ T.singleton $ chr 160 -- non-breakable space + convert (Str t) = Str $ T.map (\c -> if c == ' ' then '\160' else c) t convert SoftBreak = Str $ T.singleton $ chr 160 -- non-breakable space convert LineBreak = Str "" convert x = x diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index b188d3fae..fb74e8ad5 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -166,6 +166,8 @@ valToYaml _ = empty -- | Return markdown representation of document. pandocToMarkdown :: PandocMonad m => WriterOptions -> Pandoc -> MD m Text pandocToMarkdown opts (Pandoc meta blocks) = do + undefined +{- let colwidth = if writerWrapText opts == WrapAuto then Just $ writerColumns opts else Nothing @@ -827,3 +829,4 @@ startsWithSpace (Str t : _) = _ -> False startsWithSpace (SoftBreak : _) = True startsWithSpace _ = False +-} diff --git a/src/Text/Pandoc/Writers/Markdown/Inline.hs b/src/Text/Pandoc/Writers/Markdown/Inline.hs index 72525d226..d1c6694b9 100644 --- a/src/Text/Pandoc/Writers/Markdown/Inline.hs +++ b/src/Text/Pandoc/Writers/Markdown/Inline.hs @@ -193,6 +193,8 @@ getReference attr label target = do -- | Convert list of Pandoc inline elements to markdown. inlineListToMarkdown :: PandocMonad m => WriterOptions -> [Inline] -> MD m (Doc Text) inlineListToMarkdown opts lst = do + undefined +{- inlist <- asks envInList go (if inlist then avoidBadWrapsInList lst else lst) where go [] = return empty @@ -616,3 +618,4 @@ toSuperscriptInline (Str s) = Str . T.pack <$> traverse toSuperscript (T.unpack toSuperscriptInline LineBreak = Just LineBreak toSuperscriptInline SoftBreak = Just SoftBreak toSuperscriptInline _ = Nothing +-} diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs index a9f5f3db2..f59e0f475 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs @@ -830,7 +830,7 @@ makeNoteEntry (n, blks) = let enum = Str (tshow n <> ".") in case blks of - (Para ils : blks') -> Para (enum : Space : ils) : blks' + (Para ils : blks') -> Para (enum : Str " " : ils) : blks' _ -> Para [enum] : blks forceFontSize :: Pixels -> Pres a -> Pres a |
