Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate str representation during dot export #282

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 17 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,25 @@ please take a look at related PRs and issues and see if the change affects you.

### Fixed

- Fixed bug where (Ext)RelativeName scope providers accepted any referenced
object that contained the lookup name in its name. Thanks ipa-mdl@GitHub
([#267])
- Fixed bug in `flow_dsl` test project causing static files not being included
in package build/installation. Thanks sebix@GitHub ([#272]).
- Fixed bug, where user classes not used in the grammar caused exceptions
([#270]): now, when passing a list of user classes, you need to use them in
your grammar. You can alternatively also pass a callable (see metamodel.md;
[#273]). Also, using base classes for rules from imported grammars in
conjunction with user classes is not allowed and results in an exception.
- Fixed bug in `export.py` concerning html escaping in the dot export of a
textx meta-model ([#276]).
- Fixed bug where (Ext)RelativeName scope providers accepted any referenced
object that contained the lookup name in its name. Thanks ipa-mdl@GitHub
([#267])
- Fixed bug in `flow_dsl` test project causing static files not being included
in package build/installation. Thanks sebix@GitHub ([#272]).
- Fixed bug, where user classes not used in the grammar caused exceptions
([#270]): now, when passing a list of user classes, you need to use them in
your grammar. You can alternatively also pass a callable (see metamodel.md;
[#273]). Also, using base classes for rules from imported grammars in
conjunction with user classes is not allowed and results in an exception.
- Fixed bug in `export.py` concerning html escaping in the dot export of a
textx meta-model ([#276]).

### Changed

- Changed `unhashable type` exception when a list is used for `name` attributes by
raising a more informative exception and extending docs to document the issue
and a proper way to solve it ([#40], [#266]).
- Truncate long strings during dot export for better diagram readability ([#282]).
- Changed `unhashable type` exception when a list is used for `name` attributes by
raising a more informative exception and extending docs to document the issue
and a proper way to solve it ([#40], [#266]).


## [v2.2.0] (released: 2020-08-03)
Expand Down Expand Up @@ -486,6 +487,7 @@ please take a look at related PRs and issues and see if the change affects you.
- Export to dot.


[#282]: https://github.com/textX/textX/pull/282
[#276]: https://github.com/textX/textX/pull/276
[#274]: https://github.com/textX/textX/pull/274
[#273]: https://github.com/textX/textX/pull/273
Expand Down
6 changes: 5 additions & 1 deletion textx/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ def html_escape(s):

def dot_repr(o):
if type(o) is text:
return "'{}'".format(dot_escape(text(o)))
escaped = dot_escape(text(o))
if len(escaped) > 20:
return "'{}...'".format(escaped[:20])
else:
return "'{}'".format(escaped)
else:
return text(o)

Expand Down