Skip to content

Commit

Permalink
Make create_diagram() code compatible with latest version of railroad…
Browse files Browse the repository at this point in the history
…-diagrams; fixes #477
  • Loading branch information
ptmcg committed Apr 13, 2023
1 parent 6f6e1db commit 498adfa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Expand Up @@ -13,6 +13,13 @@ help from Devin J. Pohly in structuring the code to enable this peaceful transit
Version 3.2.0 will also discontinue support for Python versions 3.6 and 3.7.


Version 3.1.0b2 - (in development)
----------------------------------
- Updated create_diagram() code to be compatible with railroad-diagrams package
version 3.0. Fixes Issue #477 (railroad diagrams generated with black bars),
reported by Sam Morley-Short.


Version 3.1.0b1 - April, 2023
-----------------------------
- Added support for Python 3.12.
Expand Down
4 changes: 2 additions & 2 deletions pyparsing/__init__.py
Expand Up @@ -120,8 +120,8 @@ def __repr__(self):
return f"{__name__}.{type(self).__name__}({', '.join('{}={!r}'.format(*nv) for nv in zip(self._fields, self))})"


__version_info__ = version_info(3, 1, 0, "beta", 1)
__version_time__ = "08 Apr 2023 05:16 UTC"
__version_info__ = version_info(3, 1, 0, "beta", 2)
__version_time__ = "13 Apr 2023 03:01 UTC"
__version__ = __version_info__.__version__
__versionTime__ = __version_time__
__author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>"
Expand Down
5 changes: 4 additions & 1 deletion pyparsing/diagram/__init__.py
Expand Up @@ -144,7 +144,10 @@ def railroad_to_html(diagrams: List[NamedDiagram], embed=False, **kwargs) -> str
if diagram.diagram is None:
continue
io = StringIO()
diagram.diagram.writeSvg(io.write)
try:
diagram.diagram.writeStandalone(io.write)
except AttributeError:
diagram.diagram.writeSvg(io.write)
title = diagram.name
if diagram.index == 0:
title += " (root)"
Expand Down

0 comments on commit 498adfa

Please sign in to comment.