From 1d3ec7e0c72483768b1a3b476f5a11434a2cdb80 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 31 May 2019 08:59:44 -0700 Subject: [PATCH] Support rust edition in playground. (#946) The endpoint was recently updated to support the edition param. --- src/theme/book.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/theme/book.js b/src/theme/book.js index 1aff593f..ca73ee14 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -101,11 +101,15 @@ function playpen_text(playpen) { } let text = playpen_text(code_block); + let classes = code_block.querySelector('code').classList; + let has_2018 = classes.contains("edition2018"); + let edition = has_2018 ? "2018" : "2015"; var params = { version: "stable", optimize: "0", - code: text + code: text, + edition: edition }; if (text.indexOf("#![feature") !== -1) {