Skip to content

Commit

Permalink
Fixes #312.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Jul 19, 2024
1 parent 2cc351d commit 53519eb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## unreleased

- structurizr-dsl: Fixes https://github.com/structurizr/java/issues/312 (!include doesn't work with files encoded as UTF-8 BOM).

## 2.2.0 (2nd July 2024)

- structurizr-dsl: Adds support for element/relationship property expressions (https://github.com/structurizr/java/issues/297).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ void parse(List<String> lines, File dslFile, boolean include) throws Structurizr
for (IncludedFile includedFile : context.getFiles()) {
List<String> paddedLines = new ArrayList<>();
for (String unpaddedLine : includedFile.getLines()) {
if (unpaddedLine.startsWith(BOM)) {
// this caters for files encoded as "UTF-8 with BOM"
unpaddedLine = unpaddedLine.substring(1);
}
paddedLines.add(leadingSpace + unpaddedLine);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
model {
user = person "User" "A user of my software system."
softwareSystem = softwareSystem "Software System" "My software system, code-named \"X\"."

user -> softwareSystem "Uses"
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
workspace "Getting Started" "This is a model of my software system." {

model {
user = person "User" "A user of my software system."
softwareSystem = softwareSystem "Software System" "My software system, code-named \"X\"."

user -> softwareSystem "Uses"
}
!include workspace-with-bom-model.dsl

views {
systemContext softwareSystem "SystemContext" "An example of a System Context diagram." {
Expand Down

0 comments on commit 53519eb

Please sign in to comment.