Skip to content

Commit

Permalink
Merge pull request #283 from qtzar/iFrameSupport
Browse files Browse the repository at this point in the history
Add the ability to set the target for links in the SVG file.
  • Loading branch information
dirkgroot authored Aug 11, 2023
2 parents d5f9e94 + a2da645 commit e0e6f3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ architecture model:
| `generatr.style.faviconPath` | Site logo location relative to the configured `assets` folder. When configured, the logo image will be place on the left side in the header bar. This requires the `--assets-dir` switch when generating the site and the corresponding file to be available in the `assets` folder. | | `site/favicon.ico` |
| `generatr.style.logoPath` | Site favicon location relative to the configured `assets` folder. When configured, the favicon will be set for all generated pages. This requires the `--assets-dir` switch when generating the site and the corresponding file to be available in the `assets` folder. | | `site/logo.png` |
| `generatr.search.language` | Indexing/stemming language for the search index. See [Lunr language support](https://github.com/olivernn/lunr-languages) | `en` | `nl` |
| `generatr.markdown.flexmark.extensions` | Additional extentions to the markdown generator to add new markdown capabilities. [More Details](https://avisi-cloud.github.io/structurizr-site-generatr/main/extended-markdown-features/) | Tables | `Tables,Admonition` |
| `generatr.markdown.flexmark.extensions` | Additional extensions to the markdown generator to add new markdown capabilities. [More Details](https://avisi-cloud.github.io/structurizr-site-generatr/main/extended-markdown-features/) | Tables | `Tables,Admonition` |
| `generatr.svglink.target` | Specifies the link target for element links in the exported svg | `_top` | `_self` |


See the included example for usage of some those properties in the
Expand Down
1 change: 1 addition & 0 deletions docs/example/workspace.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ workspace "Big Bank plc" "This is an example workspace to illustrate the key fea
"generatr.style.colors.secondary" "#ffffff"
"generatr.style.faviconPath" "site/favicon.ico"
"generatr.style.logoPath" "site/logo.png"
"generatr.svglink.target" "_self"

// full list of available "generatr.markdown.flexmark.extensions"
// "Abbreviation,Admonition,AnchorLink,Aside,Attributes,Autolink,Definition,Emoji,EnumeratedReference,Footnotes,GfmIssues,GfmStrikethroughSubscript,GfmTaskList,GfmUsers,GitLab,Ins,Macros,MediaTags,ResizableImage,Superscript,Tables,TableOfContents,SimulatedTableOfContents,Typographic,WikiLinks,XWikiMacro,YAMLFrontMatter,YouTubeLink"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ fun generateDiagrams(workspace: Workspace, exportDir: File) {
}
}

fun generateDiagramWithElementLinks(view: View, url: String, exportDir: File): String {
fun generateDiagramWithElementLinks(workspace: Workspace, view: View, url: String, exportDir: File): String {
val pumlDir = pumlDir(exportDir)
val svgDir = svgDir(exportDir)

val diagram = generatePlantUMLDiagramWithElementLinks(view, url)
val diagram = generatePlantUMLDiagramWithElementLinks(workspace, view, url)

val name = "${diagram.key}-${view.key}"
val plantUMLFile = File(pumlDir, "$name.puml")
Expand Down Expand Up @@ -85,9 +85,13 @@ private fun readSvg(svgDir: File, name: String): String {
return svgFile.readText()
}

private fun generatePlantUMLDiagramWithElementLinks(view: View, url: String): Diagram {
private fun generatePlantUMLDiagramWithElementLinks(workspace: Workspace, view: View, url: String): Diagram {
val plantUMLExporter = C4PlantUmlExporterWithElementLinks(url)

if (workspace.views.configuration.properties.containsKey("generatr.svglink.target")) {
plantUMLExporter.addSkinParam("svgLinkTarget", workspace.views.configuration.properties.getValue("generatr.svglink.target"))
}

return plantUMLExporter.export(view)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fun generateSite(
) {
val generatorContext = GeneratorContext(version, workspace, branches, currentBranch, serving) { key, url ->
workspace.views.views.singleOrNull { view -> view.key == key }
?.let { generateDiagramWithElementLinks(it, url, exportDir) }
?.let { generateDiagramWithElementLinks(workspace, it, url, exportDir) }
}

val branchDir = File(exportDir, currentBranch)
Expand Down

0 comments on commit e0e6f3b

Please sign in to comment.