X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter%2FOutline.hs;h=3c66db1d90b6913032d20b30bf8c34a931529a3b;hb=42f51754dea02201aececaacbf194d714cd58aaf;hp=ef9c32058b03de0a69476090f2a7e8df07aa7d7e;hpb=45a315230ec341d3f7a9b80f8004148949a5e2e5;p=Rakka.git diff --git a/Rakka/Wiki/Interpreter/Outline.hs b/Rakka/Wiki/Interpreter/Outline.hs index ef9c320..3c66db1 100644 --- a/Rakka/Wiki/Interpreter/Outline.hs +++ b/Rakka/Wiki/Interpreter/Outline.hs @@ -1,12 +1,14 @@ +{-# LANGUAGE + OverloadedStrings + , UnicodeSyntax + #-} module Rakka.Wiki.Interpreter.Outline ( interpreters ) where - -import Data.Maybe -import Rakka.Wiki -import Rakka.Wiki.Interpreter - +import Data.Maybe +import Rakka.Wiki +import Rakka.Wiki.Interpreter interpreters :: [Interpreter] interpreters = [ outlineInterp ] @@ -27,15 +29,15 @@ mkOutline :: WikiPage -> BlockElement mkOutline tree = fst (mkOutline' emptyOutline 1 headings) where headings :: [BlockElement] - headings = concat (map collectInBlock tree) + headings = concatMap collectInBlock tree collectInBlock :: BlockElement -> [BlockElement] collectInBlock hd@(Heading _ _) = [hd] collectInBlock (Div _ xs) - = concat $ map collectInBlock $ catMaybes (map castToBlock xs) + = concatMap collectInBlock $ catMaybes (map castToBlock xs) collectInBlock (BlockCmd (BlockCommand _ _ xs)) - = concat $ map collectInBlock xs + = concatMap collectInBlock xs collectInBlock _ = [] @@ -82,7 +84,9 @@ mkOutline' soFar level (x:xs) lastItem' = case lastItem of [] -> [Block nested] i:[] -> i ++ [Block nested] + _ -> undefined soFar' = soFar { listItems = nonLastItems ++ [lastItem'] } in mkOutline' soFar' level ys + _ -> undefined \ No newline at end of file