From 30e2f1175205d219b6028ee295a5067ac934d6ec Mon Sep 17 00:00:00 2001 From: Javier Feliu Date: Wed, 1 Jul 2020 16:08:07 -0400 Subject: [PATCH] fixes #61 Added code to sort the names of the classes we generate due to complex naming that might conflict with plantuml code. These were also not ordered and where rendered based on a map --- parser/class_parser.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parser/class_parser.go b/parser/class_parser.go index a2fb2cb..fd435bf 100644 --- a/parser/class_parser.go +++ b/parser/class_parser.go @@ -438,7 +438,13 @@ func (p *ClassParser) renderStructures(pack string, structures map[string]*Struc structure := structures[name] p.renderStructure(structure, pack, name, str, composition, extends, aggregations) } - for tempName, name := range p.allRenamedStructs[pack] { + var orderedRenamedStructs []string + for tempName := range p.allRenamedStructs[pack] { + orderedRenamedStructs = append(orderedRenamedStructs, tempName) + } + sort.Strings(orderedRenamedStructs) + for _, tempName := range orderedRenamedStructs { + name := p.allRenamedStructs[pack][tempName] str.WriteLineWithDepth(1, fmt.Sprintf(`class "%s" as %s {`, name, tempName)) str.WriteLineWithDepth(2, aliasComplexNameComment) str.WriteLineWithDepth(1, "}")