about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-09-09 07:38:58 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-09-09 12:07:13 -0700
commitb00db6801eb084d541cfb5c2158db814afd2f49f (patch)
tree2e013105c6a90f284a6e704a2fb45c6c8275e047 /src
parentc9b1e836c54d93fce254289ec04e0e829eaf74e8 (diff)
parent6c5c1ee34fd6e4e455f6691a0988fa0218f5c68c (diff)
downloadrust-b00db6801eb084d541cfb5c2158db814afd2f49f.tar.gz
rust-b00db6801eb084d541cfb5c2158db814afd2f49f.zip
rollup merge of #17090 : alexcrichton/rustdoc-no-strip
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/markdown.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 305c18480f6..86f56660d3a 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -153,27 +153,17 @@ local_data_key!(test_idx: Cell<uint>)
 local_data_key!(pub playground_krate: Option<String>)
 
 pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
-    extern fn block(ob: *mut hoedown_buffer, text: *const hoedown_buffer,
+    extern fn block(ob: *mut hoedown_buffer, orig_text: *const hoedown_buffer,
                     lang: *const hoedown_buffer, opaque: *mut libc::c_void) {
         unsafe {
-            if text.is_null() { return }
+            if orig_text.is_null() { return }
 
             let opaque = opaque as *mut hoedown_html_renderer_state;
             let my_opaque: &MyOpaque = &*((*opaque).opaque as *const MyOpaque);
-            slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {
+            slice::raw::buf_as_slice((*orig_text).data, (*orig_text).size as uint,
+                                     |text| {
                 let origtext = str::from_utf8(text).unwrap();
                 debug!("docblock: ==============\n{}\n=======", text);
-                let mut lines = origtext.lines().filter(|l| {
-                    stripped_filtered_line(*l).is_none()
-                });
-                let text = lines.collect::<Vec<&str>>().connect("\n");
-
-                let buf = hoedown_buffer {
-                    data: text.as_bytes().as_ptr(),
-                    size: text.len() as libc::size_t,
-                    asize: text.len() as libc::size_t,
-                    unit: 0,
-                };
                 let rendered = if lang.is_null() {
                     false
                 } else {
@@ -181,7 +171,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
                                            (*lang).size as uint, |rlang| {
                         let rlang = str::from_utf8(rlang).unwrap();
                         if LangString::parse(rlang).notrust {
-                            (my_opaque.dfltblk)(ob, &buf, lang,
+                            (my_opaque.dfltblk)(ob, orig_text, lang,
                                                 opaque as *mut libc::c_void);
                             true
                         } else {
@@ -190,6 +180,10 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
                     })
                 };
 
+                let mut lines = origtext.lines().filter(|l| {
+                    stripped_filtered_line(*l).is_none()
+                });
+                let text = lines.collect::<Vec<&str>>().connect("\n");
                 if !rendered {
                     let mut s = String::new();
                     let id = playground_krate.get().map(|krate| {