aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-07-21 22:07:22 +0200
committerAlex Auvolat <alex@adnab.me>2023-07-21 22:07:22 +0200
commita5b0ba4f4013fedf7b291b5801c0fcce22a35a60 (patch)
tree556fd72b617f3d4dd878b854503201d0d1792ed6 /src
parent903cc6a3711d7b501371ee3ef55ae0f50d6cd63d (diff)
downloaddatagengo-a5b0ba4f4013fedf7b291b5801c0fcce22a35a60.tar.gz
datagengo-a5b0ba4f4013fedf7b291b5801c0fcce22a35a60.zip
add kanji links to jisho.org
Diffstat (limited to 'src')
-rw-r--r--src/main.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 1572e2e..e081454 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -362,11 +362,9 @@ fn format_batch_aux<'a>(dict_idx: &DictIndex<'a>, count: usize, i: usize, batch:
if !wchars.intersects(&ex.chars) {
continue;
}
- println!("{}", w);
if let Some(ents) = dict_idx.get(w) {
for ent in ents.iter() {
let s = dict_str(w, ent);
- println!("{}: {}", w, s);
if wchars.intersects(&batch.chars) {
expl_batch.push(s);
} else {
@@ -378,7 +376,11 @@ fn format_batch_aux<'a>(dict_idx: &DictIndex<'a>, count: usize, i: usize, batch:
for be in expl_batch {
writeln!(f, r#"<p>{}</p>"#, be)?;
}
- writeln!(f, r#"<p class="chars">{}</p>"#, ex.chars.inter(&batch.chars).to_string())?;
+ writeln!(f, r#"<p class="chars">"#)?;
+ for c in ex.chars.inter(&batch.chars).chars().iter() {
+ writeln!(f, r#"<a href="https://jisho.org/search/{}%20%23kanji">{}</a>"#, c, c)?;
+ }
+ writeln!(f, r#"</p>"#)?;
for be in expl_all {
writeln!(f, r#"<p>{}</p>"#, be)?;
}