Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
efc98fab
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
efc98fab
编写于
8月 22, 2015
作者:
E
Eljay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update hoedown to latest version (3.0.4).
上级
bc4df4ca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
62 addition
and
37 deletion
+62
-37
src/librustdoc/html/markdown.rs
src/librustdoc/html/markdown.rs
+46
-36
src/rt/hoedown
src/rt/hoedown
+1
-1
src/test/rustdoc/issue-27862.rs
src/test/rustdoc/issue-27862.rs
+15
-0
未找到文件。
src/librustdoc/html/markdown.rs
浏览文件 @
efc98fab
...
...
@@ -24,7 +24,6 @@
//! // ... something using html
//! ```
#![allow(dead_code)]
#![allow(non_camel_case_types)]
use
libc
;
...
...
@@ -51,7 +50,7 @@
pub
struct
MarkdownWithToc
<
'a
>
(
pub
&
'a
str
);
const
DEF_OUNIT
:
libc
::
size_t
=
64
;
const
HOEDOWN_EXT_NO_INTRA_EMPHASIS
:
libc
::
c_uint
=
1
<<
1
0
;
const
HOEDOWN_EXT_NO_INTRA_EMPHASIS
:
libc
::
c_uint
=
1
<<
1
1
;
const
HOEDOWN_EXT_TABLES
:
libc
::
c_uint
=
1
<<
0
;
const
HOEDOWN_EXT_FENCED_CODE
:
libc
::
c_uint
=
1
<<
1
;
const
HOEDOWN_EXT_AUTOLINK
:
libc
::
c_uint
=
1
<<
3
;
...
...
@@ -65,52 +64,63 @@
HOEDOWN_EXT_STRIKETHROUGH
|
HOEDOWN_EXT_SUPERSCRIPT
|
HOEDOWN_EXT_FOOTNOTES
;
type
hoedown_document
=
libc
::
c_void
;
// this is opaque to us
enum
hoedown_document
{}
type
blockcodefn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
);
*
const
hoedown_buffer
,
*
const
hoedown_renderer_data
);
type
blockquotefn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_renderer_data
);
type
headerfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
libc
::
c_int
,
*
mut
libc
::
c_void
);
libc
::
c_int
,
*
const
hoedown_renderer_data
);
type
blockhtmlfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_renderer_data
);
type
codespanfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
->
libc
::
c_int
;
*
const
hoedown_renderer_data
)
->
libc
::
c_int
;
type
linkfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
->
libc
::
c_int
;
*
const
hoedown_renderer_data
)
->
libc
::
c_int
;
type
entityfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_renderer_data
);
type
normaltextfn
=
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
);
*
const
hoedown_renderer_data
);
#[repr(C)]
struct
hoedown_renderer_data
{
opaque
:
*
mut
libc
::
c_void
,
}
#[repr(C)]
struct
hoedown_renderer
{
opaque
:
*
mut
libc
::
c_void
,
blockcode
:
Option
<
blockcodefn
>
,
blockquote
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
blockhtml
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
blockquote
:
Option
<
blockquotefn
>
,
header
:
Option
<
headerfn
>
,
other_block_level_callbacks
:
[
libc
::
size_t
;
9
],
other_block_level_callbacks
:
[
libc
::
size_t
;
11
],
blockhtml
:
Option
<
blockhtmlfn
>
,
/* span level callbacks - NULL or return 0 prints the span verbatim */
autolink
:
libc
::
size_t
,
// unused
codespan
:
Option
<
codespanfn
>
,
other_span_level_callbacks_1
:
[
libc
::
size_t
;
7
],
link
:
Option
<
linkfn
>
,
other_span_level_callbacks_2
:
[
libc
::
size_t
;
5
],
// hoedown will add `math` callback here, but we use an old version of it.
other_span_level_callbacks_2
:
[
libc
::
size_t
;
6
],
/* low level callbacks - NULL copies input directly into the output */
entity
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
entity
:
Option
<
entityfn
>
,
normal_text
:
Option
<
normaltextfn
>
,
/* header and footer */
doc_header
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
doc_footer
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
other_callbacks
:
[
libc
::
size_t
;
2
],
}
#[repr(C)]
...
...
@@ -120,7 +130,7 @@ struct hoedown_html_renderer_state {
flags
:
libc
::
c_uint
,
link_attributes
:
Option
<
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
)
>
,
*
const
hoedown_renderer_data
)
>
,
}
#[repr(C)]
...
...
@@ -133,7 +143,7 @@ struct html_toc_data {
struct
MyOpaque
{
dfltblk
:
extern
"C"
fn
(
*
mut
hoedown_buffer
,
*
const
hoedown_buffer
,
*
const
hoedown_buffer
,
*
mut
libc
::
c_void
),
*
const
hoedown_buffer
,
*
const
hoedown_renderer_data
),
toc_builder
:
Option
<
TocBuilder
>
,
}
...
...
@@ -153,7 +163,7 @@ fn hoedown_html_renderer_new(render_flags: libc::c_uint,
->
*
mut
hoedown_renderer
;
fn
hoedown_html_renderer_free
(
renderer
:
*
mut
hoedown_renderer
);
fn
hoedown_document_new
(
rndr
:
*
mu
t
hoedown_renderer
,
fn
hoedown_document_new
(
rndr
:
*
cons
t
hoedown_renderer
,
extensions
:
libc
::
c_uint
,
max_nesting
:
libc
::
size_t
)
->
*
mut
hoedown_document
;
fn
hoedown_document_render
(
doc
:
*
mut
hoedown_document
,
...
...
@@ -212,11 +222,11 @@ fn collapse_whitespace(s: &str) -> String {
pub
fn
render
(
w
:
&
mut
fmt
::
Formatter
,
s
:
&
str
,
print_toc
:
bool
)
->
fmt
::
Result
{
extern
fn
block
(
ob
:
*
mut
hoedown_buffer
,
orig_text
:
*
const
hoedown_buffer
,
lang
:
*
const
hoedown_buffer
,
opaque
:
*
mut
libc
::
c_void
)
{
lang
:
*
const
hoedown_buffer
,
data
:
*
const
hoedown_renderer_data
)
{
unsafe
{
if
orig_text
.is_null
()
{
return
}
let
opaque
=
opaque
as
*
mut
hoedown_html_renderer_state
;
let
opaque
=
(
*
data
)
.
opaque
as
*
mut
hoedown_html_renderer_state
;
let
my_opaque
:
&
MyOpaque
=
&*
((
*
opaque
)
.opaque
as
*
const
MyOpaque
);
let
text
=
(
*
orig_text
)
.as_bytes
();
let
origtext
=
str
::
from_utf8
(
text
)
.unwrap
();
...
...
@@ -228,7 +238,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
let
rlang
=
str
::
from_utf8
(
rlang
)
.unwrap
();
if
!
LangString
::
parse
(
rlang
)
.rust
{
(
my_opaque
.dfltblk
)(
ob
,
orig_text
,
lang
,
opaque
as
*
mut
libc
::
c_void
);
opaque
as
*
const
hoedown_renderer_data
);
true
}
else
{
false
...
...
@@ -261,7 +271,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
}
extern
fn
header
(
ob
:
*
mut
hoedown_buffer
,
text
:
*
const
hoedown_buffer
,
level
:
libc
::
c_int
,
opaque
:
*
mut
libc
::
c_void
)
{
level
:
libc
::
c_int
,
data
:
*
const
hoedown_renderer_data
)
{
// hoedown does this, we may as well too
unsafe
{
hoedown_buffer_puts
(
ob
,
"
\n\0
"
.as_ptr
()
as
*
const
_
);
}
...
...
@@ -280,7 +290,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
// This is a terrible hack working around how hoedown gives us rendered
// html for text rather than the raw text.
let
opaque
=
opaque
as
*
mut
hoedown_html_renderer_state
;
let
opaque
=
unsafe
{
(
*
data
)
.opaque
as
*
mut
hoedown_html_renderer_state
}
;
let
opaque
=
unsafe
{
&
mut
*
((
*
opaque
)
.opaque
as
*
mut
MyOpaque
)
};
// Make sure our hyphenated ID is unique for this page
...
...
@@ -320,7 +330,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
extern
fn
codespan
(
ob
:
*
mut
hoedown_buffer
,
text
:
*
const
hoedown_buffer
,
_
:
*
mut
libc
::
c_void
,
_
:
*
const
hoedown_renderer_data
,
)
->
libc
::
c_int
{
let
content
=
if
text
.is_null
()
{
""
.to_string
()
...
...
@@ -375,7 +385,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
extern
fn
block
(
_
ob
:
*
mut
hoedown_buffer
,
text
:
*
const
hoedown_buffer
,
lang
:
*
const
hoedown_buffer
,
opaque
:
*
mut
libc
::
c_void
)
{
data
:
*
const
hoedown_renderer_data
)
{
unsafe
{
if
text
.is_null
()
{
return
}
let
block_info
=
if
lang
.is_null
()
{
...
...
@@ -387,7 +397,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
};
if
!
block_info
.rust
{
return
}
let
text
=
(
*
text
)
.as_bytes
();
let
opaque
=
opaque
as
*
mut
hoedown_html_renderer_state
;
let
opaque
=
(
*
data
)
.
opaque
as
*
mut
hoedown_html_renderer_state
;
let
tests
=
&
mut
*
((
*
opaque
)
.opaque
as
*
mut
::
test
::
Collector
);
let
text
=
str
::
from_utf8
(
text
)
.unwrap
();
let
lines
=
text
.lines
()
.map
(|
l
|
{
...
...
@@ -402,9 +412,9 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
extern
fn
header
(
_
ob
:
*
mut
hoedown_buffer
,
text
:
*
const
hoedown_buffer
,
level
:
libc
::
c_int
,
opaque
:
*
mut
libc
::
c_void
)
{
level
:
libc
::
c_int
,
data
:
*
const
hoedown_renderer_data
)
{
unsafe
{
let
opaque
=
opaque
as
*
mut
hoedown_html_renderer_state
;
let
opaque
=
(
*
data
)
.
opaque
as
*
mut
hoedown_html_renderer_state
;
let
tests
=
&
mut
*
((
*
opaque
)
.opaque
as
*
mut
::
test
::
Collector
);
if
text
.is_null
()
{
tests
.register_header
(
""
,
level
as
u32
);
...
...
@@ -514,11 +524,11 @@ pub fn plain_summary_line(md: &str) -> String {
_
link
:
*
const
hoedown_buffer
,
_
title
:
*
const
hoedown_buffer
,
content
:
*
const
hoedown_buffer
,
opaque
:
*
mut
libc
::
c_void
)
->
libc
::
c_int
data
:
*
const
hoedown_renderer_data
)
->
libc
::
c_int
{
unsafe
{
if
!
content
.is_null
()
&&
(
*
content
)
.size
>
0
{
let
ob
=
opaque
as
*
mut
hoedown_buffer
;
let
ob
=
(
*
data
)
.
opaque
as
*
mut
hoedown_buffer
;
hoedown_buffer_put
(
ob
,
(
*
content
)
.data
as
*
const
libc
::
c_char
,
(
*
content
)
.size
);
}
...
...
@@ -528,10 +538,10 @@ pub fn plain_summary_line(md: &str) -> String {
extern
fn
normal_text
(
_
ob
:
*
mut
hoedown_buffer
,
text
:
*
const
hoedown_buffer
,
opaque
:
*
mut
libc
::
c_void
)
data
:
*
const
hoedown_renderer_data
)
{
unsafe
{
let
ob
=
opaque
as
*
mut
hoedown_buffer
;
let
ob
=
(
*
data
)
.
opaque
as
*
mut
hoedown_buffer
;
hoedown_buffer_put
(
ob
,
(
*
text
)
.data
as
*
const
libc
::
c_char
,
(
*
text
)
.size
);
}
...
...
hoedown
@
8ff3d82f
比较
238c4d57
...
8ff3d82f
Subproject commit
238c4d57cce10d33b05cf52a91fc62a09f31ffbb
Subproject commit
8ff3d82f2dde2cead36402a59c62d3e266c2f6ec
src/test/rustdoc/issue-27862.rs
0 → 100644
浏览文件 @
efc98fab
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/// Test | Table
/// ------|-------------
/// t = b | id = \|x\| x
pub
struct
Foo
;
// @has issue_27862/struct.Foo.html //td 'id = |x| x'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录