Skip to content

Commit d14f754

Browse files
PDF creation
1 parent 9417af3 commit d14f754

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

doc/Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,23 @@ clean:
2929
phtml:
3030
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -j auto
3131

32+
phtml-no-examples:
33+
export PYAEDT_SKIP_EXAMPLE="1"
34+
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -j auto
35+
3236
# Build pdf docs.
3337
pdf:
3438
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3539
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
3640
(test -f $(BUILDDIR)/latex/pyaedt.pdf && echo pdf exists) || exit 1
3741

42+
pdf-no-examples:
43+
export PYAEDT_SKIP_EXAMPLE="1"
44+
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
45+
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
46+
(test -f $(BUILDDIR)/latex/pyaedt.pdf && echo pdf exists) || exit 1
47+
48+
3849
# build docs like the CI build
3950
cibuild:
4051
mkdir source/examples -p

doc/make.bat

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ goto end
3333
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3434

3535
:pdf
36+
set PYAEDT_SKIP_EXAMPLE=1
37+
38+
3639
%SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
3740
cd "%BUILDDIR%\latex"
3841
for %%f in (*.tex) do (
39-
pdflatex "%%f" --interaction=nonstopmode)
42+
xelatex "%%f" --interaction=nonstopmode)
4043

4144
:end
4245
popd

doc/source/conf.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def setup(app):
100100
copyright = f"(c) {datetime.datetime.now().year} ANSYS, Inc. All rights reserved"
101101
author = "Ansys Inc."
102102
cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com")
103+
switcher_version = get_version_match(__version__)
103104

104105
# Check for the local config file, otherwise use default desktop configuration
105106
local_config_file = os.path.join(local_path, "local_config.json")
@@ -134,6 +135,7 @@ def setup(app):
134135
"sphinx.ext.inheritance_diagram",
135136
"numpydoc",
136137
"ansys_sphinx_theme.extension.linkcode",
138+
"recommonmark",
137139
]
138140

139141
# Intersphinx mapping
@@ -266,7 +268,7 @@ def setup(app):
266268
# necessary for pyvista when building the sphinx gallery
267269
pyvista.BUILDING_GALLERY = True
268270

269-
if config["run_examples"]:
271+
if config["run_examples"] and not os.environ.get("PYAEDT_SKIP_EXAMPLE", False):
270272
extensions.append("sphinx_gallery.gen_gallery")
271273

272274
sphinx_gallery_conf = {
@@ -340,6 +342,12 @@ def setup(app):
340342
"url": "https://github.com/ansys/pyaedt/discussions",
341343
"icon": "fa fa-comment fa-fw",
342344
},
345+
{
346+
"name": "Download documentation in PDF",
347+
"url": f"https://{cname}/version/{switcher_version}/_static/assets/download/pyaedt.pdf",
348+
# noqa: E501
349+
"icon": "fa fa-file-pdf fa-fw",
350+
},
343351
],
344352
"switcher": {
345353
"json_url": f"https://{cname}/versions.json",

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ doc = [
8282
"pypandoc>=1.10.0,<1.14",
8383
#"pytest-sphinx",
8484
"pyvista>=0.38.0,<0.44",
85-
#"recommonmark",
85+
"recommonmark",
8686
#"scikit-learn",
8787
"scikit-rf>=0.30.0,<0.33",
8888
"Sphinx==5.3.0; python_version == '3.7'",

0 commit comments

Comments
 (0)