Footnote citation spacing (#488)

* Do not wrap footnotes or citations to make them responsive

* Remove margin below footnotes and citations, add margin-top to next element

* Remove margin-bottom from responsive citation and footnote wrapper

* Mark responsive wrapper if used for citation or footnote

* Document workaround for footnote and citation spacing

* Add vertical space if citation/footnote is last element in parent

This keeps correct vertical whitespace if the citation or footnote is the last element in a section.
The style rule directly above this line did not match since there is direct sibling.

* Clarify

Fixes #488
This commit is contained in:
Jesse Tan 2017-12-16 05:48:25 +01:00 committed by Aaron Carlisle
parent 59a37b3af9
commit a4b8eb468d
2 changed files with 19 additions and 1 deletions

View File

@ -79,9 +79,16 @@ function ThemeNav () {
})
// Make tables responsive
$("table.docutils:not(.field-list)")
$("table.docutils:not(.field-list,.footnote,.citation)")
.wrap("<div class='wy-table-responsive'></div>");
// Add extra class to responsive tables that contain
// footnotes or citations so that we can target them for styling
$("table.docutils.footnote")
.wrap("<div class='wy-table-responsive footnote'></div>");
$("table.docutils.citation")
.wrap("<div class='wy-table-responsive citation'></div>");
// Add expand links to all parents of nested ul
$('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () {
var link = $(this);

View File

@ -176,6 +176,17 @@
vertical-align: top
code
color: $gray
// Remove the large vertical space between citations and footnotes
.wy-table-responsive.citation, .wy-table-responsive.footnote
margin-bottom: 0
// Re-add vertical space to element directly following citation and footnotes,
// if the following element is of a different type
.wy-table-responsive.citation + :not(.citation),
.wy-table-responsive.footnote + :not(.footnote)
margin-top: $base-line-height
// Re-add vertical space after citation and footnotes if it is the last child of a parent
.wy-table-responsive.citation:last-child, .wy-table-responsive.footnote:last-child
margin-bottom: $base-line-height
table.docutils
@extend .wy-table
@extend .wy-table-bordered-all