aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-09-18 18:56:51 +0200
committerAlex Auvolat <alex@adnab.me>2023-09-18 18:56:51 +0200
commit22bd3b7e415c5a33e8101bc38acaaab22de5b316 (patch)
tree1e7695f528ad3f54a303adc118dd29ad914b5f3a /src
parent63583ea63cc2f81b030b31400d861e83e5023d23 (diff)
downloaddatagengo-22bd3b7e415c5a33e8101bc38acaaab22de5b316.tar.gz
datagengo-22bd3b7e415c5a33e8101bc38acaaab22de5b316.zip
change characters appearance
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index d0f896d..837b7ff 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -76,6 +76,10 @@ fn main() {
.map_err(anyhow::Error::from)
.and_then(|x| Ok(serde_json::from_slice::<Vec<Batch>>(&x)?))
.expect("read/parse");
+
+ fs::create_dir_all("public").expect("mkdir public");
+ fs::copy("static/style.css", "public/style.css").expect("copy style.css");
+
batches.iter()
.enumerate()
.for_each(|x| format_batch(&jmdict_idx, batches.len(), x));
@@ -343,7 +347,7 @@ fn format_batch<'a>(dict_idx: &DictIndex<'a>, count: usize, (i, batch): (usize,
}
fn format_batch_aux<'a>(dict_idx: &DictIndex<'a>, count: usize, i: usize, batch: &Batch) -> Result<()> {
- let mut f = io::BufWriter::new(fs::File::create(format!("html/{:03}.html", i))?);
+ let mut f = io::BufWriter::new(fs::File::create(format!("public/{:03}.html", i))?);
write!(f, r#"<!DOCTYPE html>
<html>
<head>
@@ -363,7 +367,8 @@ fn format_batch_aux<'a>(dict_idx: &DictIndex<'a>, count: usize, i: usize, batch:
}
writeln!(f, r#"</p>"#)?;
writeln!(f, "<p>Level: {}</p>", batch.level)?;
- writeln!(f, "<p>Characters: {}</p>", batch.chars.to_string())?;
+
+ writeln!(f, r#"<p class="ja chars">【{}】</p>"#, batch.chars.to_string())?;
for ex in batch.examples.iter() {
writeln!(f, "<hr />")?;
@@ -461,7 +466,7 @@ fn dict_str<'a>(qkeb: &str, qreb: Option<&str>, ent: &roxmltree::Node<'a, 'a>) -
}
fn format_index(batches: &[Batch], kanji_levels: &[(String, String)]) -> Result<()> {
- let mut f = io::BufWriter::new(fs::File::create("html/index.html")?);
+ let mut f = io::BufWriter::new(fs::File::create("public/index.html")?);
write!(f, r#"<!DOCTYPE html>
<html>
<head>