@@ -25,9 +25,9 @@ use externalfiles::{ExternalHtml, LoadStringError, load_string};
25
25
26
26
use html_diff;
27
27
28
- use html:: render:: reset_ids;
28
+ use html:: render:: { render_text , reset_ids} ;
29
29
use html:: escape:: Escape ;
30
- use html:: render:: { USED_ID_MAP , render_difference} ;
30
+ use html:: render:: render_difference;
31
31
use html:: markdown;
32
32
use html:: markdown:: { Markdown , MarkdownWithToc , find_testable_code, old_find_testable_code} ;
33
33
use html:: markdown:: RenderType ;
@@ -101,19 +101,11 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
101
101
let ( hoedown_output, pulldown_output) = if include_toc {
102
102
// Save the state of USED_ID_MAP so it only gets updated once even
103
103
// though we're rendering twice.
104
- let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
105
- let hoedown_output = format ! ( "{}" , MarkdownWithToc ( text, RenderType :: Hoedown ) ) ;
106
- USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
107
- let pulldown_output = format ! ( "{}" , MarkdownWithToc ( text, RenderType :: Pulldown ) ) ;
108
- ( hoedown_output, pulldown_output)
104
+ render_text ( |ty| format ! ( "{}" , MarkdownWithToc ( text, ty) ) )
109
105
} else {
110
106
// Save the state of USED_ID_MAP so it only gets updated once even
111
107
// though we're rendering twice.
112
- let orig_used_id_map = USED_ID_MAP . with ( |map| map. borrow ( ) . clone ( ) ) ;
113
- let hoedown_output = format ! ( "{}" , Markdown ( text, RenderType :: Hoedown ) ) ;
114
- USED_ID_MAP . with ( |map| * map. borrow_mut ( ) = orig_used_id_map) ;
115
- let pulldown_output = format ! ( "{}" , Markdown ( text, RenderType :: Pulldown ) ) ;
116
- ( hoedown_output, pulldown_output)
108
+ render_text ( |ty| format ! ( "{}" , Markdown ( text, ty) ) )
117
109
} ;
118
110
119
111
let mut differences = html_diff:: get_differences ( & pulldown_output, & hoedown_output) ;
0 commit comments