Skip to content

Commit

Permalink
Disable displaying figure when gmt end show is used (#26)
Browse files Browse the repository at this point in the history
* Disable displaying figure when gmt end show is used
* Release v0.1.1 and update changelog
  • Loading branch information
seisman committed Sep 17, 2019
1 parent 11c7ed5 commit f703748
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Changelog
=========

Version 0.1.1
-------------

*Released on: 2019/09/16*

* Disable displaying figure when ``gmt end show`` is used (#26)

Version 0.1.0
-------------

Expand Down
1 change: 1 addition & 0 deletions doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Documentation for previous releases and the current development version (reflect

* `Development <https://www.generic-mapping-tools.org/sphinx_gmt/dev>`__
* `Latest release <https://www.generic-mapping-tools.org/sphinx_gmt/latest>`__
* `v0.1.1 <https://www.generic-mapping-tools.org/sphinx_gmt/v0.1.1>`__
* `v0.1.0 <https://www.generic-mapping-tools.org/sphinx_gmt/v0.1.0>`__
7 changes: 7 additions & 0 deletions sphinx_gmt/gmtplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ def eval_bash(code, code_dir, output_dir, output_base):
Execute a multi-line block of bash code and copy the generated image files
to specified output directory.
"""
# Change "gmt end show" to "gmt end" to avoid displaying figures
lines = code.splitlines()
for i in range(len(lines)):
if lines[i].split() == ["gmt", "end", "show"]:
lines[i] = "gmt end"
code = "\n".join(lines)

with tempfile.TemporaryDirectory() as tmpdir:
Path(tmpdir, "script.sh").write_text(code, encoding="utf-8")

Expand Down

0 comments on commit f703748

Please sign in to comment.