plantuml debug

This commit is contained in:
mr
2026-03-18 09:41:09 +01:00
parent 4eb112bee3
commit d4ac398cdb
2 changed files with 56 additions and 26 deletions

View File

@@ -15,31 +15,32 @@ import (
// PlantUML export
// ---------------------------------------------------------------------------
// plantUMLProcedures defines the !procedure blocks for each resource type.
// These make the output valid, renderable PlantUML while remaining parseable
// by ExtractFromPlantUML (which already skips lines containing "!procedure").
// plantUMLProcedures defines !procedure blocks for each resource type.
// Parameters use the $var/$name convention of PlantUML preprocessor v2.
// Calls are written WITHOUT inline comments (comment on the following line)
// to avoid the "assumed sequence diagram" syntax error.
const plantUMLProcedures = `!procedure Processing($var, $name)
component "$name" as $var <<Processing>>
component "$name" as $var <<Processing>>
!endprocedure
!procedure Data($var, $name)
file "$name" as $var <<Data>>
file "$name" as $var <<Data>>
!endprocedure
!procedure Storage($var, $name)
database "$name" as $var <<Storage>>
database "$name" as $var <<Storage>>
!endprocedure
!procedure ComputeUnit($var, $name)
node "$name" as $var <<ComputeUnit>>
node "$name" as $var <<ComputeUnit>>
!endprocedure
!procedure WorkflowEvent($var, $name)
usecase "$name" as $var <<WorkflowEvent>>
usecase "$name" as $var <<WorkflowEvent>>
!endprocedure
!procedure Workflow($var, $name)
frame "$name" as $var <<Workflow>>
frame "$name" as $var <<Workflow>>
!endprocedure
`
@@ -72,11 +73,10 @@ func (w *Workflow) ToPlantUML() string {
if src == "" || dst == "" {
continue
}
line := fmt.Sprintf("%s --> %s", src, dst)
sb.WriteString(fmt.Sprintf("%s --> %s\n", src, dst))
if comment := plantUMLLinkComment(link); comment != "" {
line += " ' " + comment
sb.WriteString("' " + comment + "\n")
}
sb.WriteString(line + "\n")
}
sb.WriteString("\n@enduml\n")
@@ -146,11 +146,13 @@ func plantUMLItemLine(varName string, item graph.GraphItem) string {
}
func plantUMLResourceLine(macro, varName string, res resources.ResourceInterface) string {
line := fmt.Sprintf("%s(%s, \"%s\")", macro, varName, res.GetName())
decl := fmt.Sprintf("%s(%s, \"%s\")", macro, varName, res.GetName())
if comment := plantUMLResourceComment(res); comment != "" {
line += " ' " + comment
// Comment on the line AFTER the declaration. ExtractFromPlantUML uses
// look-ahead to merge it back. No inline comment = no !procedure conflict.
return decl + "\n' " + comment
}
return line
return decl
}
// plantUMLResourceComment merges resource-level fields with the first instance