Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
cf8b1ed2e9 | 3 years ago |
|
|
ba0cd6b202 | 3 years ago |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,25 +0,0 @@
|
|||||||
use actix_web::{body::BoxBody, Responder, HttpRequest, http::header::ContentType, HttpResponse};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct Page {
|
|
||||||
pub domain: String,
|
|
||||||
pub domain_name: String,
|
|
||||||
pub page: String,
|
|
||||||
pub page_name: String,
|
|
||||||
pub page_text: String,
|
|
||||||
pub parent_domain: String,
|
|
||||||
pub parent_page: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Responder for Page {
|
|
||||||
type Body = BoxBody;
|
|
||||||
|
|
||||||
fn respond_to(self, _req: &HttpRequest) -> HttpResponse<Self::Body> {
|
|
||||||
let res_body = serde_json::to_string(&self).unwrap();
|
|
||||||
|
|
||||||
HttpResponse::Ok()
|
|
||||||
.content_type(ContentType::json())
|
|
||||||
.body(res_body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
function normalizeName(pagename) {
|
||||||
|
return str.normalize("NFKD").replace(/\p{Diacritic}/gu, "").toLowerCase().replace(/œ/g, "oe").replace(/æ/g, "ae").replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, "").replace(/_+/g, "_");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { normalizeName };
|
||||||
Loading…
Reference in new issue