|
|
@@ -1,12 +1,26 @@
|
|
|
import io
|
|
|
from drawio2py import abstract_syntax
|
|
|
|
|
|
+CDF_NAMESPACES = {
|
|
|
+ "description": "http://flandersmake.be/cdf/description/my_drawio",
|
|
|
+ "drawio": "http://flandersmake.be/cdf/vocabulary/drawio",
|
|
|
+ "object_diagram": "http://flandersmake.be/cdf/vocabulary/object_diagram",
|
|
|
+ "dict": "http://flandersmake.be/cdf/vocabulary/dict",
|
|
|
+}
|
|
|
+
|
|
|
+DTDESIGN_NAMESPACES = {
|
|
|
+ "description": "http://ua.be/sdo2l/description/artifacts/",
|
|
|
+ "drawio": "http://ua.be/sdo2l/vocabulary/formalisms/drawio",
|
|
|
+ "object_diagram": "http://ua.be/sdo2l/vocabulary/formalisms/object_diagram",
|
|
|
+ "dict": "http://ua.be/sdo2l/vocabulary/formalisms/dict",
|
|
|
+}
|
|
|
+
|
|
|
def to_oml_string_literal(python_string):
|
|
|
# Not sure which characters to escape in OML.
|
|
|
# At the very least, quotes should be escaped:
|
|
|
return '"' + python_string.replace('"', '\\"') + '"'
|
|
|
|
|
|
-def write_oml(drawio_file: abstract_syntax.DrawIOFile, oml_namespace:str, ostream: io.TextIOBase):
|
|
|
+def write_oml(drawio_file: abstract_syntax.DrawIOFile, ostream: io.TextIOBase):
|
|
|
import jinja2
|
|
|
import os
|
|
|
|
|
|
@@ -20,6 +34,7 @@ def write_oml(drawio_file: abstract_syntax.DrawIOFile, oml_namespace:str, ostrea
|
|
|
|
|
|
for piece in template.generate(
|
|
|
file=drawio_file,
|
|
|
- namespace=oml_namespace,
|
|
|
- enumerate=enumerate):
|
|
|
+ enumerate=enumerate,
|
|
|
+ output_shorthand="my_drawio",
|
|
|
+ namespaces=DTDESIGN_NAMESPACES):
|
|
|
ostream.write(piece)
|