Skip to content

Commit

Permalink
Clean up modules styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew committed Feb 4, 2019
1 parent eba46ae commit bf9545a
Showing 1 changed file with 96 additions and 90 deletions.
186 changes: 96 additions & 90 deletions Content/Library/docsSrc/templates/modules.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,112 +30,118 @@ let generateModuleDocs (moduleInfo : ModuleInfo) (props) =
let nestModules = moduleInfo.Module.NestedModules
let nestTypes = moduleInfo.Module.NestedTypes
[
yield h1 [] [
str moduleInfo.Module.Name
]
yield p [] [
if moduleInfo.Module.IsObsolete then
yield div [
Class "alert alert-warning"
] [
strong [] [
str "WARNING: "
]

str " This API is obsolete"

p [] [
str moduleInfo.Module.ObsoleteMessage
yield div [ Class "container-fluid py-3" ] [
yield div [ Class "row" ] [
yield div [ Class "col-12" ] [
yield h1 [] [
str moduleInfo.Module.Name
]
]
yield span [] [
str (sprintf "Namespace: %s" moduleInfo.Namespace.Name)
]
yield br []
if moduleInfo.ParentModule.IsSome then
yield
span [] [
str "Parent Module: "

a [
Href (sprintf "%s.html" moduleInfo.ParentModule.Value.UrlName)
if moduleInfo.Module.IsObsolete then
yield div [
Class "alert alert-warning"
] [
str moduleInfo.ParentModule.Value.Name
strong [] [
str "WARNING: "
]
str " This API is obsolete"
p [ Class "mb-0"] [
str moduleInfo.Module.ObsoleteMessage
]
]
yield dl [] [
yield dt [] [
str "Namespace"
]
yield dd [] [
str moduleInfo.Namespace.Name
]
if moduleInfo.ParentModule.IsSome then
yield dt [] [
str "Parent Module"
]
yield dd [] [
a [
Href (sprintf "%s.html" moduleInfo.ParentModule.Value.UrlName)
] [
str moduleInfo.ParentModule.Value.Name
]
]
if moduleInfo.Module.Attributes |> Seq.isEmpty |> not then
yield dt [] [
str "Attributes"
]
yield dd [] [
for attr in moduleInfo.Module.Attributes do
yield str (attr.Format())
yield br []
]
]
if moduleInfo.Module.Attributes |> Seq.isEmpty |> not then
yield
span [] [
yield str "Attributes:"
yield br []
for attr in moduleInfo.Module.Attributes do
yield str (attr.Format())
yield br []

yield div [
Class "xmldoc"
] [
for sec in comment.Sections do
if byCategory |> Seq.exists (fun g -> g.GroupKey = sec.Key) |> not then
if sec.Key <> "<default>" then
yield h2 [] [
RawText sec.Key
]
yield RawText sec.Value
]
]

yield div [
Class "xmldoc"
] [
for sec in comment.Sections do
if byCategory |> Seq.exists (fun g -> g.GroupKey = sec.Key) |> not then
if sec.Key <> "<default>" then

if byCategory |> Seq.length > 1 then
yield h2 [] [
RawText sec.Key
str "Table of contents"
]
yield RawText sec.Value
]


if byCategory |> Seq.length > 1 then
yield h2 [] [
str "Table of contents"
]
yield ul [] [
for g in byCategory do
yield li [] [
a [
Href (g.Index.ToString() |> sprintf "#section%s")
] [
str g.Name
]
]
]

yield ul [] [
for g in byCategory do
yield li [] [
a [
Href (g.Index.ToString() |> sprintf "#section%s")
] [
str g.Name
if (nestTypes |> Seq.length) + (nestModules |> Seq.length) > 0 then
yield h2 [] [
str "Nested types and modules"
]
]
]

if (nestTypes |> Seq.length) + (nestModules |> Seq.length) > 0 then
yield h2 [] [
str "Nexted types and modules"
]
yield! (partNested (nestTypes |> Seq.toArray) (nestModules |> Seq.toArray))

yield div [] (partNested (nestTypes |> Seq.toArray) (nestModules |> Seq.toArray))
for g in byCategory do
if byCategory |> Seq.length > 1 then
yield h2 [] [
str g.Name
a [
Name (sprintf "section%d" g.Index)
] [
str "&#160;"
]
]

for g in byCategory do
if byCategory |> Seq.length > 1 then
yield h2 [] [
str g.Name
a [
Name (sprintf "section%d" g.Index)
] [
str "&#160;"
]
]
let info = comment.Sections |> Seq.tryFind(fun kvp -> kvp.Key = g.GroupKey)

let info = comment.Sections |> Seq.tryFind(fun kvp -> kvp.Key = g.GroupKey)

match info with
| Some info ->
yield div [
Class "xmldoc"
] [
str info.Value
]
| None ->
yield nothing
match info with
| Some info ->
yield div [
Class "xmldoc"
] [
str info.Value
]
| None ->
yield nothing

yield! partMembers "Functions and values" "Function or value" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.ValueOrFunction))
yield! partMembers "Functions and values" "Function or value" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.ValueOrFunction))

yield! partMembers "Type extensions" "Type extension" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.TypeExtension))
yield! partMembers "Type extensions" "Type extension" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.TypeExtension))

yield! partMembers "Active patterns" "Active pattern" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.ActivePattern))
yield! partMembers "Active patterns" "Active pattern" (g.Members |> Seq.filter(fun m -> m.Kind = MemberKind.ActivePattern))
]
]
]
]

0 comments on commit bf9545a

Please sign in to comment.