Skip to content

Commit 84fb6da

Browse files
committed
Fix pdf doc build
1 parent e349b00 commit 84fb6da

File tree

7 files changed

+49
-27
lines changed

7 files changed

+49
-27
lines changed

.github/workflows/doc-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ jobs:
206206
export SAGE_LIVE_DOC=yes
207207
export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev
208208
make doc-clean doc-uninstall
209-
./config.status && make sagemath_doc_html-no-deps
209+
./config.status && make doc-html && make doc-pdf
210210
working-directory: ./worktree-image
211211
env:
212212
MAKE: make -j2 --output-sync=recurse

src/doc/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ doc-inventory-reference: doc-src
4646
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-inventory--reference_top
4747
endif
4848

49-
# reference manual, html
50-
doc-html-reference: doc-inventory-reference
49+
# sub docs of reference manual, html
50+
doc-html-reference-sub: doc-inventory-reference
5151
$(eval DOCS = $(shell sage --docbuild --all-documents reference))
5252
@if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi
5353
$(eval BIBLIO = $(firstword $(DOCS)))
5454
$(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS)))
5555
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--$(subst /,-,$(BIBLIO))
5656
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(OTHER_DOCS), doc-html--$(subst /,-,$(doc)))
57+
58+
# reference manual, html; reference_top is built after sub docs
59+
doc-html-reference: doc-html-reference-sub
5760
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-html--reference_top
5861

5962
# other documentation, html
@@ -79,16 +82,13 @@ doc-pdf-reference: doc-inventory-reference
7982
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-pdf--reference_top
8083

8184
# other documentation, pdf
82-
doc-pdf-other: doc-html-reference
85+
doc-pdf-other: doc-pdf-reference
8386
$(eval DOCS = $(shell sage --docbuild --all-documents all))
8487
@if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi
8588
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-pdf--$(subst /,-,$(doc)))
8689

87-
# website with pdf links
88-
doc-pdf-website:
89-
sage --docbuild website html $(SAGE_DOCBUILD_OPTS)
90+
doc-pdf: doc-pdf-reference doc-pdf-other
9091

91-
doc-pdf: doc-pdf-reference doc-pdf-other doc-pdf-website
9292

9393
.PHONY: all clean \
9494
doc-src \

src/doc/en/reference/references/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,13 @@ REFERENCES:
960960
.. [BL2003] \S. Brlek, A. Ladouceur, A note on differentiable palindromes,
961961
Theoret. Comput. Sci. 302 (2003) 167--178.
962962
963+
.. [BLL1998] \F. Bergeron, G. Labelle, and P. Leroux.
964+
"Combinatorial species and tree-like structures".
965+
Encyclopedia of Mathematics and its Applications, vol. 67, Cambridge Univ. Press. 1998.
966+
967+
.. [BLL2008] François Bergeron, Gilbert Labelle, and Pierre Leroux.
968+
"Introduction to the Theory of Species of Structures", March 14, 2008.
969+
963970
.. [BraLea2008] \C. Bracken and Gregor Leander: *New families of functions
964971
with differential uniformity of 4*, Proceedings of the Conference
965972
BFCA, Copenhagen, 2008.

src/sage/combinat/species/generating_series.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030
sage: s[3] # optional - sage.modules
3131
p[1, 1, 1] + p[2, 1]
3232
33-
REFERENCES:
34-
35-
.. [BLL] \F. Bergeron, G. Labelle, and P. Leroux.
36-
"Combinatorial species and tree-like structures".
37-
Encyclopedia of Mathematics and its Applications, vol. 67, Cambridge Univ. Press. 1998.
38-
.. [BLL-Intro] François Bergeron, Gilbert Labelle, and Pierre Leroux.
39-
"Introduction to the Theory of Species of Structures", March 14, 2008.
4033
"""
4134

4235
# ****************************************************************************
@@ -217,7 +210,7 @@ def functorial_composition(self, y):
217210
218211
REFERENCES:
219212
220-
- Section 2.2 of [BLL]_.
213+
- Section 2.2 of [BLL1998]_.
221214
222215
EXAMPLES::
223216
@@ -651,7 +644,7 @@ def LogarithmCycleIndexSeries(R=QQ):
651644
Return the cycle index series of the virtual species `\Omega`, the
652645
compositional inverse of the species `E^{+}` of nonempty sets.
653646
654-
The notion of virtual species is treated thoroughly in [BLL]_.
647+
The notion of virtual species is treated thoroughly in [BLL1998]_.
655648
The specific algorithm used here to compute the cycle index of
656649
`\Omega` is found in [Labelle2008]_.
657650

src/sage/rings/lazy_series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6219,7 +6219,7 @@ def functorial_composition(self, *args):
62196219
whose labels are the set of all `G`-structures on `A`.
62206220
62216221
The Frobenius character (or cycle index series) of `F \Box G`
6222-
can be computed as follows, see section 2.2 of [BLL]_):
6222+
can be computed as follows, see section 2.2 of [BLL1998]_):
62236223
62246224
.. MATH::
62256225

src/sage_docbuild/builders.py

+30-8
Original file line numberDiff line numberDiff line change
@@ -637,17 +637,21 @@ def pdf(self):
637637
"""
638638
super().pdf()
639639

640-
# we need to build master index file which lists all
641-
# of the PDF file. So we create an html file, based on
642-
# the file index.html from the "reference_top" target.
643-
644-
# First build the top reference page. This only takes a few seconds.
645-
getattr(get_builder('reference_top'), 'html')()
640+
# We want to build master index file which lists all of the PDF file.
641+
# We modify the file index.html from the "reference_top" target, if it
642+
# exists. Otherwise, we are done.
646643

647644
from sage.env import SAGE_DOC
648645
reference_dir = os.path.join(SAGE_DOC, 'html', 'en', 'reference')
649646
output_dir = self._output_dir('pdf')
650647

648+
# Check if the top reference index.html exists.
649+
try:
650+
with open(os.path.join(reference_dir, 'index.html')) as f:
651+
html = f.read()
652+
except FileNotFoundError:
653+
return
654+
651655
# Install in output_dir a symlink to the directory containing static files.
652656
# Prefer relative path for symlinks.
653657
relpath = os.path.relpath(reference_dir, output_dir)
@@ -657,8 +661,6 @@ def pdf(self):
657661
pass
658662

659663
# Now modify top reference index.html page and write it to output_dir.
660-
with open(os.path.join(reference_dir, 'index.html')) as f:
661-
html = f.read()
662664
html_output_dir = os.path.dirname(reference_dir)
663665

664666
# Fix links in navigation bar
@@ -1051,13 +1053,33 @@ def get_modules(self, filename):
10511053
Given a filename for a reST file, return an iterator for
10521054
all of the autogenerated reST files that it includes.
10531055
"""
1056+
from sage.features.all import all_features
1057+
10541058
# Create the regular expression used to detect an autogenerated file
10551059
auto_re = re.compile(r'^\s*(..\/)*(sage(_docbuild)?\/[\w\/]*)\s*$')
10561060

10571061
# Read the lines
10581062
with open(filename) as f:
10591063
lines = f.readlines()
1064+
1065+
skip = False
10601066
for line in lines:
1067+
if skip:
1068+
if not line.strip() or line.count(' ', 0) >= indent:
1069+
continue
1070+
skip = False
1071+
elif line.lstrip().lower().startswith('.. only::'):
1072+
try:
1073+
tag_name = line[line.index('feature_') + 8:].strip()
1074+
for feature in all_features():
1075+
if tag_name == feature.name.replace('.', '_'):
1076+
break
1077+
else:
1078+
skip = True
1079+
indent = line.index('.. ') + 3
1080+
continue
1081+
except ValueError:
1082+
pass
10611083
match = auto_re.match(line)
10621084
if match:
10631085
yield match.group(2).replace(os.path.sep, '.')

src/sage_docbuild/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def set_intersphinx_mappings(app, config):
296296
intersphinx.normalize_intersphinx_mapping(app, config)
297297

298298

299-
# By default document are not master.
299+
# By default document is master.
300300
multidocs_is_master = True
301301

302302
# https://sphinx-copybutton.readthedocs.io/en/latest/use.html

0 commit comments

Comments
 (0)