Skip to content

Commit 31b186c

Browse files
author
Release Manager
committed
sagemathgh-38274: Fix broken anchors in CHANGES.html of doc preview <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> broken by careless code in sagemath#38213: ``` # Restore the new doc from changes by "wipe out" (cd docs && git checkout -f) ``` which also wipes out anchors planted by `.ci/create-changes-html.sh`! To reviewer: changes over sagemath#38220 is in https://github.com/sagemath/sage/ pull/38274/commits/d2d1514148f46a4ceeea650eab1fd0a0800ebbc9 Tested in : https://github.com/kwankyu/sage/actions/runs/9659812609/job/26643993813. Try to open https://doc-pr-43--sagemath- test.netlify.app/html/en/reference/references/#hunk2 to check ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> sagemath#38220 URL: sagemath#38274 Reported by: Kwankyu Lee Reviewer(s):
2 parents 668da90 + d2d1514 commit 31b186c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.ci/create-changes-html.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ fi
88
BASE_DOC_COMMIT="$1"
99
DOC_REPOSITORY="$2"
1010

11-
# Wipe out chronic diffs between old doc and new doc
12-
(cd $DOC_REPOSITORY && find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
1311
# Create CHANGES.html
1412
echo '<html>' > CHANGES.html
1513
echo '<head>' >> CHANGES.html

.github/workflows/doc-build.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
git init && \
151151
(echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && \
152152
(echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; \
153-
git add -A && git commit --quiet -m "old")
153+
git add -A && git commit --quiet -m 'old')
154154
155155
- name: Build doc
156156
id: docbuild
@@ -175,13 +175,16 @@ jobs:
175175
docker cp --follow-link BUILD:/sage/local/share/doc/sage/html doc
176176
docker cp --follow-link BUILD:/sage/local/share/doc/sage/index.html doc
177177
(cd doc && git commit -a -m 'new')
178-
# Wipe out chronic diffs of new doc against old doc
178+
# Wipe out chronic diffs of new doc against old doc before creating CHANGES.html
179179
(cd doc && \
180180
find . -name "*.html" | xargs sed -i -e '/This is documentation for/ s/ built with GitHub PR .*. Doc/. Doc/' \
181-
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/')
182-
.ci/create-changes-html.sh $(cd doc && git rev-parse HEAD^) doc
183-
# Restore the new doc from changes by "wipe out"
184-
(cd doc && git checkout -f)
181+
-e '/<link rel="stylesheet"/ s/?v=[0-9a-f]*"/"/' \
182+
-e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d' \
183+
&& git commit -a -m 'wipe-out')
184+
# Since HEAD is at commit 'wipe-out', HEAD~1 is commit 'new' (new doc), HEAD~2 is commit 'old' (old doc)
185+
.ci/create-changes-html.sh $(cd doc && git rev-parse HEAD~2) doc
186+
# Restore the new doc with changes made in create-changes-html.sh but dropping changes by "wipe out"
187+
(cd doc && git stash -q && git checkout -q -f HEAD~1 && git stash pop -q)
185188
# Sometimes rm -rf .git errors out because of some diehard hidden files
186189
# So we simply move it out of the doc directory
187190
(cd doc && mv .git ../git && mv .gitattributes ../gitattributes)

0 commit comments

Comments
 (0)