@@ -45,33 +45,48 @@ let ``Can build doc content`` () =
4545 // Check simple2.md --> simple2.html substititions
4646 let html1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.html" )
4747 let html2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.html" )
48+ let html3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.html" )
4849 html1 |> shouldContainText """ href="simple1.html">"""
4950 html1 |> shouldContainText """ href="simple2.html">"""
51+ html1 |> shouldContainText """ href="simple3.html">"""
5052 html2 |> shouldContainText """ href="simple1.html">"""
5153 html2 |> shouldContainText """ href="simple2.html">"""
54+ html2 |> shouldContainText """ href="simple3.html">"""
55+ html3 |> shouldContainText """ href="simple1.html">"""
56+ html3 |> shouldContainText """ href="simple2.html">"""
57+ html3 |> shouldContainText """ href="simple3.html">"""
5258
5359 // Check simple1.fsx --> simple1.ipynb substititions
5460 // Check simple2.md --> simple1.ipynb substititions
5561 let ipynb1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.ipynb" )
5662 let ipynb2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.ipynb" )
63+ let ipynb3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.ipynb" )
5764 ipynb1 |> shouldContainText " simple2.ipynb"
65+ ipynb1 |> shouldContainText " simple3.ipynb"
5866 ipynb2 |> shouldContainText " simple1.ipynb"
67+ ipynb3 |> shouldContainText " simple1.ipynb"
5968
6069 // Check fsx exists
6170 // Check simple1.fsx --> simple1.fsx substititions
6271 // Check simple2.md --> simple1.fsx substititions
6372 let fsx1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.fsx" )
6473 let fsx2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.fsx" )
74+ let fsx3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.fsx" )
6575 fsx1 |> shouldContainText " simple2.fsx"
76+ fsx1 |> shouldContainText " simple3.fsx"
6677 fsx2 |> shouldContainText " simple1.fsx"
78+ fsx3 |> shouldContainText " simple1.fsx"
6779
6880 // Check md contents
6981 // Check simple1.fsx --> simple1.md substititions
7082 // Check simple2.md --> simple1.md substititions
7183 let md1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.md" )
7284 let md2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.md" )
85+ let md3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.md" )
7386 md1 |> shouldContainText " simple2.md"
87+ md1 |> shouldContainText " simple3.md"
7488 md2 |> shouldContainText " simple1.md"
89+ md3 |> shouldContainText " simple1.md"
7590
7691
7792 // Check in-folder1.fsx --> in-folder1.html substititions
@@ -134,34 +149,48 @@ let ``Can build doc content using relative input path`` () =
134149 // Check simple2.md --> simple2.html substititions
135150 let html1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.html" )
136151 let html2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.html" )
152+ let html3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.html" )
137153 html1 |> shouldContainText """ href="simple1.html">"""
138154 html1 |> shouldContainText """ href="simple2.html">"""
155+ html1 |> shouldContainText """ href="simple3.html">"""
139156 html2 |> shouldContainText """ href="simple1.html">"""
140157 html2 |> shouldContainText """ href="simple2.html">"""
158+ html2 |> shouldContainText """ href="simple3.html">"""
159+ html3 |> shouldContainText """ href="simple1.html">"""
160+ html3 |> shouldContainText """ href="simple2.html">"""
161+ html3 |> shouldContainText """ href="simple3.html">"""
141162
142163 // Check simple1.fsx --> simple1.ipynb substititions
143164 // Check simple2.md --> simple1.ipynb substititions
144165 let ipynb1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.ipynb" )
145166 let ipynb2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.ipynb" )
167+ let ipynb3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.ipynb" )
146168 ipynb1 |> shouldContainText " simple2.ipynb"
169+ ipynb1 |> shouldContainText " simple3.ipynb"
147170 ipynb2 |> shouldContainText " simple1.ipynb"
171+ ipynb3 |> shouldContainText " simple1.ipynb"
148172
149173 // Check fsx exists
150174 // Check simple1.fsx --> simple1.fsx substititions
151175 // Check simple2.md --> simple1.fsx substititions
152176 let fsx1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.fsx" )
153177 let fsx2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.fsx" )
178+ let fsx3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.fsx" )
154179 fsx1 |> shouldContainText " simple2.fsx"
180+ fsx1 |> shouldContainText " simple3.fsx"
155181 fsx2 |> shouldContainText " simple1.fsx"
182+ fsx3 |> shouldContainText " simple1.fsx"
156183
157184 // Check md contents
158185 // Check simple1.fsx --> simple1.md substititions
159186 // Check simple2.md --> simple1.md substititions
160187 let md1 = File.ReadAllText( rootOutputFolderAsGiven </> " simple1.md" )
161188 let md2 = File.ReadAllText( rootOutputFolderAsGiven </> " simple2.md" )
189+ let md3 = File.ReadAllText( rootOutputFolderAsGiven </> " simple3.md" )
162190 md1 |> shouldContainText " simple2.md"
191+ md1 |> shouldContainText " simple3.md"
163192 md2 |> shouldContainText " simple1.md"
164-
193+ md3 |> shouldContainText " simple1.md "
165194
166195 // Check in-folder1.fsx --> in-folder1.html substititions
167196 let f1html1 = File.ReadAllText( rootOutputFolderAsGiven </> " folder1" </> " in-folder1.html" )
@@ -225,3 +254,38 @@ let ``Parses frontmatter correctly `` () =
225254 twoTowersHtml |> shouldContainText " <a href=\" fellowship.html\" >Previous</a>"
226255 twoTowersHtml |> shouldContainText " <a href=\" return.html\" >Next</a>"
227256 returnHtml |> shouldContainText " <a href=\" two-tower.html\" >Previous</a>"
257+
258+
259+ (* Cannot get this test to evaluate the notebook
260+ [<Test>]
261+ let ``ipynb notebook evaluates`` () =
262+ let rootOutputFolderAsGiven = __SOURCE_DIRECTORY__ </> "ipynb-eval-output"
263+ let rootInputFolderAsGiven = __SOURCE_DIRECTORY__ </> "ipynb-eval"
264+
265+ if Directory.Exists(rootOutputFolderAsGiven) then
266+ Directory.Delete(rootOutputFolderAsGiven, true)
267+
268+ let content =
269+ DocContent(
270+ rootOutputFolderAsGiven,
271+ Map.empty,
272+ lineNumbers = None,
273+ evaluate = true,
274+ substitutions = [],
275+ saveImages = None,
276+ watch = false,
277+ root = "https://github.com",
278+ crefResolver = (fun _ -> None),
279+ onError = failwith
280+ )
281+
282+ let docModels = content.Convert(rootInputFolderAsGiven, None, [])
283+ let globals = []
284+
285+ for (_thing, action) in docModels do
286+ action globals
287+
288+ let ipynbOut = rootOutputFolderAsGiven </> "eval.html" |> File.ReadAllText
289+
290+ ipynbOut |> shouldContainText "10007"
291+ *)
0 commit comments