@@ -22,7 +22,7 @@ use syntax::token::{self, Token};
2222pub fn render_with_highlighting (
2323 src : & str ,
2424 class : Option < & str > ,
25- extension : Option < & str > ,
25+ playground_button : Option < & str > ,
2626 tooltip : Option < ( & str , & str ) > ,
2727) -> String {
2828 debug ! ( "highlighting: ================\n {}\n ==============" , src) ;
@@ -58,10 +58,7 @@ pub fn render_with_highlighting(
5858 Ok ( highlighted_source) => {
5959 write_header ( class, & mut out) . unwrap ( ) ;
6060 write ! ( out, "{}" , highlighted_source) . unwrap ( ) ;
61- if let Some ( extension) = extension {
62- write ! ( out, "{}" , extension) . unwrap ( ) ;
63- }
64- write_footer ( & mut out) . unwrap ( ) ;
61+ write_footer ( & mut out, playground_button) . unwrap ( ) ;
6562 }
6663 Err ( ( ) ) => {
6764 // If errors are encountered while trying to highlight, just emit
@@ -433,6 +430,6 @@ fn write_header(class: Option<&str>, out: &mut dyn Write) -> io::Result<()> {
433430 write ! ( out, "<div class=\" example-wrap\" ><pre class=\" rust {}\" >\n " , class. unwrap_or( "" ) )
434431}
435432
436- fn write_footer ( out : & mut dyn Write ) -> io:: Result < ( ) > {
437- write ! ( out, "</pre></div>\n " )
433+ fn write_footer ( out : & mut dyn Write , playground_button : Option < & str > ) -> io:: Result < ( ) > {
434+ write ! ( out, "</pre>{} </div>\n " , if let Some ( button ) = playground_button { button } else { "" } )
438435}
0 commit comments