Skip to content

Commit

Permalink
Improve pdf icon style
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Nov 13, 2023
1 parent 6b39c68 commit 3cb86b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
10 changes: 10 additions & 0 deletions src/doc/common/static/custom-furo.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ body[data-theme="dark"] div.highlight {
background: #383838;
}

/* Copied the same style for a.pdf from website/templates/index_furo.html */

a.pdf {
margin-right: 0.2em;
}

a.pdf:hover {
text-decoration: none;
}

25 changes: 14 additions & 11 deletions src/doc/en/website/templates/index_furo.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
border: none;
}
a.pdf {
margin-left: 0.5em;
{%- if hide_pdf_links %}
margin-right: 0.2em;
{%- if hide_pdf_links %}
display: none;
{%- endif %}
{%- endif %}
}
a.pdf:hover {
text-decoration: none;
}
table.contentstable {
align: center;
Expand Down Expand Up @@ -41,7 +44,7 @@ <h2>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/a_tour_of_sage/a_tour_of_sage.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/a_tour_of_sage/a_tour_of_sage.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="a_tour_of_sage/index.html">
Expand All @@ -55,7 +58,7 @@ <h2>
</td>
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/prep/prep_tutorials.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/prep/prep_tutorials.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="prep/index.html">
Expand All @@ -75,7 +78,7 @@ <h2>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/tutorial/sage_tutorial.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/tutorial/sage_tutorial.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="tutorial/index.html">
Expand All @@ -90,7 +93,7 @@ <h2>
</td>
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/constructions/constructions.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/constructions/constructions.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="constructions/index.html">
Expand All @@ -108,7 +111,7 @@ <h2>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/thematic_tutorials/thematic_tutorials.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/thematic_tutorials/thematic_tutorials.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="thematic_tutorials/index.html">
Expand All @@ -128,7 +131,7 @@ <h2>
</td>
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/faq/faq.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/faq/faq.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="faq/index.html">
Expand Down Expand Up @@ -184,7 +187,7 @@ <h2>
<tr valign="top">
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/installation/installation.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/installation/installation.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="installation/index.html">
Expand All @@ -201,7 +204,7 @@ <h2>
</td>
<td width="50%">
<p class="biglink">
<a title="Download PDF" class="pdf" href="../../pdf/en/developer/developer.pdf">
<a title="PDF" class="pdf" href="../../pdf/en/developer/developer.pdf">
<img class="icon" src="_static/pdf.png"></img>
</a>
<a class="biglink" href="developer/index.html">
Expand Down
4 changes: 2 additions & 2 deletions src/sage_docbuild/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,14 @@ def pdf(self):
#
# Change the third form to
#
# <a href="module/module.pdf">blah <img src="_static/pdf.png" /></a>
# <a href="module/module.pdf"><img src="_static/pdf.png">blah</a>
#
rst = re.sub(r'`([^`\n]*)`__.*\n\n__ (.*)',
r'<a href="\2">\1</a>.', rst)
rst = re.sub(r'`([^<\n]*)\s+<(.*)>`_',
r'<a href="\2">\1</a>', rst)
rst = re.sub(r':doc:`([^<]*?)\s+<(.*)/index>`',
r'<a href="../../../pdf/en/reference/\2/\2.pdf"><img src="_static/pdf.png"/></a>&nbsp;<a href="\2/index.html">\1</a> ', rst)
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)
# Body: add paragraph <p> markup.
start = rst.rfind('*\n') + 1
end = rst.find('\nUser Interfaces')
Expand Down

0 comments on commit 3cb86b5

Please sign in to comment.