Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 98b271f

Browse files
authored
Merge pull request #1241 from bjones1/style_fix
Fix: CSS.
2 parents cf73f76 + 1ab930c commit 98b271f

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

runestone/common/css/runestone-custom-sphinx-bootstrap.css

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,92 @@ h2 {
456456
font-weight: normal;
457457
}
458458

459+
/*
460+
Missing brackets
461+
================
462+
The default styling from Sphinx's ``basic.css`` doesn't style multiple references to the same reference with brackets. Here's the relevant snippet of CSS:
463+
464+
.. code-block:: CSS
465+
:number-lines:
466+
467+
a.brackets:before,
468+
span.brackets > a:before{
469+
content: "[";
470+
}
471+
472+
a.brackets:after,
473+
span.brackets > a:after {
474+
content: "]";
475+
}
476+
477+
The HTML for a footnote reference is:
478+
479+
.. code-block:: HTML
480+
:number-lines:
481+
482+
<a class="footnote-reference brackets" href="#assembled" id="id1">2</a>
483+
484+
The HTML for a typical footnote is:
485+
486+
.. code-block:: HTML
487+
:number-lines:
488+
489+
<dl class="footnote brackets">
490+
<dt class="label" id="xxx">
491+
<span class="brackets">
492+
<a class="fn-backref" href="#id2">1</a>
493+
</span>
494+
</dt>
495+
<dd>Omitted this...</dd>
496+
</dl>
497+
498+
The HTML for a footnote referenced multiple times is:
499+
500+
.. code-block:: HTML
501+
:number-lines:
502+
503+
<dl class="footnote brackets">
504+
<dt class="label" id="xxx">
505+
<span class="brackets">1</span>
506+
<span class="fn-backref">
507+
(<a href="#id1">1</a>,<a href="#id2">2</a>,<a href="#id3">3</a>)
508+
</span>
509+
</dt>
510+
<dd>Omitted this...</dd>
511+
</dl>
512+
513+
However, there's no (current) CSS selector that will add a ``content`` to the multiply-referenced footnote without adding an additional ``content`` to the typical footnote: we want to select ``dt.label > span.brackets > text-only content`` or ``dt.label > span.brackets > :not(:has a)`` (see the unsupported `:has selector <https://css-tricks.com/did-you-know-about-the-has-css-selector/>`_. So, I see no solution for this (outside JS).
514+
515+
516+
Incorrect color
517+
===============
518+
Second, the Bootstrap theme (v3.4.1) contains the following CSS, from ``node_modules/bootstrap/dist/css/less/labels.less``:
519+
520+
.. code-block:: CSS
521+
:number-lines:
522+
523+
.label {
524+
display: inline;
525+
padding: .2em .6em .3em;
526+
font-size: 75%;
527+
font-weight: 700;
528+
line-height: 1;
529+
color: @label-color;
530+
text-align: center;
531+
white-space: nowrap;
532+
vertical-align: baseline;
533+
border-radius: .25em;
534+
535+
...more here omitted...
536+
}
537+
538+
ALL this therefore gets applied to footnotes, since they have the ``label`` class. Because the ``@label-color`` is white, this CSS makes the reference invisible against the default (light mode) white background. I like the rest of the styling changes (even though they differ from the standard Sphinx settings), so only the color is changed.
539+
*/
540+
dt.label > span.brackets:not(span.brackets > a),
541+
dt.label > span.fn-backref:not(span.fn-backref > a) {
542+
color: black;
543+
}
544+
459545
/* These admonition styles styles are copied from the Bootstrap .alert classes.
460546
Most of the !important declarations are to override the Sphinx basic.css styles */
461547
.admonition {

0 commit comments

Comments
 (0)