diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2024-01-04 16:45:02 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2024-01-04 16:45:02 -0700 |
| commit | 5cff32c5758a4c2842edaf972dece41e8bb77737 (patch) | |
| tree | 5dab9859e1446f9ac7675aac1698fe78f90165b9 /src | |
| parent | 59e28b82b66c80f69ec8f6674dbf25fa9b2a488f (diff) | |
OPML writer: respect `--wrap` options & `--columns` in contents of notes.
Closes #9297.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/OPML.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/OPML.hs b/src/Text/Pandoc/Writers/OPML.hs index ab8c36c4f..4ee955a2c 100644 --- a/src/Text/Pandoc/Writers/OPML.hs +++ b/src/Text/Pandoc/Writers/OPML.hs @@ -35,9 +35,9 @@ writeOPML opts (Pandoc meta blocks) = do else Nothing meta' = B.setMeta "date" (B.str $ convertDate $ docDate meta) meta metadata <- metaToContext opts - (fmap literal . writeMarkdown def . Pandoc nullMeta) + (fmap literal . writeMarkdown' opts . Pandoc nullMeta) (\ils -> literal . T.stripEnd <$> - writeMarkdown def (Pandoc nullMeta [Plain ils])) + writeMarkdown' opts (Pandoc nullMeta [Plain ils])) meta' let blocks' = makeSections False (Just 1) blocks main <- render colwidth . vcat <$> @@ -49,6 +49,11 @@ writeOPML opts (Pandoc meta blocks) = do Nothing -> main Just tpl -> render colwidth $ renderTemplate tpl context +writeMarkdown' :: PandocMonad m => WriterOptions -> Pandoc -> m Text +writeMarkdown' opts = writeMarkdown def{ writerWrapText = writerWrapText opts + , writerColumns = writerColumns opts + , writerExtensions = pandocExtensions + } writeHtmlInlines :: PandocMonad m => [Inline] -> m Text writeHtmlInlines ils = @@ -71,7 +76,7 @@ blockToOPML opts (Div (_,"section":_,_) (Header _ _ title : xs)) = do htmlIls <- writeHtmlInlines title md <- if null blocks then return mempty - else writeMarkdown def $ Pandoc nullMeta blocks + else writeMarkdown' opts $ Pandoc nullMeta blocks let attrs = ("text", htmlIls) : [("_note", T.stripEnd md) | not (null blocks)] rest' <- vcat <$> mapM (blockToOPML opts) rest |
