diff --git a/language-server/src/Geowerkstatt.Interlis.LanguageServer.Test/Visitors/MarkdownDocumentationVisitorTest.cs b/language-server/src/Geowerkstatt.Interlis.LanguageServer.Test/Visitors/MarkdownDocumentationVisitorTest.cs
index 66deaeb..145b87c 100644
--- a/language-server/src/Geowerkstatt.Interlis.LanguageServer.Test/Visitors/MarkdownDocumentationVisitorTest.cs
+++ b/language-server/src/Geowerkstatt.Interlis.LanguageServer.Test/Visitors/MarkdownDocumentationVisitorTest.cs
@@ -55,6 +55,24 @@ MODEL TestModel (de) AT "http://models.geow.cloud" VERSION "1" =
END TestModel;
""";
+ private const string TestModelNestedStruct = """
+ INTERLIS 2.4;
+
+ MODEL TestModel (de) AT "http://models.geow.cloud" VERSION "1" =
+ TOPIC TestTopic =
+ CLASS TestClass =
+ attr1: MANDATORY TestStruct;
+ attr2: 10..20;
+ END TestClass;
+
+ STRUCTURE TestStruct =
+ attr1: TEXT*10;
+ attr2: MANDATORY (value1, value2);
+ END TestStruct;
+ END TestTopic;
+ END TestModel;
+ """;
+
[TestMethod]
public void TestInterlisFile()
{
@@ -127,7 +145,49 @@ public void TestInterlisFileEnumeration()
### TestClass
| Attributname | Kardinalität | Typ |
| --- | --- | --- |
- | attr1 | 0..1 | (**topValue1**, **topValue2** (subValue1, subValue2, subValue3 (*subSubValue1*, *subSubValue2*)), **topValue3**) |
+ | attr1 | 0..1 | (topValue1, topValue2 (subValue1, subValue2, subValue3 (subSubValue1, subSubValue2)), topValue3) |
+
+
+ """;
+
+ Assert.AreEqual(expected.ReplaceLineEndings(), documentation.ReplaceLineEndings());
+ }
+
+ [TestMethod]
+ public void TestInterlisFileNestedStruct()
+ {
+ var reader = new InterlisReader();
+ var interlisFile = reader.ReadFile(new StringReader(TestModelNestedStruct));
+
+ var visitor = new MarkdownDocumentationVisitor();
+ visitor.VisitInterlisFile(interlisFile);
+ var documentation = visitor.GetDocumentation();
+
+ const string structInlineTable =
+ "
" +
+ "" +
+ "Attributname | Kardinalität | Typ |
" +
+ "" +
+ "" +
+ "attr1 | 0..1 | Text [10] |
" +
+ "attr2 | 1 | (value1, value2) |
" +
+ "" +
+ "
";
+
+ var expected = $"""
+ # TestModel
+ ## TestTopic
+ ### TestClass
+ | Attributname | Kardinalität | Typ |
+ | --- | --- | --- |
+ | attr1 | 1 | TestStruct
{structInlineTable} |
+ | attr2 | 0..1 | 10..20 |
+
+ ### TestStruct
+ | Attributname | Kardinalität | Typ |
+ | --- | --- | --- |
+ | attr1 | 0..1 | Text [10] |
+ | attr2 | 1 | (value1, value2) |
""";
diff --git a/language-server/src/Geowerkstatt.Interlis.LanguageServer/Visitors/MarkdownDocumentationVisitor.cs b/language-server/src/Geowerkstatt.Interlis.LanguageServer/Visitors/MarkdownDocumentationVisitor.cs
index d9b4e0d..f786b88 100644
--- a/language-server/src/Geowerkstatt.Interlis.LanguageServer/Visitors/MarkdownDocumentationVisitor.cs
+++ b/language-server/src/Geowerkstatt.Interlis.LanguageServer/Visitors/MarkdownDocumentationVisitor.cs
@@ -11,6 +11,7 @@ namespace Geowerkstatt.Interlis.LanguageServer.Visitors;
public class MarkdownDocumentationVisitor : Interlis24AstBaseVisitor