Correct signature of hoedown callback for codespans
This commit is contained in:
parent
316f5e5acf
commit
16ec84b75f
1 changed files with 8 additions and 2 deletions
|
@ -74,7 +74,7 @@ type headerfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
|
||||||
libc::c_int, *mut libc::c_void);
|
libc::c_int, *mut libc::c_void);
|
||||||
|
|
||||||
type codespanfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
|
type codespanfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
|
||||||
*mut libc::c_void);
|
*mut libc::c_void) -> libc::c_int;
|
||||||
|
|
||||||
type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
|
type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
|
||||||
*const hoedown_buffer, *const hoedown_buffer,
|
*const hoedown_buffer, *const hoedown_buffer,
|
||||||
|
@ -317,7 +317,11 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
|
||||||
|
|
||||||
reset_headers();
|
reset_headers();
|
||||||
|
|
||||||
extern fn codespan(ob: *mut hoedown_buffer, text: *const hoedown_buffer, _: *mut libc::c_void) {
|
extern fn codespan(
|
||||||
|
ob: *mut hoedown_buffer,
|
||||||
|
text: *const hoedown_buffer,
|
||||||
|
_: *mut libc::c_void,
|
||||||
|
) -> libc::c_int {
|
||||||
let content = if text.is_null() {
|
let content = if text.is_null() {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
} else {
|
} else {
|
||||||
|
@ -329,6 +333,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
|
||||||
let content = format!("<code>{}</code>", Escape(&content));
|
let content = format!("<code>{}</code>", Escape(&content));
|
||||||
let element = CString::new(content).unwrap();
|
let element = CString::new(content).unwrap();
|
||||||
unsafe { hoedown_buffer_puts(ob, element.as_ptr()); }
|
unsafe { hoedown_buffer_puts(ob, element.as_ptr()); }
|
||||||
|
// Return anything except 0, which would mean "also print the code span verbatim".
|
||||||
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue