Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions .ci/create-changes-html.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh
if [ $# != 2 ]; then
echo >&2 "usage: $0 BASE_DOC_COMMIT DOC_REPO"
echo >&2 "creates CHANGES.html in the current directory"
echo >&2 "for the diffs of DOC_REPO against BASE_DOC_COMMIT"
echo >&2 "Usage: $0 DIFF_TEXT DOC_REPO"
echo >&2 "This script generates a CHANGES.html file in the current directory"
echo >&2 "and adds anchor targets in the documents within DOC_REPO"
echo >&2 "based on the diff hunks in the DIFF_TEXT file."
exit 1
fi
BASE_DOC_COMMIT="$1"
DIFF_TEXT="$1"
DOC_REPOSITORY="$2"

# Create CHANGES.html
Expand Down Expand Up @@ -52,11 +53,10 @@ diffParagraphs.forEach(paragraph => {
EOF
echo '</head>' >> CHANGES.html
echo '<body>' >> CHANGES.html
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- "*.html") > diff.txt
python3 - << EOF
import os, re, html
from itertools import chain
with open('diff.txt', 'r') as f:
with open('$DIFF_TEXT', 'r') as f:
diff_text = f.read()
diff_blocks = re.split(r'^(?=diff --git)', diff_text, flags=re.MULTILINE)
out_blocks = []
Expand All @@ -83,12 +83,21 @@ for block in diff_blocks:
hunk_lines = []
search_result = re.search(r'@@ -(\d+),(\d+) \+(\d+),(\d+)', line)
if search_result:
line_number = int(search_result.group(3))
line_number = int(search_result.group(3)) - 1
span = int(search_result.group(4))
for i in chain(range(line_number, line_number + span), range(line_number - 1, -1, -1)):
if content[i].startswith('<') and not content[i].startswith('</'):
try:
ln = content[i]
except IndexError:
continue
for idx, char in enumerate(ln):
if not char.isspace():
break
else:
idx = len(ln)
if ln.startswith('<', idx) and not ln.startswith('</', idx):
count += 1
content[i] = f'<span id="hunk{count}" style="visibility: hidden;"></span>' + content[i]
content[i] = ln[:idx] + f'<span id="hunk{count}" style="visibility: hidden;"></span>' + ln[idx:]
hunks.append(f'<p class="hunk"><a href="{path}#hunk{count}" class="hunk" target="_blank">hunk #{count}</a></p>')
break
hunk_lines.append(line)
Expand All @@ -107,4 +116,4 @@ EOF
cat diff.html >> CHANGES.html
echo '</body>' >> CHANGES.html
echo '</html>' >> CHANGES.html
rm diff.txt diff.html
rm diff.html
7 changes: 4 additions & 3 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ jobs:
-e 's;#L[0-9]*";";' \
&& git commit -a -m 'wipe-out')
# Since HEAD is at commit 'wipe-out', HEAD~1 is commit 'new' (new doc), HEAD~2 is commit 'old' (old doc)
.ci/create-changes-html.sh $(cd doc && git rev-parse HEAD~2) doc
# Restore the new doc with changes made in create-changes-html.sh but dropping changes by "wipe out"
(cd doc && git stash -q && git checkout -q -f HEAD~1 && git stash pop -q)
(cd doc && git diff $(git rev-parse HEAD~2) -- "*.html") > diff.txt
# Restore the new doc dropping changes by "wipe out"
(cd doc && git checkout -q -f HEAD~1)
.ci/create-changes-html.sh diff.txt doc
# Sometimes rm -rf .git errors out because of some diehard hidden files
# So we simply move it out of the doc directory
(cd doc && mv .git ../git && mv .gitattributes ../gitattributes)
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/sagemath_doc_html/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets jupyter_sphinx sage_docbuild elliptic_curves furo fpylll graphs
sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets sage_docbuild elliptic_curves furo fpylll graphs

# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/sagemath_doc_html/dependencies_optional
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jupyter_sphinx
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ AC_ARG_ENABLE([cvxopt],
AC_ARG_ENABLE([notebook],
AS_HELP_STRING([--disable-notebook],
[disable build of the Jupyter notebook and related packages]), [
for pkg in notebook nbconvert beautifulsoup4 sagenb_export nbformat nbclient terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol argon2_cffi argon2_cffi_bindings webencodings tinycss2 ipympl soupsieve fastjsonschema anyio arrow async_lru fqdn isoduration json5 jsonpointer jsonschema_specifications jupyter_events jupyter_lsp jupyter_server jupyter_server_terminals jupyterlab jupyterlab_server jupyterlab_pygments jupyterlab_mathjax2 notebook_shim overrides python_json_logger pyyaml referencing rfc3339_validator rfc3986_validator sniffio types_python_dateutil uri_template webcolors websocket_client; do
for pkg in notebook nbconvert beautifulsoup4 sagenb_export nbformat nbclient terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol argon2_cffi argon2_cffi_bindings webencodings tinycss2 ipympl soupsieve fastjsonschema anyio arrow async_lru fqdn isoduration json5 jsonpointer jsonschema_specifications jupyter_events jupyter_lsp jupyter_server jupyter_server_terminals jupyterlab jupyterlab_server jupyterlab_pygments jupyterlab_mathjax2 jupyter_sphinx notebook_shim overrides python_json_logger pyyaml referencing rfc3339_validator rfc3986_validator sniffio types_python_dateutil uri_template webcolors websocket_client; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
])
Expand Down
5 changes: 5 additions & 0 deletions src/doc/ca/intro/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/thematische_anleitungen/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/de/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/el/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/constructions/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/developer/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/faq/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/installation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/prep/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/reference/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release, latex_elements, exclude_patterns
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/reference/conf_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release, exclude_patterns
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/thematic_tutorials/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/thematic_tutorials/numerical_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/tutorial/latex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ output of the entered commands automatically. You can start this
automatic rendering by executing ``%display latex`` (and stop by executing
``%display plain``).

.. ONLY:: html
.. ONLY:: html and feature_jupyter_sphinx

Thus, in the Jupyter notebook, you get

Expand Down
5 changes: 5 additions & 0 deletions src/doc/en/website/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/es/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/es/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import *


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/fr/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release, latex_elements
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/fr/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release, latex_elements
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/hu/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from sage_docbuild.conf import release
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
5 changes: 5 additions & 0 deletions src/doc/it/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from sage_docbuild.conf import release, latex_elements
from sage_docbuild.conf import * # NOQA


for tag in feature_tags():
tags.add(tag)


# Add any paths that contain custom static files (such as style sheets),
# relative to this directory to html_static_path. They are copied after the
# builtin static files, so a file named "default.css" will overwrite the
Expand Down
Loading