From 6725cc8abf8b2d4951ab2222757d01c0728b50b1 Mon Sep 17 00:00:00 2001 From: Joris Kraak Date: Sun, 25 Feb 2024 14:50:49 +0100 Subject: [PATCH 1/3] test: detect theme changes based on associated fonts For previous versions of the Kroki service, the full source of the diagram was included in rendered results which made it possible to directly detect the theme. This is no longer the case[^1], making it necessary to detect the effect of a theme. The most straightforward way to do this is by detecting fonts referenced in the rendered results. [^1]: https://github.com/bauglir/Kroki.jl/actions/runs/8038302157/job/21954056804?pr=49#step:5:126 --- test/kroki/rendering_test.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/kroki/rendering_test.jl b/test/kroki/rendering_test.jl index df02732..dbda2d5 100644 --- a/test/kroki/rendering_test.jl +++ b/test/kroki/rendering_test.jl @@ -89,23 +89,25 @@ end end @testset "takes `options` into account" begin - expected_theme_name = "materia" - options = Dict{String, String}("theme" => expected_theme_name) + options = Dict{String, String}("theme" => "materia") diagram = Diagram(:plantuml, "A -> B: C"; options) + # The most straightforward way to differentiate between the themes used + # for testing is by checking the associated fonts. The "Materia" theme + # relies on "Verdana", whereas the "Sketchy" theme relies on the + # handwritten look of "Segoe Print" @testset "defaults to `Diagram` options" begin rendered = String(render(diagram, "svg")) - @test occursin("!theme $(expected_theme_name)", rendered) + @test occursin("Verdana", rendered) end @testset "allows definition at render-time" begin - expected_overridden_theme = "sketchy" rendered = String( - render(diagram, "svg"; options = Dict("theme" => expected_overridden_theme)), + render(diagram, "svg"; options = Dict{String, String}("theme" => "sketchy")), ) - @test occursin("!theme $(expected_overridden_theme)", rendered) + @test occursin("Segoe Print", rendered) end end end From 0f0566aa625254c3e44e2cefe71a69399ce210b8 Mon Sep 17 00:00:00 2001 From: Joris Kraak Date: Sun, 25 Feb 2024 15:00:21 +0100 Subject: [PATCH 2/3] ci: run documentation generation on Julia v1.7 This is a temporary work-around until #49 is merged to negate the issue described by #48. --- .github/workflows/Documentation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 76b95b8..031b03b 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 + with: + version: '1.7' - name: Install dependencies run: | julia --project=docs -e ' From 888574b35627135baec92b471675da46f0228918 Mon Sep 17 00:00:00 2001 From: Joris Kraak Date: Tue, 12 Mar 2024 14:50:05 +0100 Subject: [PATCH 3/3] docs(structurizr): specify view keys explicitly When view keys are not explicitly defined, Structurizr dynamically generates them. These keys may not be stable[^1] and may change across Structurizr versions, resulting in errors[^2]. [^1]: https://docs.structurizr.com/dsl/language#views [^2]: https://github.com/bauglir/Kroki.jl/actions/runs/8038492294/job/22264844603#step:5:10 --- docs/architecture/workspace.dsl | 6 +++--- docs/src/examples.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/architecture/workspace.dsl b/docs/architecture/workspace.dsl index 0bacbfc..6af0b64 100644 --- a/docs/architecture/workspace.dsl +++ b/docs/architecture/workspace.dsl @@ -76,17 +76,17 @@ workspace { } views { - container kroki_jl { + container kroki_jl PackageContainers { include * autoLayout lr } - component library { + component library PackageComponents { include * autoLayout bt } - container kroki_service { + container kroki_service ServiceContainers { include * autoLayout tb } diff --git a/docs/src/examples.md b/docs/src/examples.md index 0ab234e..aa199c0 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -182,7 +182,7 @@ rendered from the set defined in the file. structurizr_diagram = Diagram( :structurizr; path = joinpath(@__DIR__, "..", "architecture", "workspace.dsl"), - options = Dict("view-key" => "KrokiService-Container") + options = Dict("view-key" => "ServiceContainers") ) ``` @@ -218,7 +218,7 @@ end DocumenterSvg( render( structurizr_diagram, "svg"; - options = Dict("view-key" => "Krokijl-Krokijl-Component") + options = Dict("view-key" => "PackageComponents") ) ) ```