GenericMappingTools / sphinx_gmt

Sphinx extensions for GMT
https://www.generic-mapping-tools.org/sphinx_gmt
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Convert gmt-plot directive to a rst snippet instead of HTML #6

Closed seisman closed 5 years ago

seisman commented 6 years ago

If I understand the codes correctly, this extension convert gmt-plot directive to an HTML snippet using a Jinja template.

I think it's better to convert gmt-plot directive to a rst snippet.

.. gmt-plot::
    :figure: example_02.png

    gmt begin map ps
    gmt ...
    gmt end

should be equivalent to:

.. figure:: images/xxx.png
   :options:

.. code-block::

   gmt begin map pdf
   gmt ...
   gmt end

This is exactly how the matplotlib's plot directive does (see https://github.com/matplotlib/matplotlib/blob/f93222a555160bf967f02dae42cce39a03384774/lib/matplotlib/sphinxext/plot_directive.py#L348).

leouieda commented 6 years ago

Yep, you're absolutely right. This would also make it work for PDF or EPUB output.