-
Notifications
You must be signed in to change notification settings - Fork 158
/
GenerateHtml.fs
730 lines (605 loc) · 32.8 KB
/
GenerateHtml.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
module internal FSharp.Formatting.ApiDocs.GenerateHtml
open System
open System.Collections.Generic
open System.IO
open System.Web
open FSharp.Formatting.Common
open FSharp.Compiler.Symbols
open FSharp.Formatting.Templating
open FSharp.Formatting.HtmlModel
open FSharp.Formatting.HtmlModel.Html
/// Embed some HTML generated in GenerateModel
let embed (x: ApiDocHtml) = !!x.HtmlText
let fsdocsSummary (x: ApiDocHtml) =
// the <pre> tag is not allowed inside a <p> tag.
if x.HtmlText.StartsWith("<pre>", StringComparison.Ordinal) then
embed x
else
p [ Class "fsdocs-summary" ] [ embed x ]
type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
let root = model.Root
let collectionName = model.Collection.CollectionName
let qualify = model.Qualify
//let obsoleteMessage msg =
// div [Class "alert alert-warning"] [
// strong [] [!!"NOTE:"]
// p [] [!! ("This API is obsolete" + HttpUtility.HtmlEncode(msg))]
// ]
let mutable uniqueNumber = 0
let UniqueID () =
uniqueNumber <- uniqueNumber + 1
uniqueNumber
let codeWithToolTip content tip =
div [] [
let id = UniqueID().ToString()
code
[ OnMouseOut(sprintf "hideTip(event, '%s', %s)" id id)
OnMouseOver(sprintf "showTip(event, '%s', %s)" id id) ]
content
div [ Class "fsdocs-tip"; Id id ] tip
]
let sourceLink url =
[ match url with
| None -> ()
| Some href ->
a [ Href href; Class "fsdocs-source-link"; HtmlProperties.Title "Source on GitHub" ] [
iconifyIcon [ Icon "ri:github-fill"; Height "24"; Width "24" ]
] ]
let removeParen (memberName: string) =
let firstParen = memberName.IndexOf('(')
if firstParen > 0 then
memberName.Substring(0, firstParen)
else
memberName
// Copy XML sig for use in `cref` XML
let copyXmlSigIcon xmlDocSig =
div [
Class "fsdocs-source-link"
HtmlProperties.Title "Copy signature (XML)"
OnClick(sprintf "Clipboard_CopyTo('<see cref=\\\'%s\\\'/>')" xmlDocSig)
] [ iconifyIcon [ HtmlProperties.Icon "bi:filetype-xml"; Height "24"; Width "24" ] ]
let copyXmlSigIconForSymbol (symbol: FSharpSymbol) =
[ match symbol with
| :? FSharpMemberOrFunctionOrValue as v -> copyXmlSigIcon (removeParen v.XmlDocSig)
| :? FSharpEntity as v -> copyXmlSigIcon (removeParen v.XmlDocSig)
| _ -> () ]
// Copy XML sig for use in `cref` markdown
let copyXmlSigIconMarkdown (xmlDocSig: string) =
if xmlDocSig.StartsWith('`') || xmlDocSig.EndsWith('`') then
div [] []
else
let delim =
if xmlDocSig.Contains("``") then "```"
elif xmlDocSig.Contains("`") then "``"
else "`"
div [
Class "fsdocs-source-link"
HtmlProperties.Title "Copy signature (Markdown)"
OnClick(sprintf "Clipboard_CopyTo('%scref:%s%s')" delim xmlDocSig delim)
] [ iconifyIcon [ HtmlProperties.Icon "bi:filetype-md"; Height "24"; Width "24" ] ]
let copyXmlSigIconForSymbolMarkdown (symbol: FSharpSymbol) =
[ match symbol with
| :? FSharpMemberOrFunctionOrValue as v -> copyXmlSigIconMarkdown (removeParen v.XmlDocSig)
| :? FSharpEntity as v -> copyXmlSigIconMarkdown (removeParen v.XmlDocSig)
| _ -> () ]
let renderMembers header tableHeader (members: ApiDocMember list) =
[ if members.Length > 0 then
h3 [] [ !!header ]
table [ Class "table outer-list fsdocs-member-list" ] [
thead [] [
tr [] [
td [ Class "fsdocs-member-list-header" ] [ !!tableHeader ]
td [ Class "fsdocs-member-list-header" ] [ !! "Description" ]
]
]
tbody [] [
for m in members do
tr [] [
td [ Class "fsdocs-member-usage" ] [
codeWithToolTip [
// This adds #MemberName anchor. These may be ambiguous due to overloading
p [] [ a [ Id m.Name ] [ a [ Href("#" + m.Name) ] [ embed m.UsageHtml ] ] ]
] [
div [ Class "member-tooltip" ] [
!! "Full Usage: "
embed m.UsageHtml
br []
br []
if not m.Parameters.IsEmpty then
!! "Parameters: "
ul [] [
for p in m.Parameters do
span [] [
b [] [ !!p.ParameterNameText ]
!! ":"
embed p.ParameterType
match p.ParameterDocs with
| None -> ()
| Some d ->
!! " - "
embed d
]
br []
]
br []
match m.ReturnInfo.ReturnType with
| None -> ()
| Some(_, rty) ->
span [] [
!!(if m.Kind <> ApiDocMemberKind.RecordField then
"Returns: "
else
"Field type: ")
embed rty
]
match m.ReturnInfo.ReturnDocs with
| None -> ()
| Some d -> embed d
br []
//!! "Signature: "
//encode(m.SignatureTooltip)
if not m.Modifiers.IsEmpty then
!! "Modifiers: "
encode (m.FormatModifiers)
br []
// We suppress the display of ill-formatted type parameters for places
// where these have not been explicitly declared
match m.FormatTypeArguments with
| None -> ()
| Some v ->
!! "Type parameters: "
encode (v)
]
]
]
let smry =
div [ Class "fsdocs-summary" ] [
yield! copyXmlSigIconForSymbolMarkdown m.Symbol
yield! copyXmlSigIconForSymbol m.Symbol
yield! sourceLink m.SourceLocation
fsdocsSummary m.Comment.Summary
]
let dtls =
[ match m.Comment.Remarks with
| Some r -> p [ Class "fsdocs-remarks" ] [ embed r ]
| None -> ()
match m.ExtendedType with
| Some(_, extendedTypeHtml) -> p [] [ !! "Extended Type: "; embed extendedTypeHtml ]
| _ -> ()
if not m.Parameters.IsEmpty then
dl [ Class "fsdocs-params" ] [
for parameter in m.Parameters do
dt [ Class "fsdocs-param" ] [
span [ Class "fsdocs-param-name" ] [ !!parameter.ParameterNameText ]
!! ":"
embed parameter.ParameterType
]
dd [ Class "fsdocs-param-docs" ] [
match parameter.ParameterDocs with
| None -> ()
| Some d -> p [] [ embed d ]
]
]
match m.ReturnInfo.ReturnType with
| None -> ()
| Some(_, returnTypeHtml) ->
dl [ Class "fsdocs-returns" ] [
dt [] [
span [ Class "fsdocs-return-name" ] [
!!(if m.Kind <> ApiDocMemberKind.RecordField then
"Returns: "
else
"Field type: ")
]
embed returnTypeHtml
]
dd [ Class "fsdocs-return-docs" ] [
match m.ReturnInfo.ReturnDocs with
| None -> ()
| Some r -> p [] [ embed r ]
]
]
if not m.Comment.Exceptions.IsEmpty then
//p [] [ !! "Exceptions:" ]
table [ Class "fsdocs-exception-list" ] [
for (nm, link, html) in m.Comment.Exceptions do
tr [] [
td
[]
(match link with
| None -> []
| Some href -> [ a [ Href href ] [ !!nm ] ])
td [] [ embed html ]
]
]
for e in m.Comment.Notes do
h5 [ Class "fsdocs-note-header" ] [ !! "Note" ]
p [ Class "fsdocs-note" ] [ embed e ]
for e in m.Comment.Examples do
h5 [ Class "fsdocs-example-header" ] [ !! "Example" ]
p [
yield Class "fsdocs-example"
match e.Id with
| None -> ()
| Some id -> yield Id id
] [ embed e ]
//if m.IsObsolete then
// obsoleteMessage m.ObsoleteMessage
//if not (String.IsNullOrEmpty(m.Details.FormatCompiledName)) then
// p [] [!!"CompiledName: "; code [] [!!m.Details.FormatCompiledName]]
]
td [ Class "fsdocs-member-xmldoc" ] [
if List.isEmpty dtls then
smry
elif String.IsNullOrWhiteSpace(m.Comment.Summary.HtmlText) then
yield! dtls
else
details [] ((summary [] [ smry ]) :: dtls)
]
]
]
] ]
let renderEntities (entities: ApiDocEntity list) =
[ if entities.Length > 0 then
let hasTypes = entities |> List.exists (fun e -> e.IsTypeDefinition)
let hasModules = entities |> List.exists (fun e -> not e.IsTypeDefinition)
table [ Class "table outer-list fsdocs-entity-list" ] [
thead [] [
tr [] [
td [] [
!!(if hasTypes && hasModules then "Type/Module"
elif hasTypes then "Type"
else "Modules")
]
td [] [ !! "Description" ]
]
]
tbody [] [
for e in entities do
tr [] [
td [ Class "fsdocs-entity-name" ] [
let nm = e.Name
let multi = (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1
let nmWithSiffix =
if multi then
(if e.IsTypeDefinition then
nm + " (Type)"
else
nm + " (Module)")
else
nm
// This adds #EntityName anchor. These may currently be ambiguous
p [] [
a [ Name nm ] [
a [ Href(e.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [
!!nmWithSiffix
]
]
]
]
td [ Class "fsdocs-entity-xmldoc" ] [
div [] [
yield! copyXmlSigIconForSymbolMarkdown e.Symbol
yield! copyXmlSigIconForSymbol e.Symbol
yield! sourceLink e.SourceLocation
fsdocsSummary e.Comment.Summary
]
]
]
]
] ]
let entityContent (info: ApiDocEntityInfo) =
// Get all the members & comment for the type
let entity = info.Entity
let members = entity.AllMembers |> List.filter (fun e -> not e.IsObsolete)
let byCategory = members |> Categorise.getMembersByCategory
let usageName =
match info.ParentModule with
| Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name
| _ -> entity.Name
[ h2 [] [ !!(usageName + (if entity.IsTypeDefinition then " Type" else " Module")) ]
dl [ Class "fsdocs-metadata" ] [
dt [] [
!! "Namespace: "
a [ Href(info.Namespace.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [
!!info.Namespace.Name
]
]
dt [] [ !!("Assembly: " + entity.Assembly.Name + ".dll") ]
match info.ParentModule with
| None -> ()
| Some parentModule ->
dt [] [
!! "Parent Module: "
a [ Href(parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl)) ] [
!!parentModule.Name
]
]
match entity.AbbreviatedType with
| Some(_, abbreviatedTypHtml) -> dt [] [ !! "Abbreviation For: "; embed abbreviatedTypHtml ]
| None -> ()
match entity.BaseType with
| Some(_, baseTypeHtml) -> dt [] [ !! "Base Type: "; embed baseTypeHtml ]
| None -> ()
match entity.AllInterfaces with
| [] -> ()
| l ->
dt [] [
!!("All Interfaces: ")
for (i, (_, ityHtml)) in Seq.indexed l do
if i <> 0 then
!! ", "
embed ityHtml
]
if entity.Symbol.IsValueType then
dt [] [ !!("Kind: Struct") ]
match entity.DelegateSignature with
| Some(_, delegateSigHtml) -> dt [] [ !!("Delegate Signature: "); embed delegateSigHtml ]
| None -> ()
if entity.Symbol.IsProvided then
dt [] [ !!("This is a provided type definition") ]
if entity.Symbol.IsAttributeType then
dt [] [ !!("This is an attribute type definition") ]
if entity.Symbol.IsEnum then
dt [] [ !!("This is an enum type definition") ]
//if info.Entity.IsObsolete then
// obsoleteMessage entity.ObsoleteMessage
]
// Show the summary (and sectioned docs without any members)
div [ Class "fsdocs-xmldoc" ] [
div [] [
//yield! copyXmlSigIconForSymbol entity.Symbol
//yield! sourceLink entity.SourceLocation
fsdocsSummary entity.Comment.Summary
]
// Show the remarks etc.
match entity.Comment.Remarks with
| Some r -> p [ Class "fsdocs-remarks" ] [ embed r ]
| None -> ()
for note in entity.Comment.Notes do
h5 [ Class "fsdocs-note-header" ] [ !! "Note" ]
p [ Class "fsdocs-note" ] [ embed note ]
for example in entity.Comment.Examples do
h5 [ Class "fsdocs-example-header" ] [ !! "Example" ]
p [ Class "fsdocs-example" ] [ embed example ]
]
if (byCategory.Length > 1) then
// If there is more than 1 category in the type, generate TOC
h3 [] [ !! "Table of contents" ]
ul [] [
for (index, _, name) in byCategory do
li [] [ a [ Href(sprintf "#section%d" index) ] [ !!name ] ]
]
//<!-- Render nested types and modules, if there are any -->
let nestedEntities = entity.NestedEntities |> List.filter (fun e -> not e.IsObsolete)
if (nestedEntities.Length > 0) then
div [] [
h3 [] [
!!(if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then
"Nested modules"
elif nestedEntities |> List.forall (fun e -> e.IsTypeDefinition) then
"Types"
else
"Types and nested modules")
]
yield! renderEntities nestedEntities
]
for (index, ms, name) in byCategory do
// Iterate over all the categories and print members. If there are more than one
// categories, print the category heading (as <h2>) and add XML comment from the type
// that is related to this specific category.
if (byCategory.Length > 1) then
h2 [ Id(sprintf "section%d" index) ] [ !!name ]
//<a name="@(" section" + g.Index.ToString())"> </a></h2>
let functionsOrValues = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.ValueOrFunction)
let extensions = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.TypeExtension)
let activePatterns = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.ActivePattern)
let unionCases = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.UnionCase)
let recordFields = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.RecordField)
let staticParameters = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.StaticParameter)
let constructors = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.Constructor)
let instanceMembers = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.InstanceMember)
let staticMembers = ms |> List.filter (fun m -> m.Kind = ApiDocMemberKind.StaticMember)
div [] (renderMembers "Functions and values" "Function or value" functionsOrValues)
div [] (renderMembers "Type extensions" "Type extension" extensions)
div [] (renderMembers "Active patterns" "Active pattern" activePatterns)
div [] (renderMembers "Union cases" "Union case" unionCases)
div [] (renderMembers "Record fields" "Record Field" recordFields)
div [] (renderMembers "Static parameters" "Static parameters" staticParameters)
div [] (renderMembers "Constructors" "Constructor" constructors)
div [] (renderMembers "Instance members" "Instance member" instanceMembers)
div [] (renderMembers "Static members" "Static member" staticMembers) ]
let namespaceContent (nsIndex, ns: ApiDocNamespace) =
let allByCategory = Categorise.entities (nsIndex, ns, false)
[ if allByCategory.Length > 0 then
h2 [ Id ns.UrlHash ] [ !!(ns.Name + " Namespace") ]
div [ Class "fsdocs-xmldoc" ] [
match ns.NamespaceDocs with
| Some nsdocs ->
p [] [ embed nsdocs.Summary ]
match nsdocs.Remarks with
| Some r -> p [] [ embed r ]
| None -> ()
| None -> ()
]
if (allByCategory.Length > 1) then
h3 [] [ !! "Contents" ]
ul [] [
for category in allByCategory do
li [] [ a [ Href("#category-" + category.CategoryIndex) ] [ !!category.CategoryName ] ]
]
for category in allByCategory do
if (allByCategory.Length > 1) then
h3 [] [
a [
Class "anchor"
Name("category-" + category.CategoryIndex)
Href("#category-" + category.CategoryIndex)
] [ !!category.CategoryName ]
]
yield! renderEntities category.CategoryEntites ]
let tableOfNamespacesAux () =
[ let categorise = Categorise.model model
for _allByCategory, ns in categorise do
// Generate the entry for the namespace
tr [] [
td [] [
a [
Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl))
HtmlProperties.Title ns.Name
] [ !!ns.Name ]
]
td [] [
match ns.NamespaceDocs with
| Some nsdocs -> embed nsdocs.Summary
| None -> ()
]
] ]
let listOfNamespacesNavAux otherDocs (nsOpt: ApiDocNamespace option) =
[
// For FSharp.Core we make all entries available to other docs else there's not a lot else to show.
//
// For non-FSharp.Core we only show one link "API Reference" in the nav menu
if otherDocs && model.Collection.CollectionName <> "FSharp.Core" then
li [ Class "nav-header" ] [ !! "API Reference" ]
li [ Class "nav-item" ] [
a [
Class "nav-link"
Href(model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl))
] [ !! "All Namespaces" ]
]
else
let categorise = Categorise.model model
let someExist = categorise.Length > 0
if someExist then
li [ Class "nav-header" ] [ !! "Namespaces" ]
for allByCategory, ns in categorise do
// Generate the entry for the namespace
li [
Class(
"nav-item"
+
// add the 'active' class if this is the namespace of the thing being shown
match nsOpt with
| Some ns2 when ns.Name = ns2.Name -> " active"
| _ -> ""
)
] [
span [] [
a [
Class(
"nav-link"
+
// add the 'active' class if this is the namespace of the thing being shown
match nsOpt with
| Some ns2 when ns.Name = ns2.Name -> " active"
| _ -> ""
)
Href(ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl))
] [ !!ns.Name ]
]
]
// In the navigation bar generate the expanded list of entities
// for the active namespace
match nsOpt with
| Some ns2 when ns.Name = ns2.Name ->
ul [ Custom("list-style-type", "none") (* Class "navbar-nav " *) ] [
for category in allByCategory do
for e in category.CategoryEntites do
li [ Class "nav-item" ] [
a [
Class "nav-link"
Href(e.Url(root, collectionName, qualify, model.FileExtensions.InUrl))
] [ !!e.Name ]
]
]
| _ -> () ]
let listOfNamespacesNav otherDocs (nsOpt: ApiDocNamespace option) =
let noTemplatingFallback () =
listOfNamespacesNavAux otherDocs nsOpt
|> List.map (fun html -> html.ToString())
|> String.concat " \n"
match menuTemplateFolder with
| None -> noTemplatingFallback ()
| Some menuTemplateFolder ->
let isTemplatingAvailable = Menu.isTemplatingAvailable menuTemplateFolder
if not isTemplatingAvailable then
noTemplatingFallback ()
else if otherDocs && model.Collection.CollectionName <> "FSharp.Core" then
let menuItems =
let title = "All Namespaces"
let link = model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl)
[ { Menu.MenuItem.Link = link
Menu.MenuItem.Content = title
Menu.MenuItem.IsActive = true } ]
Menu.createMenu menuTemplateFolder false "API Reference" menuItems
else
let categorise = Categorise.model model
if categorise.Length = 0 then
""
else
let menuItems =
categorise
|> List.map (fun (_, ns) ->
let link = ns.Url(root, collectionName, qualify, model.FileExtensions.InUrl)
let name = ns.Name
{ Menu.MenuItem.Link = link
Menu.MenuItem.Content = name
Menu.MenuItem.IsActive = false })
Menu.createMenu menuTemplateFolder false "Namespaces" menuItems
/// Get the substitutions relevant to all
member _.GlobalSubstitutions: Substitutions =
let toc = listOfNamespacesNav true None
[ yield (ParamKeys.``fsdocs-list-of-namespaces``, toc); yield ParamKeys.``fsdocs-body-class``, "api-docs" ]
member _.Generate(outDir: string, templateOpt, collectionName, globalParameters) =
let getSubstitutons parameters toc (content: HtmlElement) pageTitle =
[| yield! parameters
yield (ParamKeys.``fsdocs-list-of-namespaces``, toc)
yield (ParamKeys.``fsdocs-content``, content.ToString())
yield (ParamKeys.``fsdocs-source``, String.Empty)
yield (ParamKeys.``fsdocs-tooltips``, String.Empty)
yield (ParamKeys.``fsdocs-page-title``, pageTitle)
yield (ParamKeys.``fsdocs-page-content-list``, PageContentList.EmptyContent)
yield (ParamKeys.``fsdocs-meta-tags``, String.Empty)
yield! globalParameters |]
let collection = model.Collection
(let content =
div [] [
h1 [] [ !! "API Reference" ]
h2 [] [ !! "Available Namespaces:" ]
table [ Class "table outer-list fsdocs-member-list" ] [
thead [] [
tr [] [
td [ Class "fsdocs-member-list-header" ] [ !! "Namespace" ]
td [ Class "fsdocs-member-list-header" ] [ !! "Description" ]
]
]
tbody [] (tableOfNamespacesAux ())
]
]
let pageTitle = sprintf "%s (API Reference)" collectionName
let toc = listOfNamespacesNav false None
let substitutions = getSubstitutons model.Substitutions toc content pageTitle
let outFile =
Path.Combine(outDir, model.IndexOutputFile(collectionName, model.Qualify, model.FileExtensions.InFile))
printfn " Generating %s" outFile
SimpleTemplating.UseFileAsSimpleTemplate(substitutions, templateOpt, outFile))
//printfn "Namespaces = %A" [ for ns in collection.Namespaces -> ns.Name ]
for (nsIndex, ns) in Seq.indexed collection.Namespaces do
let content = div [] (namespaceContent (nsIndex, ns))
let pageTitle = ns.Name
let toc = listOfNamespacesNav false (Some ns)
let substitutions = getSubstitutons model.Substitutions toc content pageTitle
let outFile =
Path.Combine(outDir, ns.OutputFile(collectionName, model.Qualify, model.FileExtensions.InFile))
printfn " Generating %s" outFile
SimpleTemplating.UseFileAsSimpleTemplate(substitutions, templateOpt, outFile)
for info in model.EntityInfos do
let content = div [] (entityContent info)
let pageTitle = sprintf "%s (%s)" info.Entity.Name collectionName
let toc = listOfNamespacesNav false (Some info.Namespace)
let substitutions = getSubstitutons info.Entity.Substitutions toc content pageTitle
let outFile =
Path.Combine(outDir, info.Entity.OutputFile(collectionName, model.Qualify, model.FileExtensions.InFile))
printfn " Generating %s" outFile
SimpleTemplating.UseFileAsSimpleTemplate(substitutions, templateOpt, outFile)