Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 910de78

Browse files
Generate script works
Still getting errors about needing to reference netstandard.dll, but this only keeps the tooltips from being generated for statements; it needs to be fixed, but it'll be in the next round.
1 parent a622bd8 commit 910de78

File tree

1 file changed

+27
-74
lines changed

1 file changed

+27
-74
lines changed

dox/tools/generate.fsx

Lines changed: 27 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
// (the generated documentation is stored in the 'docs/output' directory)
44
// --------------------------------------------------------------------------------------
55

6-
// Binaries that have XML documentation (in a corresponding generated XML file)
7-
// Any binary output / copied to bin/projectName/projectName.dll will
8-
// automatically be added as a binary to generate API docs for.
9-
// for binaries output to root bin folder please add the filename only to the
10-
// referenceBinaries list below in order to generate documentation for the binaries.
11-
// (This is the original behaviour of ProjectScaffold prior to multi project support)
12-
let referenceBinaries = []
136
// Web site location for the generated documentation
147
let website = "/FromObjectsToFunctions"
158

@@ -32,9 +25,7 @@ let info =
3225
#r "FakeLib.dll"
3326
open Fake
3427
open System.IO
35-
open Fake.FileHelper
36-
open FSharp.Literate
37-
open FSharp.MetadataFormat
28+
open FSharp.Formatting.Razor
3829

3930
// When called from 'build.fsx', use the public project URL as <root>
4031
// otherwise, use the current 'output' directory.
@@ -54,92 +45,54 @@ let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting/"
5445
let docTemplate = "docpage.cshtml"
5546

5647
// Where to look for *.csproj templates (in this order)
57-
let layoutRootsAll = new System.Collections.Generic.Dictionary<string, string list>()
58-
layoutRootsAll.Add("en",[ templates; formatting @@ "templates"
59-
formatting @@ "templates/reference" ])
48+
let layoutRootsAll = System.Collections.Generic.Dictionary<string, string list>()
49+
layoutRootsAll.Add ("en",[ templates; formatting @@ "templates"; formatting @@ "templates/reference" ])
6050
subDirectories (directoryInfo templates)
6151
|> Seq.iter (fun d ->
62-
let name = d.Name
63-
if name.Length = 2 || name.Length = 3 then
64-
layoutRootsAll.Add(
65-
name, [templates @@ name
66-
formatting @@ "templates"
67-
formatting @@ "templates/reference" ]))
52+
match d.Name.Length with
53+
| 2 | 3 ->
54+
layoutRootsAll.Add (
55+
d.Name,
56+
[templates @@ d.Name; formatting @@ "templates"; formatting @@ "templates/reference" ])
57+
| _ -> ())
6858

6959
// Copy static files and CSS + JS from F# Formatting
7060
let copyFiles () =
71-
CopyRecursive files output true |> Log "Copying file: "
61+
CopyRecursive files output true
62+
|> Log "Copying file: "
7263
ensureDirectory (output @@ "content")
7364
CopyRecursive (formatting @@ "styles") (output @@ "content") true
74-
|> Log "Copying styles and scripts: "
75-
76-
let binaries =
77-
let manuallyAdded =
78-
referenceBinaries
79-
|> List.map (fun b -> bin @@ b)
80-
81-
let conventionBased = []
82-
(*directoryInfo bin
83-
|> subDirectories
84-
|> Array.map (fun d -> d.FullName @@ (sprintf "%s.dll" d.Name))
85-
|> List.ofArray *)
86-
87-
conventionBased @ manuallyAdded
88-
89-
let libDirs = []
90-
(*let conventionBasedbinDirs =
91-
directoryInfo bin
92-
|> subDirectories
93-
|> Array.map (fun d -> d.FullName)
94-
|> List.ofArray
95-
96-
conventionBasedbinDirs @ [bin]*)
97-
98-
// Build API reference from XML comments
99-
let buildReference () =
100-
CleanDir (output @@ "reference")
101-
MetadataFormat.Generate
102-
( binaries, output @@ "reference", layoutRootsAll.["en"],
103-
parameters = ("root", root)::info,
104-
sourceRepo = githubLink @@ "tree/master",
105-
sourceFolder = __SOURCE_DIRECTORY__ @@ ".." @@ "..",
106-
publicOnly = true,libDirs = libDirs )
65+
|> Log "Copying styles and scripts: "
10766

10867
// Build documentation from `fsx` and `md` files in `docs/content`
10968
let buildDocumentation () =
11069

11170
// First, process files which are placed in the content root directory.
112-
113-
Literate.ProcessDirectory
114-
( content, docTemplate, output, replacements = ("root", root)::info,
115-
layoutRoots = layoutRootsAll.["en"],
116-
generateAnchors = true,
71+
RazorLiterate.ProcessDirectory
72+
( content, docTemplate, output,
73+
layoutRoots = layoutRootsAll.["en"],
74+
replacements = ("root", root)::info,
75+
generateAnchors = true,
11776
processRecursive = false)
11877

11978
// And then process files which are placed in the sub directories
12079
// (some sub directories might be for specific language).
121-
12280
let subdirs = Directory.EnumerateDirectories(content, "*", SearchOption.TopDirectoryOnly)
12381
for dir in subdirs do
12482
let dirname = (new DirectoryInfo(dir)).Name
12583
let layoutRoots =
126-
// Check whether this directory name is for specific language
127-
let key = layoutRootsAll.Keys
128-
|> Seq.tryFind (fun i -> i = dirname)
129-
match key with
130-
| Some lang -> layoutRootsAll.[lang]
131-
| None -> layoutRootsAll.["en"] // "en" is the default language
132-
133-
Literate.ProcessDirectory
134-
( dir, docTemplate, output @@ dirname, replacements = ("root", root)::info,
135-
layoutRoots = layoutRoots,
84+
// Check whether this directory name is for specific language
85+
let key = layoutRootsAll.Keys
86+
|> Seq.tryFind (fun i -> i = dirname)
87+
match key with
88+
| Some lang -> layoutRootsAll.[lang]
89+
| None -> layoutRootsAll.["en"] // "en" is the default language
90+
RazorLiterate.ProcessDirectory
91+
( dir, docTemplate, output @@ dirname,
92+
layoutRoots = layoutRoots,
93+
replacements = ("root", root) :: info,
13694
generateAnchors = true )
13795

13896
// Generate
13997
copyFiles()
140-
//#if HELP
14198
buildDocumentation()
142-
//#endif
143-
//#if REFERENCE
144-
//buildReference()
145-
//#endif

0 commit comments

Comments
 (0)