From 5ecfb0b6204481e9ca4ed1af09ce22ff4591c1e3 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 15 Jan 2018 14:18:23 -0800 Subject: add flag to translate emoji to/from a description right now only handles :thinking: and :clap:, toggled by translate_emoji in profile.json --- src/display/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/display') diff --git a/src/display/mod.rs b/src/display/mod.rs index 098bb1c..f2f59da 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -830,8 +830,19 @@ pub fn render_twete_no_recurse(twete_id: &TweetId, tweeter: &tw::TwitterCache, d colorized_lines.push(new_line); } + let emoji_replaced: Vec = if tweeter.translate_emoji { + colorized_lines.iter().map(|line| { + line + .replace("🤔", ":thinking:") + .replace("👏",":clap:") + }).collect() + } else { + colorized_lines + }; + + let mut urls_to_include: Vec<&str> = vec![]; - let urls_replaced = colorized_lines + let urls_replaced = emoji_replaced .into_iter() .map(|line| { let mut result: String = line.to_owned(); -- cgit v1.1