From 35ec61d458d89cf081e67f32dbfe2daee9a97029 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Tue, 17 Dec 2024 08:41:01 +0100 Subject: [PATCH] Suffix ADR links with slash Let's be consistent with other links. --- .../generatr/site/model/WorkspaceDecisionPageViewModel.kt | 2 +- .../site/model/WorkspaceDecisionPageViewModelTest.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModel.kt index 0036fbb8..661ba393 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModel.kt @@ -17,7 +17,7 @@ class WorkspaceDecisionPageViewModel(generatorContext: GeneratorContext, decisio private fun transformADRLinks(content: String) = content.replace("\\[(.*)]\\(#(\\d+)\\)".toRegex()) { - "[${it.groupValues[1]}](decisions/${it.groupValues[2]})" + "[${it.groupValues[1]}](decisions/${it.groupValues[2]}/)" } companion object { diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModelTest.kt index cffefae6..fe4225d5 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/WorkspaceDecisionPageViewModelTest.kt @@ -38,7 +38,8 @@ class WorkspaceDecisionPageViewModelTest : ViewModelTest() { content = """ Decision with [link to other ADR](#2). [Web link](https://google.com) - [Internal link](#other-section) + [Section link](#other-section) + [Internal link](../embedding-diagrams-and-images/) """.trimIndent() } val viewModel = WorkspaceDecisionPageViewModel(generatorContext(), decision) @@ -46,9 +47,10 @@ class WorkspaceDecisionPageViewModelTest : ViewModelTest() { assertThat(viewModel.content).isEqualTo( toHtml( viewModel, """ - Decision with [link to other ADR](decisions/2). + Decision with [link to other ADR](decisions/2/). [Web link](https://google.com) - [Internal link](#other-section) + [Section link](#other-section) + [Internal link](../embedding-diagrams-and-images/) """.trimIndent(), Format.Markdown, svgFactory