Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup test links #1741

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mdbook-spec/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ impl Spec {
let mut test_html = String::new();
if let Some(tests) = tests.get(rule_id) {
test_html = format!(
"<span class=\"popup-container\">\n\
&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:void(0)\" onclick=\"spec_toggle_tests('{rule_id}');\">\
Tests</a>\n\
"<br><span class=\"popup-container\">\n\
<a href=\"javascript:void(0)\" onclick=\"spec_toggle_tests('{rule_id}');\">\
<span>Tests</span></a>\n\
<div id=\"tests-{rule_id}\" class=\"tests-popup popup-hidden\">\n\
Tests with this rule:
<ul>");
Expand Down
26 changes: 21 additions & 5 deletions theme/reference.css
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ main {
display: grid;
grid-template-columns:
/* Left margin / place for rules */
[rules] minmax(20px, 1fr)
[rules] minmax(36px, 1fr)
/* The main text body */
[text] auto
/* Right margin */
[margin] minmax(20px, 1fr);
[margin] minmax(36px, 1fr);

/* We do these by hand via the grid */
margin: 0;
Expand Down Expand Up @@ -302,6 +302,17 @@ main > .rule {
color: #999 !important;
}

/* Test links */
.rule .popup-container {
float: right;
padding-right: 10px;
}

.rule .popup-container > a {
float: right;
text-align: right;
}

/* When clicking a rule, it is added as a URL fragment and the browser will
navigate to it. This adds an indicator that the linked rule is the one that
is "current", just like normal headers are in mdbook.
Expand All @@ -326,13 +337,18 @@ main > .rule {
The cutoff point is chosen semi-arbitrary, it felt that
when `width < 14em`, there are too many breaks. */
@container rule (width < 14em) {
main > .rule a span {
main > .rule a.rule-link span,
main > .rule .popup-container > a span {
display: none;
}

main > .rule a::before {
main > .rule > a.rule-link::before {
content: "[*]";
}
}

main > .rule .popup-container > a::before {
content: "[T]";
}
}

/* Align rules to various siblings */
Expand Down