Auto merge of #31902 - mitaa:rdoc-shorter, r=alexcrichton
fixes #31899 r? @alexcrichton
This commit is contained in:
commit
095f5e7c81
@ -250,7 +250,9 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
|
||||
let text = lines.collect::<Vec<&str>>().join("\n");
|
||||
if rendered { return }
|
||||
PLAYGROUND_KRATE.with(|krate| {
|
||||
let mut s = String::new();
|
||||
// insert newline to clearly separate it from the
|
||||
// previous block so we can shorten the html output
|
||||
let mut s = String::from("\n");
|
||||
krate.borrow().as_ref().map(|krate| {
|
||||
let test = origtext.lines().map(|l| {
|
||||
stripped_filtered_line(l).unwrap_or(l)
|
||||
|
@ -1657,8 +1657,8 @@ fn shorter<'a>(s: Option<&'a str>) -> String {
|
||||
|
||||
#[inline]
|
||||
fn plain_summary_line(s: Option<&str>) -> String {
|
||||
let md = markdown::plain_summary_line(s.unwrap_or(""));
|
||||
shorter(Some(&md)).replace("\n", " ")
|
||||
let line = shorter(s).replace("\n", " ");
|
||||
markdown::plain_summary_line(&line[..])
|
||||
}
|
||||
|
||||
fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result {
|
||||
|
70
src/test/rustdoc/issue-31899.rs
Normal file
70
src/test/rustdoc/issue-31899.rs
Normal file
@ -0,0 +1,70 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
|
||||
// @has issue_31899/index.html
|
||||
// @has - 'Make this line a bit longer.'
|
||||
// @!has - 'rust rust-example-rendered'
|
||||
// @!has - 'use ndarray::arr2'
|
||||
// @!has - 'prohibited'
|
||||
|
||||
/// A tuple or fixed size array that can be used to index an array.
|
||||
/// Make this line a bit longer.
|
||||
///
|
||||
/// ```
|
||||
/// use ndarray::arr2;
|
||||
///
|
||||
/// let mut a = arr2(&[[0, 1], [0, 0]]);
|
||||
/// a[[1, 1]] = 1;
|
||||
/// assert_eq!(a[[0, 1]], 1);
|
||||
/// assert_eq!(a[[1, 1]], 1);
|
||||
/// ```
|
||||
///
|
||||
/// **Note** the blanket implementation that's not visible in rustdoc:
|
||||
/// `impl<D> NdIndex for D where D: Dimension { ... }`
|
||||
pub fn bar() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// # prohibited
|
||||
pub fn foo() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// 1. prohibited
|
||||
/// 2. bar
|
||||
pub fn baz() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// - prohibited
|
||||
/// - bar
|
||||
pub fn qux() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// * prohibited
|
||||
/// * bar
|
||||
pub fn quz() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// > prohibited
|
||||
/// > bar
|
||||
pub fn qur() {}
|
||||
|
||||
/// Some line
|
||||
///
|
||||
/// prohibited
|
||||
/// =====
|
||||
///
|
||||
/// Second
|
||||
/// ------
|
||||
pub fn qut() {}
|
Loading…
Reference in New Issue
Block a user