When inventing a title from a slug, add some capitalization
This commit is contained in:
parent
ad4addfc8c
commit
9d0ca63aa9
4 changed files with 14 additions and 1 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -591,6 +591,7 @@ dependencies = [
|
||||||
"serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_urlencoded 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"slug 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"static_resource_derive 0.1.0",
|
"static_resource_derive 0.1.0",
|
||||||
|
"titlecase 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -767,6 +768,15 @@ dependencies = [
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "titlecase"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-core"
|
name = "tokio-core"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
|
@ -1019,6 +1029,7 @@ dependencies = [
|
||||||
"checksum textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8e08afc40ae3459e4838f303e465aa50d823df8d7f83ca88108f6d3afe7edd"
|
"checksum textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8e08afc40ae3459e4838f303e465aa50d823df8d7f83ca88108f6d3afe7edd"
|
||||||
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
|
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
|
||||||
"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
|
"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
|
||||||
|
"checksum titlecase 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0650399a761c61e9691ccc878bce2608291f7c18d8f84d188e6e11748a5316c8"
|
||||||
"checksum tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e85d419699ec4b71bfe35bbc25bb8771e52eff0471a7f75c853ad06e200b4f86"
|
"checksum tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e85d419699ec4b71bfe35bbc25bb8771e52eff0471a7f75c853ad06e200b4f86"
|
||||||
"checksum tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ab83e7adb5677e42e405fa4ceff75659d93c4d7d7dd22f52fcec59ee9f02af"
|
"checksum tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ab83e7adb5677e42e405fa4ceff75659d93c4d7d7dd22f52fcec59ee9f02af"
|
||||||
"checksum tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fbb47ae81353c63c487030659494b295f6cb6576242f907f203473b191b0389"
|
"checksum tokio-proto 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fbb47ae81353c63c487030659494b295f6cb6576242f907f203473b191b0389"
|
||||||
|
|
|
@ -18,6 +18,7 @@ slug = "0.1"
|
||||||
r2d2 = "0.7"
|
r2d2 = "0.7"
|
||||||
r2d2-diesel = "0.16"
|
r2d2-diesel = "0.16"
|
||||||
regex = "0.2"
|
regex = "0.2"
|
||||||
|
titlecase = "0.10"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
clap = "2.26"
|
clap = "2.26"
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern crate r2d2_diesel;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate serde_urlencoded;
|
extern crate serde_urlencoded;
|
||||||
extern crate slug;
|
extern crate slug;
|
||||||
|
extern crate titlecase;
|
||||||
|
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ edit-link below and saving a new article.</p>
|
||||||
";
|
";
|
||||||
|
|
||||||
fn title_from_slug(slug: &str) -> String {
|
fn title_from_slug(slug: &str) -> String {
|
||||||
slug.replace('-', " ")
|
::titlecase::titlecase(&slug.replace('-', " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct NewArticleResource {
|
pub struct NewArticleResource {
|
||||||
|
|
Loading…
Reference in a new issue