on master help sign in
Improve HTML generation for records documentation
f5f662cGuglielmo Fachini
src/Idris/IdrisDoc.hs+10−1
@@ -602,9 +602,12 @@ createOtherDoc ist (RecordDoc n doc ctor projs params) = do
602 H.span ! class_ "name type"
602 H.span ! class_ "name type"
603 ! title (toValue $ show n)
603 ! title (toValue $ show n)
604 $ toHtml $ name $ nsroot n
604 $ toHtml $ name $ nsroot n
605− H.span ! class_ "signature" $ nbsp
605+ H.span ! class_ "type" $ do nbsp ; prettyParameters
606 H.dd $ do
606 H.dd $ do
607 (if nullDocstring doc then Empty else Docstrings.renderHtml doc)
607 (if nullDocstring doc then Empty else Docstrings.renderHtml doc)
608+ if not $ null params
609+ then H.dl $ forM_ params genParam
610+ else Empty
608 H.dl ! class_ "decls" $ createFunDoc ist ctor
611 H.dl ! class_ "decls" $ createFunDoc ist ctor
609 H.dl ! class_ "decls" $ forM_ projs (createFunDoc ist)
612 H.dl ! class_ "decls" $ forM_ projs (createFunDoc ist)
610 where name (NS n ns) = show (NS (sUN $ name n) ns)
613 where name (NS n ns) = show (NS (sUN $ name n) ns)
@@ -613,6 +616,12 @@ createOtherDoc ist (RecordDoc n doc ctor projs params) = do
613 then '(':(n' ++ ")")
616 then '(':(n' ++ ")")
614 else n'
617 else n'
615
618
619+ genParam (name, pt, docstring) = do
620+ H.dt $ toHtml $ show (nsroot name)
621+ H.dd $ maybe nbsp Docstrings.renderHtml docstring
622+
623+ prettyParameters = toHtml $ unwords [show $ nsroot n | (n,_,_) <- params]
624+
616createOtherDoc ist (DataDoc fd@(FD n docstring args _ _) fds) = do
625createOtherDoc ist (DataDoc fd@(FD n docstring args _ _) fds) = do
617 H.dt ! (A.id $ toValue $ show n) $ do
626 H.dt ! (A.id $ toValue $ show n) $ do
618 H.span ! class_ "word" $ do "data"; nbsp
627 H.span ! class_ "word" $ do "data"; nbsp