index : livejrnl-rs.git

ascending towards madness

author berrysweet <berrysweet@noreply.codeberg.org> 2023-07-06 20:30:04.0 +00:00:00
committer berrysweet <berrysweet@noreply.codeberg.org> 2023-07-06 20:30:04.0 +00:00:00
commit
69ace663ff1d3c26d45d03ff4bb36c37161f429e [patch]
tree
cda08bd1da237b6fc5e2bfee3e4af1e383fcfb01
parent
808e429c10f71d0b06ce92dd46fcaabef78769b8
download
69ace663ff1d3c26d45d03ff4bb36c37161f429e.tar.gz

feat(filters): add emoji filter



Diff

 Cargo.toml          | 3 ++-
 src/util/filters.rs | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 67b69d7..a594ec3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,4 +14,5 @@ walkdir = "2.3.3"
read_pipe = "0.1.2"
minijinja = "1.0.3"
gumdrop = "0.8.1"
markdown = "1.0.0-alpha.10"
\ No newline at end of file
markdown = "1.0.0-alpha.10"
emojic = "0.4.1"
\ No newline at end of file
diff --git a/src/util/filters.rs b/src/util/filters.rs
index 7657126..eb82609 100644
--- a/src/util/filters.rs
+++ b/src/util/filters.rs
@@ -12,6 +12,11 @@ pub fn markdown(value: String) -> String {
	result.unwrap_or_default()
}

pub fn emoji(value: String) -> String { 
	emojic::text::parse_text(&value)
}

pub fn register_filters(env: &mut minijinja::Environment<'_>) {
	env.add_filter("markdown", markdown);
	env.add_filter("emoji", emoji);
}
\ No newline at end of file