Skip to content

Commit a9d9d6b

Browse files
authored
Improve the gallery layout (#28)
1 parent f0470c6 commit a9d9d6b

File tree

6 files changed

+46
-65
lines changed

6 files changed

+46
-65
lines changed

docs/_static/style.css

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,6 @@ h1, h2, h3, h4, h5, h6 {
1818
font-weight: "normal"
1919
}
2020

21-
/* style for example gallery */
22-
.gmtgallery li {
23-
list-style: none!important;
24-
width: 180px!important;
25-
display: inline-grid!important;
26-
margin-right: 15px!important;
27-
}
28-
29-
/* style for gmt movies */
30-
.gmtmovie li {
31-
list-style: none;
32-
width: 45%;
33-
display: inline-grid;
34-
margin: 10px;
35-
}
36-
3721
/* Set tab-width to 2 spaces */
3822
.highlight {
3923
tab-size: 2;

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"myst_parser",
3434
"sphinx.ext.autosectionlabel",
3535
"sphinx.ext.extlinks",
36+
"sphinx_design",
3637
"sphinx_gmt.gmtplot",
3738
]
3839
# Add any paths that contain templates here, relative to this directory.

docs/contributing.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The following dependencies are required for building the GMT examples pages:
3737

3838
- `gmt <https://docs.generic-mapping-tools.org/latest/>`_ (GMT is required for executing example scripts)
3939
- `sphinx <http://www.sphinx-doc.org/>`_ (a Python documentation generator for creating the docs from source files)
40+
- `sphinx_design <https://sphinx-design.readthedocs.io/>`_ (A sphinx extension for designing beautiful, screen-size responsive web-components)
4041
- `sphinx_gmt <https://www.generic-mapping-tools.org/sphinx_gmt/latest/>`_ (a Sphinx extension for creating GMT figures to accompany example scripts)
4142
- `sphinx_rtd_theme <https://sphinx-rtd-theme.readthedocs.io/en/stable/>`_ (a Sphinx theme used for consistent documentation appearance between GMT projects)
4243

@@ -123,18 +124,14 @@ extension. To add a new gallery example or tutorial:
123124
by the ``sphinx_gmt`` extension.
124125

125126
* Add the file to the appropriate section in ``docs/index.rst`` using the following
126-
template:
127+
template::
127128

128-
::
129-
130-
```bash
131-
- .. image:: _images/<file-name>-gmtplot-0.png
132-
:target: gallery/<section>/<file-name>.html
133-
:width: 80%
134-
:align: center
129+
.. grid-item-card:: :doc:`gallery/<section>/<file-name>`
130+
:padding: 1
131+
:link-type: doc
132+
:link: gallery/<section>/<file-name>
135133

136-
:doc:`gallery/<section>/<file-name>`
137-
```
134+
.. image:: _images/<image-hash>.png
138135

139-
Edit the number in the ``.. image:: ...`` line to show a different figure on the
136+
Edit the hash in the ``.. image:: ...`` line to show a different figure on the
140137
index page.

docs/index.rst

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ There are two main components to GMT examples project:
1212
The gallery examples are designed to instruct users on how to complete a specific problem.
1313
They are how-to guides. It assumes you already know how to work with GMT.
1414

15-
The tutorials are learning orientated with the goal of teaching users GMT.
16-
They are designed to help beginners to understand how GMT works.
17-
If you want to learn GMT you should start here.
15+
The tutorials are learning orientated with the goal of teaching users GMT.
16+
They are designed to help beginners to understand how GMT works.
17+
If you want to learn GMT you should start here.
1818

1919
.. toctree::
2020
:hidden:
@@ -39,9 +39,6 @@ If you want to learn GMT you should start here.
3939

4040
contributing.rst
4141

42-
.. cssclass:: gmtgallery
43-
44-
4542
Gallery
4643
-------
4744

@@ -64,14 +61,14 @@ Images, contours, and fields
6461
3d plots
6562
~~~~~~~~
6663

67-
.. cssclass:: gmtgallery
64+
.. grid:: 2 3 3 4
6865

69-
- .. image:: _images/4546e1b4bf691b3b38010ff66e835609.png
70-
:target: gallery/3d_plots/grdview_surface.html
71-
:width: 80%
72-
:align: center
66+
.. grid-item-card:: :doc:`gallery/3d_plots/grdview_surface`
67+
:padding: 1
68+
:link-type: doc
69+
:link: gallery/3d_plots/grdview_surface
7370

74-
:doc:`gallery/3d_plots/grdview_surface`
71+
.. image:: _images/4546e1b4bf691b3b38010ff66e835609.png
7572

7673
Seismology and geodesy
7774
~~~~~~~~~~~~~~~~~~~~~~
@@ -91,39 +88,39 @@ Tutorials
9188
Basics
9289
~~~~~~
9390

94-
.. cssclass:: gmtgallery
91+
.. grid:: 2 3 3 4
9592

96-
- .. image:: _images/67b8930e41c80cad1a26bc81920b6abe.png
97-
:target: tutorials/basics/coastlines.html
98-
:width: 80%
99-
:align: center
93+
.. grid-item-card:: :doc:`tutorials/basics/coastlines`
94+
:padding: 1
95+
:link-type: doc
96+
:link: tutorials/basics/coastlines
10097

101-
:doc:`tutorials/basics/coastlines`
98+
.. image:: _images/67b8930e41c80cad1a26bc81920b6abe.png
10299

103-
- .. image:: _images/18736ae188d169a16383b28a3a7afcb8.png
104-
:target: tutorials/basics/frames.html
105-
:width: 80%
106-
:align: center
100+
.. grid-item-card:: :doc:`tutorials/basics/frames`
101+
:padding: 1
102+
:link-type: doc
103+
:link: tutorials/basics/frames
107104

108-
:doc:`tutorials/basics/frames`
105+
.. image:: _images/18736ae188d169a16383b28a3a7afcb8.png
109106

110-
- .. image:: _images/1db761511fa1371a3fa3f01cc3bdc199.png
111-
:target: tutorials/basics/region.html
112-
:width: 80%
113-
:align: center
107+
.. grid-item-card:: :doc:`tutorials/basics/region`
108+
:padding: 1
109+
:link-type: doc
110+
:link: tutorials/basics/region
114111

115-
:doc:`tutorials/basics/region`
112+
.. image:: _images/1db761511fa1371a3fa3f01cc3bdc199.png
116113

117-
- .. image:: _images/42eb572e679e97489f2a5029a5d74352.png
118-
:target: tutorials/basics/color.html
119-
:width: 80%
120-
:align: center
114+
.. grid-item-card:: :doc:`tutorials/basics/color`
115+
:padding: 1
116+
:link-type: doc
117+
:link: tutorials/basics/color
121118

122-
:doc:`tutorials/basics/color`
119+
.. image:: _images/42eb572e679e97489f2a5029a5d74352.png
123120

124-
- .. image:: _images/ec0d8d5349173bd8da9d665f6f93ea70.png
125-
:target: tutorials/basics/line.html
126-
:width: 80%
127-
:align: center
121+
.. grid-item-card:: :doc:`tutorials/basics/line`
122+
:padding: 1
123+
:link-type: doc
124+
:link: tutorials/basics/line
128125

129-
:doc:`tutorials/basics/line`
126+
.. image:: _images/ec0d8d5349173bd8da9d665f6f93ea70.png

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ dependencies:
77
- gmt=6.5.0
88
- myst-parser
99
- sphinx
10+
- sphinx-design
1011
- sphinx_gmt
1112
- sphinx_rtd_theme

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
myst-parser
22
sphinx
3+
sphinx-design
34
sphinx_gmt
45
sphinx_rtd_theme

0 commit comments

Comments
 (0)