bafolts / plantcode

Provides a javascript utility to generate code in various languages given a plantuml class diagram.

Home Page:https://segmentationfaults.com/plantcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for plantuml notes

noamtamim opened this issue · comments

In plantuml class diagram there are two ways to provide documentation/comments: notes and free text inside the class body.
As plantcode is very strict about the grammar, it doesn't allow the puml source to have them.

Copying the docs to the code is a nice to have -- for the purpose of the issue, just ignoring them would be ok.

Can you provide an example of the puml source that fails to execute? That way I can fix your case and add your case to the integration tests.

This is from plantuml's samples:

@startuml
class User {
  .. Simple Getter ..
  + getName()
  + getAddress()
  .. Some setter ..
  + setName()
  __ private data __
  int age
  -- encrypted --
  String password
}

@enduml

And so is this:

@startuml
class Object << general >>
Object <|--- ArrayList

note top of Object : In java, every class\nextends this one.

note "This is a floating note" as N1
note "This note is connected\nto several objects." as N2
Object .. N2
N2 .. ArrayList

class Foo
note left: On last defined class

@enduml

I added the first example to the tests file and updated the grammar to parse it properly.

https://github.com/bafolts/plantuml-code-generator/blob/0e4eeb9181504a3ee8243bc2f74c933ed80c272a/tests/comments-dots.pegjs

Will get to the notes one soon.

Thank you very much for the quick response (and action!). I will test it soon with my real class diagram.

I added support for the notes file you provided and added it as a test. I will close this issue time being. If you find any more issues feel free to post the sample input file.

https://github.com/bafolts/plantuml-code-generator/blob/master/tests/notes-file.pegjs