Print warning whatever the rendering mode

This commit is contained in:
Guillaume Gomez 2017-07-31 23:04:32 +02:00
parent 33d99e526e
commit f2774b7ac3
7 changed files with 139 additions and 1114 deletions

1205
src/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ fn main() {
// Locate the actual compiler that we're invoking
env::remove_var("CC");
env::remove_var("CXX");
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();
cfg.cargo_metadata(false)
.out_dir("/")
.target(&target)

View File

@ -19,7 +19,7 @@ use std::path::Path;
fn main() {
let target = env::var("TARGET").expect("TARGET was not set");
let cfg = &mut gcc::Config::new();
let cfg = &mut gcc::Build::new();
let mut profile_sources = vec!["GCDAProfiling.c",
"InstrProfiling.c",

View File

@ -12,8 +12,6 @@ path = "lib.rs"
env_logger = { version = "0.4", default-features = false }
log = "0.3"
pulldown-cmark = { version = "0.0.14", default-features = false }
[target.'cfg(not(any(stage0, stage1)))'.dependencies]
html-diff = "0.0.3"
[build-dependencies]

View File

@ -14,7 +14,7 @@ extern crate gcc;
fn main() {
let src_dir = std::path::Path::new("../rt/hoedown/src");
build_helper::rerun_if_changed_anything_in_dir(src_dir);
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();
cfg.file("../rt/hoedown/src/autolink.c")
.file("../rt/hoedown/src/buffer.c")
.file("../rt/hoedown/src/document.c")

View File

@ -75,7 +75,6 @@ use html::item_type::ItemType;
use html::markdown::{self, Markdown, MarkdownHtml, MarkdownSummaryLine, RenderType};
use html::{highlight, layout};
#[cfg(not(any(stage0, stage1)))]
use html_diff;
/// A pair of name and its optional document.
@ -1648,33 +1647,23 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
Ok(())
}
#[cfg(not(any(stage0, stage1)))]
fn get_html_diff(w: &mut fmt::Formatter, md_text: &str, render_type: RenderType,
prefix: &str) -> fmt::Result {
if render_type == RenderType::Pulldown {
let output = format!("{}", Markdown(md_text, render_type));
let old = format!("{}", Markdown(md_text, RenderType::Hoedown));
let differences = html_diff::get_differences(&output, &old);
if !differences.is_empty() {
println!("Differences spotted in {:?}:\n{}",
md_text,
differences.iter()
.map(|s| format!("=> {}", s.to_string()))
.collect::<Vec<String>>()
.join("\n"));
}
write!(w, "<div class='docblock'>{}{}</div>", prefix, output)
} else {
write!(w, "<div class='docblock'>{}{}</div>",
prefix,
Markdown(md_text, render_type))
let output = format!("{}", Markdown(md_text, render_type));
let old = format!("{}", Markdown(md_text, match render_type {
RenderType::Hoedown => RenderType::Pulldown,
RenderType::Pulldown => RenderType::Hoedown,
}));
let differences = html_diff::get_differences(&output, &old);
if !differences.is_empty() {
println!("Differences spotted in {:?}:\n{}",
md_text,
differences.iter()
.map(|s| format!("=> {}", s.to_string()))
.collect::<Vec<String>>()
.join("\n"));
}
}
#[cfg(any(stage0, stage1))]
fn get_html_diff(w: &mut fmt::Formatter, md_text: &str, render_type: RenderType,
prefix: &str) -> fmt::Result {
write!(w, "<div class='docblock'>{}{}</div>", prefix, Markdown(md_text, render_type))
write!(w, "<div class='docblock'>{}{}</div>", prefix, output)
}
fn document_short(w: &mut fmt::Formatter, item: &clean::Item, link: AssocItemLink,

View File

@ -28,7 +28,6 @@
extern crate arena;
extern crate getopts;
extern crate env_logger;
#[cfg(not(any(stage0, stage1)))]
extern crate html_diff;
extern crate libc;
extern crate rustc;