|
14 | 14 | import sys |
15 | 15 | import warnings |
16 | 16 |
|
17 | | -from sphinx_gallery.scrapers import matplotlib_scraper |
18 | | -from sphinx_gallery.sorting import ExampleTitleSortKey |
19 | | - |
20 | 17 | import pyhdtoolkit |
21 | 18 |
|
22 | 19 | # ignore numpy warnings, see: |
|
28 | 25 | warnings.filterwarnings( |
29 | 26 | "ignore", |
30 | 27 | category=UserWarning, |
31 | | - message="Matplotlib is currently using agg, which is a" " non-GUI backend, so cannot show the figure.", |
| 28 | + message="Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.", |
32 | 29 | ) |
33 | 30 |
|
34 | 31 | TOPLEVEL_DIR = pathlib.Path(__file__).parent.parent.absolute() |
|
41 | 38 | # See: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_type_aliases |
42 | 39 | autodoc_type_aliases = {"ArrayLike": "ArrayLike"} |
43 | 40 |
|
44 | | -# To use SVG outputs when scraping matplotlib figures for the sphinx-gallery |
45 | | -class matplotlib_svg_scraper(object): |
46 | | - def __repr__(self): |
47 | | - return self.__class__.__name__ |
48 | | - |
49 | | - def __call__(self, *args, **kwargs): |
50 | | - return matplotlib_scraper(*args, format="svg", **kwargs) |
51 | | - |
52 | 41 |
|
53 | 42 | # -- Project information ----------------------------------------------------- |
54 | 43 |
|
@@ -145,7 +134,8 @@ def __call__(self, *args, **kwargs): |
145 | 134 | "sphinx_copybutton", # Add a "copy" button to code blocks |
146 | 135 | "sphinx_gallery.gen_gallery", # Build an HTML gallery of examples from a set of Python scripts |
147 | 136 | "sphinx_issues", # Link to project's issue tracker |
148 | | - "sphinx_panels", # Create panels in a grid layout or as drop-downs |
| 137 | + # "sphinx_panels", # Create panels in a grid layout or as drop-downs |
| 138 | + "sphinx_design", # successor to sphinx_panels, for grid layouts and drop-downs |
149 | 139 | "matplotlib.sphinxext.plot_directive", # Include a Matplotlib plot in a Sphinx document |
150 | 140 | "sphinx-prompt", # prompt symbols will not be copy-pastable |
151 | 141 | "sphinx_codeautolink", # Automatically link example code to documentation source |
@@ -176,19 +166,16 @@ def __call__(self, *args, **kwargs): |
176 | 166 | "examples_dirs": ["../examples"], # directory where to find plotting scripts |
177 | 167 | "gallery_dirs": ["gallery"], # directory where to store generated plots |
178 | 168 | "filename_pattern": "^((?!sgskip).)*$", # which files to execute, taken from matplotlib |
179 | | - "subsection_order": ExampleTitleSortKey, |
180 | | - "within_subsection_order": ExampleTitleSortKey, |
181 | | - "reference_url": {"pyhdtoolkit": None}, # Sets up intersphinx in gallery code |
182 | 169 | "backreferences_dir": "gen_modules/backreferences", # where function/class granular galleries are stored |
183 | 170 | # Modules for which function/class level galleries are created |
184 | 171 | "doc_module": "pyhdtoolkit", |
185 | | - "image_scrapers": (matplotlib_svg_scraper(),), # scrape gallery as SVG |
| 172 | + "image_scrapers": ("pyhdtoolkit.plotting.utils._matplotlib_svg_scraper",), # scrape gallery as SVG |
186 | 173 | "image_srcset": ["2x"], # use srcset twice as dense for high-resolution images display |
187 | 174 | "min_reported_time": 2, # minimum execution time to enable reporting |
188 | 175 | "remove_config_comments": True, # remove config comments from the code |
189 | 176 | "capture_repr": ("_repr_html_",), |
190 | 177 | "compress_images": ("images", "thumbnails", "-o1"), |
191 | | - "only_warn_on_example_error": True, # keep the build going if an example fails, very important for doc workflow |
| 178 | + "only_warn_on_example_error": True, # keep the build going if an example fails, important for doc workflow |
192 | 179 | } |
193 | 180 |
|
194 | 181 | # Config for the sphinx_panels extension |
@@ -352,9 +339,7 @@ def __call__(self, *args, **kwargs): |
352 | 339 | # Font configuration |
353 | 340 | # Fix fontspec converting " into right curly quotes in PDF |
354 | 341 | # cf https://github.com/sphinx-doc/sphinx/pull/6888/ |
355 | | -latex_elements[ |
356 | | - "fontenc" |
357 | | -] = r""" |
| 342 | +latex_elements["fontenc"] = r""" |
358 | 343 | \usepackage{fontspec} |
359 | 344 | \defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{} |
360 | 345 | """ |
@@ -406,9 +391,7 @@ def __call__(self, *args, **kwargs): |
406 | 391 |
|
407 | 392 |
|
408 | 393 | # Additional stuff for the LaTeX preamble. |
409 | | -latex_elements[ |
410 | | - "preamble" |
411 | | -] = r""" |
| 394 | +latex_elements["preamble"] = r""" |
412 | 395 | % Show Parts and Chapters in Table of Contents |
413 | 396 | \setcounter{tocdepth}{0} |
414 | 397 | % One line per author on title page |
|
0 commit comments