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

Commit

Permalink
Fix basepath parsing issues 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jul 8, 2022
1 parent 1de8f07 commit df516b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 0.5.0+1de8f07 (Released 2022-7-8)
* Additions:
* latest commit #1de8f07
* [[#6aec175](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/6aec175b5141ad87f113b6a0ac5e7bcf9d740850)] Update to rm deprecated from test client
* [[#3036cf4](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/3036cf47d8a46e9b4f3084d1e4430267d60173ae)] Merge branch 'main' of https://github.com/Freymaurer/nfdi4plants-fornax-template
* [[#1de8f07](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/1de8f0722c7d61c82441e2f3af5536be9ee10f52)] add sidebar basepath logic

### 0.4.0+9e56047 (Released 2022-7-8)
* Additions:
* latest commit #9e56047
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ module NfdiSidebarElementHeader =

let attr = hb.GetAttributes()
attr.AddProperty("slot", "inner")

if href.IsSome then
attr.AddProperty(
"href",
if productionBasePath.IsSome then System.IO.Path.Combine(productionBasePath.Value, href.Value) else href.Value
)
let nextHref = if productionBasePath.IsSome then "/" + productionBasePath.Value.Trim([|'/'|]) + "/" + href.Value.Trim([|'/'|]) else href.Value
attr.AddProperty("href", nextHref)

if (renderer.EnableHtmlForBlock) then
renderer.Write('<') |> ignore
Expand Down Expand Up @@ -83,5 +82,6 @@ module NfdiSidebarElementHeader =
// <param name="pipeline">The Markdig <see cref="MarkdownPipelineBuilder"/> to add the extension to</param>
static member UseSidebarHeader(pipeline : MarkdownPipelineBuilder, ?productionBasePath) =
let x = if productionBasePath.IsSome then SidebarHeaderExtension(productionBasePath.Value) else SidebarHeaderExtension()
printfn "HIT: %A" productionBasePath
pipeline.Extensions.Add(x)
pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ let tests =
test "basePathPipeline" {
let markdown = """# Start testing!:/docs/start-testing"""
let result = Markdown.ToHtml(markdown, basePathPipeline)
Expect.equal result $"""<h1 slot="inner" href="TestURL/docs/start-testing">Start testing!</h1>{'\010'}""" ""
Expect.equal result $"""<h1 slot="inner" href="/TestURL/docs/start-testing">Start testing!</h1>{'\010'}""" ""
}
]

0 comments on commit df516b0

Please sign in to comment.