Skip to content

Commit 3c55fac

Browse files
author
Release Manager
committed
sagemathgh-36714: Deploy live doc preview with pdf docs Currently live doc preview lacks pdf docs though links to them are visible, as seen https://deploy-livedoc--sagemath-tobias.netlify.app/ We fix the problem. The live doc preview built with this PR is here: https://deploy-livedoc--sagemath.netlify.app/ <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [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 accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> - sagemath#36692 <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36714 Reported by: Kwankyu Lee Reviewer(s): Matthias Köppe
2 parents b53d773 + 400d0b8 commit 3c55fac

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ jobs:
5959
eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip)
6060
eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive)
6161
62-
6362
- name: Add prebuilt tree as a worktree
6463
id: worktree
6564
run: |

.github/workflows/doc-build.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,15 @@ jobs:
203203
if: (success() || failure()) && steps.copy.outcome == 'success' && github.repository == 'sagemath/sage' && github.ref == 'refs/heads/develop'
204204
run: |
205205
set -ex
206+
export PATH="build/bin:$PATH"
207+
eval $(sage-print-system-package-command auto update)
208+
eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip)
209+
eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive)
206210
export SAGE_USE_CDNS=yes
207211
export SAGE_LIVE_DOC=yes
208212
export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev
209213
make doc-clean doc-uninstall
210-
./config.status && make sagemath_doc_html-no-deps
214+
./config.status && make sagemath_doc_html-no-deps sagemath_doc_pdf-no-deps
211215
working-directory: ./worktree-image
212216
env:
213217
MAKE: make -j2 --output-sync=recurse
@@ -220,6 +224,7 @@ jobs:
220224
set -ex
221225
mkdir -p ./livedoc
222226
cp -r -L /sage/local/share/doc/sage/html ./livedoc
227+
cp -r -L /sage/local/share/doc/sage/pdf ./livedoc
223228
cp /sage/local/share/doc/sage/index.html ./livedoc
224229
zip -r livedoc.zip livedoc
225230

src/doc/common/static/custom-furo.css

+10
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ body[data-theme="dark"] div.highlight {
1111
background: #383838;
1212
}
1313

14+
/* Copied the style for a.pdf from website/templates/index_furo.html */
15+
16+
a.pdf {
17+
margin-right: 0.5em;
18+
}
19+
20+
a.pdf:hover {
21+
text-decoration: none;
22+
}
23+

src/doc/en/website/templates/index_furo.html

+15-12
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
border: none;
1111
}
1212
a.pdf {
13-
margin-left: 0.5em;
14-
{%- if hide_pdf_links %}
13+
margin-right: 0.3em;
14+
{%- if hide_pdf_links %}
1515
display: none;
16-
{%- endif %}
16+
{%- endif %}
17+
}
18+
a.pdf:hover {
19+
text-decoration: none;
1720
}
1821
table.contentstable {
1922
align: center;
@@ -41,7 +44,7 @@ <h2>
4144
<tr valign="top">
4245
<td width="50%">
4346
<p class="biglink">
44-
<a title="Download PDF" class="pdf" href="../../pdf/en/a_tour_of_sage/a_tour_of_sage.pdf">
47+
<a title="PDF" class="pdf" href="../../pdf/en/a_tour_of_sage/a_tour_of_sage.pdf">
4548
<img class="icon" src="_static/pdf.png"></img>
4649
</a>
4750
<a class="biglink" href="a_tour_of_sage/index.html">
@@ -55,7 +58,7 @@ <h2>
5558
</td>
5659
<td width="50%">
5760
<p class="biglink">
58-
<a title="Download PDF" class="pdf" href="../../pdf/en/prep/prep_tutorials.pdf">
61+
<a title="PDF" class="pdf" href="../../pdf/en/prep/prep_tutorials.pdf">
5962
<img class="icon" src="_static/pdf.png"></img>
6063
</a>
6164
<a class="biglink" href="prep/index.html">
@@ -75,7 +78,7 @@ <h2>
7578
<tr valign="top">
7679
<td width="50%">
7780
<p class="biglink">
78-
<a title="Download PDF" class="pdf" href="../../pdf/en/tutorial/sage_tutorial.pdf">
81+
<a title="PDF" class="pdf" href="../../pdf/en/tutorial/sage_tutorial.pdf">
7982
<img class="icon" src="_static/pdf.png"></img>
8083
</a>
8184
<a class="biglink" href="tutorial/index.html">
@@ -90,7 +93,7 @@ <h2>
9093
</td>
9194
<td width="50%">
9295
<p class="biglink">
93-
<a title="Download PDF" class="pdf" href="../../pdf/en/constructions/constructions.pdf">
96+
<a title="PDF" class="pdf" href="../../pdf/en/constructions/constructions.pdf">
9497
<img class="icon" src="_static/pdf.png"></img>
9598
</a>
9699
<a class="biglink" href="constructions/index.html">
@@ -108,7 +111,7 @@ <h2>
108111
<tr valign="top">
109112
<td width="50%">
110113
<p class="biglink">
111-
<a title="Download PDF" class="pdf" href="../../pdf/en/thematic_tutorials/thematic_tutorials.pdf">
114+
<a title="PDF" class="pdf" href="../../pdf/en/thematic_tutorials/thematic_tutorials.pdf">
112115
<img class="icon" src="_static/pdf.png"></img>
113116
</a>
114117
<a class="biglink" href="thematic_tutorials/index.html">
@@ -128,7 +131,7 @@ <h2>
128131
</td>
129132
<td width="50%">
130133
<p class="biglink">
131-
<a title="Download PDF" class="pdf" href="../../pdf/en/faq/faq.pdf">
134+
<a title="PDF" class="pdf" href="../../pdf/en/faq/faq.pdf">
132135
<img class="icon" src="_static/pdf.png"></img>
133136
</a>
134137
<a class="biglink" href="faq/index.html">
@@ -153,7 +156,7 @@ <h2>
153156
<tr valign="top">
154157
<td width="50%">
155158
<p class="biglink">
156-
<a title="Link to PDF" class="pdf" href="reference/index-pdf.html">
159+
<a title="PDF" class="pdf" href="reference/index-pdf.html">
157160
<img class="icon" src="_static/pdf.png"></img>
158161
</a>
159162
<a class="biglink" href="reference/index.html">
@@ -184,7 +187,7 @@ <h2>
184187
<tr valign="top">
185188
<td width="50%">
186189
<p class="biglink">
187-
<a title="Download PDF" class="pdf" href="../../pdf/en/installation/installation.pdf">
190+
<a title="PDF" class="pdf" href="../../pdf/en/installation/installation.pdf">
188191
<img class="icon" src="_static/pdf.png"></img>
189192
</a>
190193
<a class="biglink" href="installation/index.html">
@@ -201,7 +204,7 @@ <h2>
201204
</td>
202205
<td width="50%">
203206
<p class="biglink">
204-
<a title="Download PDF" class="pdf" href="../../pdf/en/developer/developer.pdf">
207+
<a title="PDF" class="pdf" href="../../pdf/en/developer/developer.pdf">
205208
<img class="icon" src="_static/pdf.png"></img>
206209
</a>
207210
<a class="biglink" href="developer/index.html">

src/sage_docbuild/builders.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,14 @@ def pdf(self):
720720
#
721721
# Change the third form to
722722
#
723-
# <a href="module/module.pdf">blah <img src="_static/pdf.png" /></a>
723+
# <a href="module/module.pdf"><img src="_static/pdf.png">blah</a>
724724
#
725725
rst = re.sub(r'`([^`\n]*)`__.*\n\n__ (.*)',
726726
r'<a href="\2">\1</a>.', rst)
727727
rst = re.sub(r'`([^<\n]*)\s+<(.*)>`_',
728728
r'<a href="\2">\1</a>', rst)
729729
rst = re.sub(r':doc:`([^<]*?)\s+<(.*)/index>`',
730-
r'<a href="../../../pdf/en/reference/\2/\2.pdf"><img src="_static/pdf.png"/></a>&nbsp;<a href="\2/index.html">\1</a> ', rst)
730+
r'<a title="PDF" class="pdf" href="../../../pdf/en/reference/\2/\2.pdf"><img src="_static/pdf.png"></a><a href="\2/index.html">\1</a> ', rst)
731731
# Body: add paragraph <p> markup.
732732
start = rst.rfind('*\n') + 1
733733
end = rst.find('\nUser Interfaces')

0 commit comments

Comments
 (0)