Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Update to rm deprecated from test client
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jul 8, 2022
1 parent 9e56047 commit 6aec175
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ This fornax template implements the existing [nfdi-web-components](https://githu

You can find the loader and generator functions on nuget:

```
wip
```
Best use this repo as implemented in [web-components-docs](https://github.com/nfdi4plants/web-components)

## usage

Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.4.0+9e56047 (Released 2022-7-8)
* Additions:
* latest commit #9e56047
* [[#9e56047](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/9e56047125b584ad5fcf34487858f822a7f592bc)] Deprecate DocsData :boom:
* Implement `Docs` type with optional BasePath.

### 0.3.0+e40d9be (Released 2022-7-8)
* Additions:
* latest commit #e40d9be
Expand Down
2 changes: 1 addition & 1 deletion client/generators/docs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ open Docsloader

let generate' (ctx : SiteContents) (page: string) =
let doc =
ctx.TryGetValues<Nfdi4Plants.DocsData> ()
ctx.TryGetValues<Nfdi4Plants.Docs> ()
|> Option.defaultValue Seq.empty
|> Seq.findBack (fun n -> n.file = page)

Expand Down
2 changes: 1 addition & 1 deletion client/generators/index.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open Fornax
open Docsloader

let generate' (ctx : SiteContents) (_: string) =
let docs0 = ctx.TryGetValues<Nfdi4Plants.DocsData> () |> Option.defaultValue Seq.empty
let docs0 = ctx.TryGetValues<Nfdi4Plants.Docs> () |> Option.defaultValue Seq.empty
printfn "GENERATOR: %i" <| Seq.length docs0

let landingPage = docs0 |> Seq.tryFind(fun x -> x.title = "Index" || x.title = "Home")
Expand Down
8 changes: 4 additions & 4 deletions client/generators/layout.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@ let layout (ctx : SiteContents) (activePageTitle: string) bodyCnt =
custom "nfdi-footer" [] []
]

open Fornax.Nfdi4Plants
open Docsloader
open Fornax

let render (ctx : SiteContents) cnt =
let disableLiveRefresh = ctx.TryGetValue<DocsConfig> () |> Option.map (fun n -> n.disableLiveRefresh) |> Option.defaultValue false
cnt
|> HtmlElement.ToString
|> fun n -> if disableLiveRefresh then n else injectWebsocketCode n

let docsLayout (docs: DocsData) =
let docsLayout (docs: Nfdi4Plants.Docs) =
// just an example url
Components.docsLayout "https://github.com/nfdi4plants/nfdi4plants.github.io/tree/main/src/" docs
Nfdi4Plants.Components.docsLayout("https://github.com/nfdi4plants/nfdi4plants.github.io/tree/main/src/", docs)

let docsMinimalLayout (docs: DocsData) =
let docsMinimalLayout (docs: Nfdi4Plants.Docs) =
div [Class "tile is-4 is-parent"] [
div [Class "tile is-child box"] [
p [Class "title"] [ a [Href docs.link] [!! docs.title] ]
Expand Down
10 changes: 5 additions & 5 deletions client/loaders/docsloader.fsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#r "../_lib/Fornax.Core.dll"
#r "../_lib/Markdig.dll"
// This can be used to access local .nupkg, thanks to the nuget.config file.
#r "nuget: Nfdi4Plants.Fornax, 0.2.2"
#r "nuget: Nfdi4Plants.Fornax, 0.4.0"

open System.IO
open Fornax
open Fornax.Nfdi4Plants

let contentDir = "docs"

Expand All @@ -19,12 +18,13 @@ let loader (projectRoot: string) (siteContent: SiteContents) =
Directory.GetFiles(docsPath, "*")
|> Array.filter (fun n -> n.EndsWith ".md")
|> Array.filter (fun n -> n.Contains "README.md" |> not)
let loadDocs (filePath:string) = Nfdi4Plants.Docs.loadFile(projectRoot, contentDir, filePath)
let docs =
files
|> Array.map (Docs.loadFile projectRoot contentDir)
|> Array.map loadDocs

let doc =
siteContent.TryGetValues<Nfdi4Plants.DocsData> ()
siteContent.TryGetValues<Nfdi4Plants.Docs> ()
|> Option.defaultValue Seq.empty

printfn "LOADER CURRENT DOCS: %i" <| Seq.length doc
Expand All @@ -37,7 +37,7 @@ let loader (projectRoot: string) (siteContent: SiteContents) =
|> Array.iter siteContent.Add

let doc2 =
siteContent.TryGetValues<Nfdi4Plants.DocsData> ()
siteContent.TryGetValues<Nfdi4Plants.Docs> ()
|> Option.defaultValue Seq.empty

printfn "LOADER NEXT DOCS: %i" <| Seq.length doc2
Expand Down
2 changes: 1 addition & 1 deletion src/Nfdi4Plants.Fornax/Components.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ type Components = class end
HtmlProperties.Style [MarginLeft "auto"; Display "block"; CSSProperties.Width "130px"]
] [!! "✏️ Edit this page"]
]
]
]

0 comments on commit 6aec175

Please sign in to comment.