diff options
author | Vlad Hanciuta <wladsh@gmail.com> | 2020-04-07 00:41:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-06 16:41:28 -0700 |
commit | 8dbd4938f29aceb079316c9215b515744543b4d5 (patch) | |
tree | af0a78336d8151bb6c17ebfa4ae5f57a8ac3de6c /src/Text | |
parent | 663a5a9b7f36e38a7a13847112fa7ef426dca29c (diff) | |
download | pandoc-8dbd4938f29aceb079316c9215b515744543b4d5.tar.gz |
Vimwiki reader: Add nested syntax highlighting (#6257)
Nested syntaxes are specified like this:
{{{sql
SELECT * FROM table
}}}
The preformatted code block parser has been extended to check if the
first attribute of the block is not a `key=value` pair, and in that case
it will be considered as a class.
Closes #6256.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Vimwiki.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Vimwiki.hs b/src/Text/Pandoc/Readers/Vimwiki.hs index f3551b278..74dac5ea7 100644 --- a/src/Text/Pandoc/Readers/Vimwiki.hs +++ b/src/Text/Pandoc/Readers/Vimwiki.hs @@ -236,7 +236,11 @@ preformatted = try $ do makeAttr :: Text -> Attr makeAttr s = let xs = splitTextBy (`elem` (" \t" :: String)) s in - ("", [], mapMaybe nameValue xs) + ("", syntax xs, mapMaybe nameValue xs) + +syntax :: [Text] -> [Text] +syntax (s:_) | not $ T.isInfixOf "=" s = [s] +syntax _ = [] nameValue :: Text -> Maybe (Text, Text) nameValue s = |