From 0b2746c8db6fc11965b1b6fd1d8536309a0d98b6 Mon Sep 17 00:00:00 2001
From: Oliver Middleton
Date: Tue, 11 Oct 2016 09:56:30 +0100
Subject: [PATCH] rustdoc: Improve playground run buttons
The main change is to stop using javascript to generate the URLs and use
rustdoc instead.
This also adds run buttons to the error index examples.
---
src/doc/footer.inc | 1 -
src/doc/rust.css | 8 +++--
src/librustdoc/html/layout.rs | 9 -----
src/librustdoc/html/markdown.rs | 43 ++++++++++++++++++----
src/librustdoc/html/render.rs | 8 ++---
src/librustdoc/html/static/extra.js | 25 -------------
src/librustdoc/html/static/playpen.js | 48 -------------------------
src/librustdoc/html/static/rustdoc.css | 1 -
src/librustdoc/markdown.rs | 10 ++----
src/librustdoc/test.rs | 2 +-
src/test/rustdoc/playground-empty.rs | 21 +++++++++++
src/test/rustdoc/playground-none.rs | 19 ++++++++++
src/test/rustdoc/playground.rs | 39 ++++++++++++++++++++
src/tools/error_index_generator/main.rs | 5 ++-
src/tools/rustbook/build.rs | 7 +---
15 files changed, 131 insertions(+), 115 deletions(-)
delete mode 100644 src/librustdoc/html/static/extra.js
delete mode 100644 src/librustdoc/html/static/playpen.js
create mode 100644 src/test/rustdoc/playground-empty.rs
create mode 100644 src/test/rustdoc/playground-none.rs
create mode 100644 src/test/rustdoc/playground.rs
diff --git a/src/doc/footer.inc b/src/doc/footer.inc
index 7513e524e73..77e151235e8 100644
--- a/src/doc/footer.inc
+++ b/src/doc/footer.inc
@@ -5,4 +5,3 @@ or the MIT license, at your op
This file may not be copied, modified, or distributed except according to those terms.
-
diff --git a/src/doc/rust.css b/src/doc/rust.css
index 262db5673e8..932594b9912 100644
--- a/src/doc/rust.css
+++ b/src/doc/rust.css
@@ -336,13 +336,11 @@ table th {
/* Code snippets */
-.rusttest { display: none; }
pre.rust { position: relative; }
a.test-arrow {
+ background-color: rgba(78, 139, 202, 0.2);
display: inline-block;
position: absolute;
-
- background-color: #4e8bca;
color: #f5f5f5;
padding: 5px 10px 5px 10px;
border-radius: 5px;
@@ -350,6 +348,10 @@ a.test-arrow {
top: 5px;
right: 5px;
}
+a.test-arrow:hover{
+ background-color: #4e8bca;
+ text-decoration: none;
+}
.unstable-feature {
border: 2px solid red;
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index b7c5876c4f9..5353642e294 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -19,7 +19,6 @@ pub struct Layout {
pub favicon: String,
pub external_html: ExternalHtml,
pub krate: String,
- pub playground_url: String,
}
pub struct Page<'a> {
@@ -136,11 +135,9 @@ r##"
- {play_js}