@@ -22,7 +22,7 @@ use syntax::token::{self, Token};
22
22
pub fn render_with_highlighting (
23
23
src : & str ,
24
24
class : Option < & str > ,
25
- extension : Option < & str > ,
25
+ playground_button : Option < & str > ,
26
26
tooltip : Option < ( & str , & str ) > ,
27
27
) -> String {
28
28
debug ! ( "highlighting: ================\n {}\n ==============" , src) ;
@@ -58,10 +58,7 @@ pub fn render_with_highlighting(
58
58
Ok ( highlighted_source) => {
59
59
write_header ( class, & mut out) . unwrap ( ) ;
60
60
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 ( ) ;
65
62
}
66
63
Err ( ( ) ) => {
67
64
// 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<()> {
433
430
write ! ( out, "<div class=\" example-wrap\" ><pre class=\" rust {}\" >\n " , class. unwrap_or( "" ) )
434
431
}
435
432
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 { "" } )
438
435
}
0 commit comments