diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-06 11:09:15 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-06 11:17:51 -0800 |
commit | 449910bf407521e04222ee9c64da7c8a253af1dd (patch) | |
tree | 2c3cd6e7c317ed03606324f45920d28dfc8184d9 /src/Text/Pandoc | |
parent | d68b300dca90487e5d0d1dcde3961d8b8a25c18f (diff) | |
download | pandoc-449910bf407521e04222ee9c64da7c8a253af1dd.tar.gz |
filterIpynbOutput - go back to just including one block per format.
In the end we need a 1-1 map of mime types to output blocks.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index efd4fcfde..8aaa362cd 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -104,7 +104,8 @@ import Data.Char (isAlpha, isLower, isSpace, isUpper, toLower, isAlphaNum, generalCategory, GeneralCategory(NonSpacingMark, SpacingCombiningMark, EnclosingMark, ConnectorPunctuation)) import Data.Data (Data, Typeable) -import Data.List (find, intercalate, intersperse, stripPrefix) +import Data.List (find, intercalate, intersperse, stripPrefix, sortBy) +import Data.Ord (comparing) import qualified Data.Map as M import Data.Maybe (mapMaybe) import Data.Sequence (ViewL (..), ViewR (..), viewl, viewr) @@ -113,7 +114,6 @@ import qualified Data.Text as T import Data.Version (showVersion) import Network.URI (URI (uriScheme), escapeURIString, parseURI) import Paths_pandoc (version) -import Safe (minimumDef) import System.Directory import System.FilePath (isPathSeparator, splitDirectories) import qualified System.FilePath.Posix as Posix @@ -684,9 +684,8 @@ filterIpynbOutput mode = walk go | fmt == Format "ipynb" -> Div (ident, ("output":os), kvs) bs | otherwise -> Div (ident, ("output":os), kvs) $ - [ b | b <- bs, rank b == lowestRank ] + take 1 $ sortBy (comparing rank) bs where - lowestRank = minimumDef 0 $ map rank bs rank (RawBlock (Format "html") _) | fmt == Format "html" = (1 :: Int) | fmt == Format "markdown" = 2 |