Skip to content

Commit

Permalink
Fixes #251.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Feb 18, 2024
1 parent 15b6eae commit 36edcae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- structurizr-client: Removes `StructurizrClient` (use `WorkspaceApiClient` instead).
- structurizr-import: Adds support for importing decisions managed by Log4brains.
- structurizr-import: Adds support for importing decisions in MADR format.
- structurizr-import: Fixes https://github.com/structurizr/java/issues/251 (Importing docs fails on files without extension).
- structurizr-dsl: Adds `!decisions` as a synonym for `!adrs`.
- structurizr-dsl: Allows `!identifiers` to be used inside `model`.
- structurizr-inspection: Initial version.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
public class FormatFinder {

private static final Set<String> MARKDOWN_EXTENSIONS = new HashSet<>(Arrays.asList(".md", ".markdown", ".text"));

private static final Set<String> ASCIIDOC_EXTENSIONS = new HashSet<>(Arrays.asList(".asciidoc", ".adoc", ".asc"));
private static final String DOT = ".";

public static boolean isMarkdownOrAsciiDoc(File file) {
String extension = file.getName().substring(file.getName().lastIndexOf("."));
if (file.getName().contains(DOT)) {
String extension = file.getName().substring(file.getName().lastIndexOf(DOT));

return MARKDOWN_EXTENSIONS.contains(extension) || ASCIIDOC_EXTENSIONS.contains(extension);
}

return MARKDOWN_EXTENSIONS.contains(extension) || ASCIIDOC_EXTENSIONS.contains(extension);
return false;
}

public static Format findFormat(File file) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file should be ignored.

0 comments on commit 36edcae

Please sign in to comment.