rustdoc: add cli argument --playground-url
This commit is contained in:
parent
87b76a521d
commit
dc3859d73e
2 changed files with 10 additions and 4 deletions
|
@ -469,10 +469,8 @@ pub fn run(mut krate: clean::Crate,
|
||||||
clean::NameValue(ref x, ref s)
|
clean::NameValue(ref x, ref s)
|
||||||
if "html_playground_url" == *x => {
|
if "html_playground_url" == *x => {
|
||||||
markdown::PLAYGROUND.with(|slot| {
|
markdown::PLAYGROUND.with(|slot| {
|
||||||
if slot.borrow().is_none() {
|
let name = krate.name.clone();
|
||||||
let name = krate.name.clone();
|
*slot.borrow_mut() = Some((Some(name), s.clone()));
|
||||||
*slot.borrow_mut() = Some((Some(name), s.clone()));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
clean::NameValue(ref x, ref s)
|
clean::NameValue(ref x, ref s)
|
||||||
|
|
|
@ -162,6 +162,10 @@ pub fn opts() -> Vec<RustcOptGroup> {
|
||||||
unstable(optmulti("Z", "",
|
unstable(optmulti("Z", "",
|
||||||
"internal and debugging options (only on nightly build)", "FLAG")),
|
"internal and debugging options (only on nightly build)", "FLAG")),
|
||||||
stable(optopt("", "sysroot", "Override the system root", "PATH")),
|
stable(optopt("", "sysroot", "Override the system root", "PATH")),
|
||||||
|
stable(optopt("", "playground-url",
|
||||||
|
"URL to send code snippets to, may be reset by --markdown-playground-url \
|
||||||
|
or `#![doc(html_playground_url=...)]`",
|
||||||
|
"URL")),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +234,10 @@ pub fn main_args(args: &[String]) -> isize {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(playground) = matches.opt_str("playground-url") {
|
||||||
|
html::markdown::PLAYGROUND.with(|s| { *s.borrow_mut() = Some((None, playground)); });
|
||||||
|
}
|
||||||
|
|
||||||
let test_args = matches.opt_strs("test-args");
|
let test_args = matches.opt_strs("test-args");
|
||||||
let test_args: Vec<String> = test_args.iter()
|
let test_args: Vec<String> = test_args.iter()
|
||||||
.flat_map(|s| s.split_whitespace())
|
.flat_map(|s| s.split_whitespace())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue