Skip to content

Commit

Permalink
Bug/24 cant parse named diagrams (#96)
Browse files Browse the repository at this point in the history
* Test for #24: Can't parse named diagrams

* add named diagram with spaces

* parse diagram name
  • Loading branch information
Enteee authored Mar 27, 2023
1 parent cdf2fdb commit e3327a9
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/plantuml.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ PlantUMLFile
Diagrams
= diagrams:(
(!"@startuml" .)*
"@startuml" _ DiagramId? _ NewLine
"@startuml" DiagramId? (" " _ DiagramName)? _ NewLine
uml:UML
"@enduml" _ NewLine?
(!"@startuml" .)*
Expand All @@ -68,6 +68,9 @@ Diagrams
DiagramId
= "(" _ "id" _ "=" Name ")"

DiagramName
= (!NewLine .)+

UML
= elements:UMLElement*
{
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/diagram-names-with-spaces/in.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@startuml System Context of Project Collector System
@enduml
5 changes: 5 additions & 0 deletions test/fixtures/diagram-names-with-spaces/parse-out.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"elements": []
}
]
4 changes: 4 additions & 0 deletions test/fixtures/diagram-names-with-spaces/parse-out.graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"nodes": [],
"edges": []
}
10 changes: 10 additions & 0 deletions test/fixtures/diagram-names-with-spaces/parseFile-out.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"name": "test/fixtures/diagram-names-with-spaces/in.plantuml",
"diagrams": [
{
"elements": []
}
]
}
]
16 changes: 16 additions & 0 deletions test/fixtures/diagram-names-with-spaces/parseFile-out.graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"nodes": [
{
"name": "test/fixtures/diagram-names-with-spaces/in.plantuml",
"diagrams": [
{
"elements": []
}
],
"id": "test/fixtures/diagram-names-with-spaces/in.plantuml",
"type": "File",
"hidden": true
}
],
"edges": []
}
2 changes: 2 additions & 0 deletions test/fixtures/diagram-names/in.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@startuml diagramname
@enduml
5 changes: 5 additions & 0 deletions test/fixtures/diagram-names/parse-out.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"elements": []
}
]
4 changes: 4 additions & 0 deletions test/fixtures/diagram-names/parse-out.graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"nodes": [],
"edges": []
}
10 changes: 10 additions & 0 deletions test/fixtures/diagram-names/parseFile-out.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"name": "test/fixtures/diagram-names/in.plantuml",
"diagrams": [
{
"elements": []
}
]
}
]
16 changes: 16 additions & 0 deletions test/fixtures/diagram-names/parseFile-out.graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"nodes": [
{
"name": "test/fixtures/diagram-names/in.plantuml",
"diagrams": [
{
"elements": []
}
],
"id": "test/fixtures/diagram-names/in.plantuml",
"type": "File",
"hidden": true
}
],
"edges": []
}

0 comments on commit e3327a9

Please sign in to comment.