1
Fork 0

std: Remove i18n/l10n from format!

* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
This commit is contained in:
Alex Crichton 2014-05-28 09:24:28 -07:00
parent f9260d41d6
commit cac7a2053a
57 changed files with 736 additions and 1087 deletions

View file

@ -43,7 +43,7 @@ r##"<!DOCTYPE html>
rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="{root_path}main.css">
{favicon, select, none{} other{<link rel="shortcut icon" href="#">}}
{favicon}
</head>
<body>
<!--[if lte IE 8]>
@ -54,10 +54,7 @@ r##"<!DOCTYPE html>
<![endif]-->
<section class="sidebar">
{logo, select, none{} other{
<a href='{root_path}{krate}/index.html'><img src='#' alt='' width='100'></a>
}}
{logo}
{sidebar}
</section>
@ -122,9 +119,20 @@ r##"<!DOCTYPE html>
content = *t,
root_path = page.root_path,
ty = page.ty,
logo = nonestr(layout.logo.as_slice()),
logo = if layout.logo.len() == 0 {
"".to_string()
} else {
format!("<a href='{}{}/index.html'>\
<img src='{}' alt='' width='100'></a>",
page.root_path, layout.krate,
layout.logo)
},
title = page.title,
favicon = nonestr(layout.favicon.as_slice()),
favicon = if layout.favicon.len() == 0 {
"".to_string()
} else {
format!(r#"<link rel="shortcut icon" href="{}">"#, layout.favicon)
},
sidebar = *sidebar,
krate = layout.krate,
play_url = layout.playground_url,
@ -136,10 +144,6 @@ r##"<!DOCTYPE html>
)
}
fn nonestr<'a>(s: &'a str) -> &'a str {
if s == "" { "none" } else { s }
}
pub fn redirect(dst: &mut io::Writer, url: &str) -> io::IoResult<()> {
write!(dst,
r##"<!DOCTYPE html>