diff --git a/src/Nirum/Targets/Docs.hs b/src/Nirum/Targets/Docs.hs index 2d6eb6e..5921bd2 100644 --- a/src/Nirum/Targets/Docs.hs +++ b/src/Nirum/Targets/Docs.hs @@ -143,10 +143,7 @@ blockToHtml b = preEscapedToMarkup $ render b typeDecl :: BoundModule Docs -> Identifier -> TD.TypeDeclaration -> Html typeDecl mod' ident tc@TD.TypeDeclaration { TD.type' = TD.Alias cname } = [shamlet| -

- type - #{toNormalizedText ident} - = +

type #{toNormalizedText ident} = # #{typeExpression mod' cname} $maybe d <- docsBlock tc #{blockToHtml d} @@ -154,39 +151,35 @@ typeDecl mod' ident typeDecl mod' ident tc@TD.TypeDeclaration { TD.type' = TD.UnboxedType innerType } = [shamlet| -

- unboxed - #{toNormalizedText ident} (#{typeExpression mod' innerType}) +

unboxed #{toNormalizedText ident} + (#{typeExpression mod' innerType}) $maybe d <- docsBlock tc #{blockToHtml d} |] typeDecl _ ident tc@TD.TypeDeclaration { TD.type' = TD.EnumType members } = [shamlet| -

- enum - #{toNormalizedText ident} +

enum #{toNormalizedText ident} $maybe d <- docsBlock tc #{blockToHtml d}
$forall decl <- DES.toList members -
#{nameText $ DE.name decl} -
- $maybe d <- docsBlock decl - #{blockToHtml d} +
#{nameText $ DE.name decl} +
+ $maybe d <- docsBlock decl + #{blockToHtml d} |] typeDecl mod' ident tc@TD.TypeDeclaration { TD.type' = TD.RecordType fields } = [shamlet| -

- record - #{toNormalizedText ident} +

record #{toNormalizedText ident} $maybe d <- docsBlock tc #{blockToHtml d} - $forall fieldDecl@(TD.Field _ fieldType _) <- DES.toList fields -

- #{typeExpression mod' fieldType} - #{nameText $ DE.name fieldDecl} - $maybe d <- docsBlock fieldDecl - #{blockToHtml d} + + $forall fieldDecl@(TD.Field _ fieldType _) <- DES.toList fields +
+ #{typeExpression mod' fieldType} + #{nameText $ DE.name fieldDecl} + $maybe d <- docsBlock fieldDecl +
#{blockToHtml d} |] typeDecl mod' ident tc@TD.TypeDeclaration { TD.type' = TD.UnionType tags } = [shamlet| @@ -211,33 +204,33 @@ typeDecl _ ident typeDecl mod' ident tc@TD.ServiceDeclaration { TD.service = S.Service methods } = [shamlet| -

service #{toNormalizedText ident} +

service #{toNormalizedText ident} $maybe d <- docsBlock tc #{blockToHtml d} $forall md@(S.Method _ ps ret err _) <- DES.toList methods -

- #{nameText $ DE.name md}( - $forall (i, pd@(S.Parameter _ pt _)) <- enumerateParams ps - $if i > 0 - , # - #{typeExpression mod' pt} # - #{nameText $ DE.name pd}# - ) + #{nameText $ DE.name md} ( + $forall (i, pd@(S.Parameter _ pt _)) <- enumerateParams ps + $if i > 0 + , # + #{typeExpression mod' pt} # + #{nameText $ DE.name pd}# + ) $maybe d <- docsBlock md #{blockToHtml d} -
+ + $forall paramDecl@(S.Parameter _ paramType _) <- DES.toList ps + $maybe d <- docsBlock paramDecl +
+ #{typeExpression mod' paramType} + #{nameText $ DE.name paramDecl}: +
#{blockToHtml d} + $maybe retType <- ret -
returns: -
#{typeExpression mod' retType} + returns: + #{typeExpression mod' retType} $maybe errType <- err -
raises: -
#{typeExpression mod' errType} - $forall paramDecl@(S.Parameter _ paramType _) <- DES.toList ps - $maybe d <- docsBlock paramDecl -

- #{typeExpression mod' paramType} - #{nameText $ DE.name paramDecl}: - #{blockToHtml d} + raises: + #{typeExpression mod' errType} |] where enumerate :: [a] -> [(Int, a)] @@ -307,9 +300,7 @@ moduleTitle Module { docs = docs' } = do stylesheet :: TL.Text stylesheet = renderCss ([cassius| -@import url( -https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400|Source+Sans+Pro -) +@import url("https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400|Source+Sans+Pro") body font-family: Source Sans Pro color: #{gray8} @@ -326,8 +317,11 @@ div border-top: 1px solid #{gray3} h1, h2, h3, h4, h5, h6 code - font-weight: 400 background-color: #{gray3} +h1, h2, h3, h4, h5, h6, dt + font-weight: bold + code + font-weight: 400 a text-decoration: none a:link @@ -336,6 +330,9 @@ a:visited color: #{graph8} a:hover text-decoration: underline +dd + p + margin-top: 0 |] undefined) where -- from Open Color https://yeun.github.io/open-color/