We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit c685684f authored by Camil Staps's avatar Camil Staps 🚀

Also index generics

parent 219003ed
Pipeline #14650 failed with stage
in 54 seconds
......@@ -81,6 +81,10 @@ body, html {
color: #5998c2;
content: '\2192'; /* -> */
}
.icon-generic:before {
color: #602a9e;
content: '\21d2';
}
.icon-typedef:before {
color: #e3890b;
content: '\2e2a'; /* :: */
......@@ -98,7 +102,7 @@ body, html {
border-color: black;
border-radius: 2px;
border-style: solid;
border-width: 0 0 0 1px;
border-width: 0 0 0 2px;
cursor: pointer;
font-family: monospace;
padding: .5em;
......@@ -114,6 +118,9 @@ body, html {
.collapsable-head-function {
border-color: #5998c2;
}
.collapsable-head-generic {
border-color: #602a9e;
}
.collapsable-head-typedef {
border-color: #e3890b;
}
......
......@@ -24,6 +24,7 @@ instance < (Described e d)
:: ModuleDescription =
{ mod_type_defs :: ![DescribedTypeDef]
, mod_classes :: ![DescribedClass]
, mod_generics :: ![DescribedGeneric]
, mod_functions :: ![DescribedFunction]
}
......@@ -35,6 +36,9 @@ instance < (Described e d)
{ class_members :: ![DescribedFunction]
}
:: DescribedGeneric :== Described GenericDescription FunctionDoc
:: GenericDescription = GenericDescription
:: DescribedFunction :== Described FunctionDescription FunctionDoc
:: FunctionDescription = FunctionDescription
......
......@@ -18,10 +18,11 @@ import Data.Maybe
from syntax import
:: ClassDef{class_ident},
:: FunSpecials,
:: GenericDef{gen_ident},
:: Ident{id_name},
:: Module{mod_defs,mod_ident},
:: Optional,
:: ParsedDefinition(PD_Class,PD_Type,PD_TypeSpec),
:: ParsedDefinition(PD_Class,PD_Generic,PD_Type,PD_TypeSpec),
:: ParsedTypeDef,
:: Priority,
:: RhsDefsOfType,
......@@ -49,6 +50,7 @@ collectModule mfo fp w
, elem =
{ mod_type_defs = [collectTypeDef doc pd \\ pd=:(PD_Type _) <- dcldefs]
, mod_classes = [collectClass doc pd \\ pd=:(PD_Class _ _) <- dcldefs]
, mod_generics = [collectGeneric doc pd \\ pd=:(PD_Generic _) <- dcldefs]
, mod_functions = [collectFunction doc pd \\ pd=:(PD_TypeSpec _ _ _ _ _) <- dcldefs]
}
, doc = moddoc
......@@ -77,6 +79,16 @@ where
_ -> Nothing
}
collectGeneric :: !CollectedComments !ParsedDefinition -> DescribedGeneric
collectGeneric cc pd=:(PD_Generic gd) =
{ name = gd.gen_ident.id_name
, repr = Just (cpp pd)
, elem = GenericDescription
, doc = case parseDoc <$> getComment pd cc of
Just (Right (doc,_)) -> Just doc
_ -> Nothing
}
collectFunction :: !CollectedComments !ParsedDefinition -> DescribedFunction
collectFunction cc pd=:(PD_TypeSpec _ id _ _ _) =
{ name = id.id_name
......
......@@ -83,8 +83,9 @@ where
, DivTag [ClassAttr "clean-doc"] <$> pure <$> Text <$> (docDescription =<< m.doc)
, Just $ DivTag [IdAttr "type_defs"] typedefs
, Just $ DivTag [IdAttr "classes"] classes
, Just $ DivTag [IdAttr "macros"] macros
, Just $ DivTag [IdAttr "generics"] generics
, Just $ DivTag [IdAttr "functions"] functions
, Just $ DivTag [IdAttr "macros"] macros
]
typedefs = if (isEmpty m.elem.mod_type_defs) []
......@@ -107,7 +108,15 @@ where
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust dc.repr)]
]
macros = []
generics = if (isEmpty m.elem.mod_generics) []
[ H1Tag [] [Text "Generics"]
: map html (sort m.elem.mod_generics)
]
where
html dg = collapsable "generic" ("gen-" +++ dg.name) dg.name $ catMaybes
[ DivTag [ClassAttr "clean-doc"] <$> pure <$> Text <$> (docDescription =<< dg.doc)
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust dg.repr)]
]
functions = if (isEmpty m.elem.mod_functions) []
[ H1Tag [] [Text "Functions"]
......@@ -119,6 +128,8 @@ where
, Just $ PreTag [ClassAttr "clean-code"] [Html (fromJust df.repr)]
]
macros = []
collapsable :: !String !String !String !a -> HtmlTag | html a
collapsable icon id title body = DivTag
[ ClassAttr "collapsable"
......
......@@ -18,6 +18,7 @@ from Clean.Doc.ModuleCollection import :: Described, :: ModuleDescription,
= IIK_Module
| IIK_TypeDef
| IIK_Class
| IIK_Generic
| IIK_Function
derive JSONEncode IndexItem
......
......@@ -18,6 +18,7 @@ JSONEncode{|IndexItemKind|} _ iik = [JSONString case iik of
IIK_Module -> "module"
IIK_TypeDef -> "typedef"
IIK_Class -> "class"
IIK_Generic -> "generic"
IIK_Function -> "function"]
JSONEncode{|IndexItem|} _ ii = [JSONObject $ catMaybes
......@@ -31,15 +32,9 @@ where
IIK_Module -> "mod"
IIK_TypeDef -> "td"
IIK_Class -> "class"
IIK_Generic -> "gen"
IIK_Function -> "fun"
class kind a :: a -> IndexItemKind
instance kind ModuleDescription where kind _ = IIK_Module
instance kind TypeDefDescription where kind _ = IIK_TypeDef
instance kind ClassDescription where kind _ = IIK_Class
instance kind FunctionDescription where kind _ = IIK_Function
indexModuleCollection :: ModuleCollection -> [IndexItem]
indexModuleCollection mcoll = concatMap indexModule mcoll
......@@ -52,6 +47,7 @@ indexModule mod =
}
: map indexTypeDef mod.elem.mod_type_defs ++
map indexClass mod.elem.mod_classes ++
map indexGeneric mod.elem.mod_generics ++
map indexFunction mod.elem.mod_functions
]
where
......@@ -65,4 +61,5 @@ where
indexTypeDef dtd = {index dtd & kind=IIK_TypeDef}
indexClass dc = {index dc & kind=IIK_Class}
indexGeneric dg = {index dg & kind=IIK_Generic}
indexFunction df = {index df & kind=IIK_Function}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment