Skip to content

Commit c4ac3f4

Browse files
author
Matthias Koeppe
committed
Merge branch 'p/doc-preview-for-all-languages' into ci_docbuild_pdf_no_html
2 parents 3bd7f38 + b4e7f60 commit c4ac3f4

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

.github/workflows/doc-build-pdf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
# For some reason the deploy step below cannot find /sage/...
119119
# So copy everything from there to local folder
120120
mkdir -p ./docs
121-
cp -r -L /sage/local/share/doc/sage/pdf/en/* ./docs
121+
cp -r -L /sage/local/share/doc/sage/pdf ./docs
122122
# Zip everything for increased performance
123123
zip -r docs-pdf.zip docs
124124

.github/workflows/doc-build.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ jobs:
6363
mathjax_path_to=$(SAGE_USE_CDNS=yes /sage/sage -python -c "from sage_docbuild.conf import mathjax_path; print(mathjax_path)")
6464
new_version=$(cat src/VERSION.txt)
6565
# Wipe out chronic diffs between old doc and new doc
66-
(cd /sage/local/share/doc/sage/html/en && \
66+
(cd /sage/local/share/doc/sage/html && \
6767
find . -name "*.html" | xargs sed -i -e '/class="sidebar-brand-text"/ s/Sage [0-9a-z.]* /Sage '"$new_version"' /' \
6868
-e 's;'"$mathjax_path_from"';'"$mathjax_path_to"';' \
6969
-e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
7070
# Create git repo from old doc
71-
(cd /sage/local/share/doc/sage/html/en && \
71+
(cd /sage/local/share/doc/sage/html && \
7272
git init && \
7373
(echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \
7474
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \
@@ -116,9 +116,9 @@ jobs:
116116
run: |
117117
set -ex
118118
export SAGE_USE_CDNS=yes
119-
mv /sage/local/share/doc/sage/html/en/.git /sage/.git-doc
119+
mv /sage/local/share/doc/sage/html/.git /sage/.git-doc
120120
make doc-clean doc-uninstall
121-
mkdir -p /sage/local/share/doc/sage/html/en/ && mv /sage/.git-doc /sage/local/share/doc/sage/html/en/.git
121+
mkdir -p /sage/local/share/doc/sage/html/ && mv /sage/.git-doc /sage/local/share/doc/sage/html/.git
122122
./config.status && make sagemath_doc_html-no-deps
123123
working-directory: ./worktree-image
124124
env:
@@ -131,9 +131,9 @@ jobs:
131131
run: |
132132
set -ex
133133
mkdir -p ./docs
134-
(cd /sage/local/share/doc/sage/html/en && git commit -a -m 'new')
134+
(cd /sage/local/share/doc/sage/html && git commit -a -m 'new')
135135
# Wipe out chronic diffs between old doc and new doc
136-
(cd /sage/local/share/doc/sage/html/en && \
136+
(cd /sage/local/share/doc/sage/html && \
137137
find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
138138
# Create CHANGES.html
139139
echo '<html>' > ./docs/CHANGES.html
@@ -162,7 +162,7 @@ jobs:
162162
EOF
163163
echo '</head>' >> ./docs/CHANGES.html
164164
echo '<body>' >> ./docs/CHANGES.html
165-
(cd /sage/local/share/doc/sage/html/en && git diff HEAD^; rm -rf .git) > ./docs/diff.txt
165+
(cd /sage/local/share/doc/sage/html && git diff HEAD^ -- *.html; rm -rf .git) > ./docs/diff.txt
166166
/sage/sage -python - << EOF
167167
import re, html
168168
with open('./docs/diff.txt', 'r') as f:
@@ -172,7 +172,7 @@ jobs:
172172
for block in diff_blocks:
173173
match = re.search(r'^diff --git a/(.*) b/\1', block, flags=re.MULTILINE)
174174
if match:
175-
path = match.group(1)
175+
path = 'html/' + match.group(1)
176176
out_blocks.append(f'<p class="diff"><a href="{path}">{path}</a>&emsp;</p>\n<pre><code class="language-diff">' + html.escape(block).strip() + '</code></pre>')
177177
output_text = '\n'.join(out_blocks)
178178
with open('./docs/diff.html', 'w') as f:
@@ -182,11 +182,12 @@ jobs:
182182
echo '</body>' >> ./docs/CHANGES.html
183183
echo '</html>' >>./docs/CHANGES.html
184184
rm ./docs/diff.txt ./docs/diff.html
185-
(cd /sage/local/share/doc/sage/html/en && git reset --hard HEAD)
185+
(cd /sage/local/share/doc/sage/html && git reset --hard HEAD)
186186
# For some reason the deploy step below cannot find /sage/...
187187
# So copy everything from there to local folder
188188
# We also need to replace the symlinks because netlify is not following them
189-
cp -r -L /sage/local/share/doc/sage/html/en/* ./docs
189+
cp -r -L /sage/local/share/doc/sage/html ./docs
190+
cp /sage/local/share/doc/sage/index.html ./docs
190191
# Zip everything for increased performance
191192
zip -r docs.zip docs
192193

.github/workflows/doc-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
header: preview-comment
7373
recreate: true
7474
message: |
75-
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready! :tada:
75+
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready! :tada:
7676
7777
- name: Update deployment status PR check
7878
uses: myrotvorets/[email protected]

src/sage/misc/sageinspect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,6 +1806,7 @@ def formatannotation(annotation, base_module=None):
18061806
return annotation.__module__ + '.' + annotation.__qualname__
18071807
return repr(annotation)
18081808

1809+
_formatannotation = formatannotation
18091810

18101811
def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
18111812
kwonlyargs=(), kwonlydefaults=None, annotations={},
@@ -1814,7 +1815,7 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
18141815
formatvarkw=None,
18151816
formatvalue=None,
18161817
formatreturns=None,
1817-
formatannotation=formatannotation):
1818+
formatannotation=None):
18181819
"""
18191820
Format an argument spec from the values returned by getfullargspec.
18201821
@@ -1851,6 +1852,8 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
18511852
formatvalue = lambda value: '=' + repr(value)
18521853
if formatreturns is None:
18531854
formatreturns = lambda text: ' -> ' + text
1855+
if formatannotation is None:
1856+
formatannotation = _formatannotation
18541857

18551858
def formatargandannotation(arg):
18561859
result = formatarg(arg)

0 commit comments

Comments
 (0)