on master help sign in
[ docs ] definitions in the same order as in the source file

I got annoyed with the fact that docs were listing definitions in reverse order with respect to the source file. This mean that they were presenting traversals before the type they are working on has been introduced. This fixes that problem.

commitf07ebbf269348c306d588956096dfe67fba6508c authorGuillaume Allais <guillaume.allais@ens-lyon.org> dateWed 12 Sep 2018, 12:36 (8 years ago) parent80293ba
1 file changed+5−6
src/Idris/IdrisDoc.hs+5−6
src/Idris/IdrisDoc.hs+5−6
@@ -427,13 +427,12 @@ createNsDoc :: IState -- ^ Needed to determine the types of names
427427 -- documentation will be written.
428428 -> IO ()
429429createNsDoc ist ns content out =
430− do let tpath = out </> "docs" </> (genRelNsPath ns "html")
431− dir = takeDirectory tpath
432− file = takeFileName tpath
433− haveDocs (_, Just d, _) = [d]
434− haveDocs _ = []
430+ do let tpath = out </> "docs" </> (genRelNsPath ns "html")
431+ dir = takeDirectory tpath
432+ file = takeFileName tpath
433+ haveDocs (_, md, _) = md
435434 -- We cannot do anything without a Doc
436− content' = concatMap haveDocs (nsContents content)
435+ content' = reverse $ mapMaybe haveDocs $ nsContents content
437436 createDirectoryIfMissing True dir
438437 (path, h) <- openTempFileWithDefaultPermissions dir file
439438 BS2.hPut h $ renderHtml $ wrapper (Just ns) $ do