From 3e31c46a74c56156156572b10eb5c2f4feda36c7 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 4 Jun 2020 21:33:27 +0300 Subject: Add "regexp" feature, format text with regexps `regexp` feature uses the pcre2 library to enable the user to define regular expressions for matching text and applying text formatting to the matches. An example from the theme configuration I used to test this: [terminal.themes.win95.text_format_regexps] "listing.subject" = { "\\[[^\\]]*\\]" = { attrs = "Bold" } } "listing.from" = { "\\<[^\\>]*\\>(?:(?:\\s*$)|(?=,))" = { attrs = "Italics" } } [terminal.themes.win95.text_format_regexps."pager.envelope.body"] "^>.*$" = { attrs = "Italics" } "\\d+\\s?(?:(?:[KkMmTtGg]?[Bb])|(?:[KkMmTtGg][Bb]?)(?=\\s))" = { attrs = "Bold | Underline" } --- Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index c8e0a6c5..a7cec1e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ rmpv = { version = "^0.4.2", features=["with-serde",] } rmp-serde = "^0.14.0" smallvec = { version = "1.1.0", features = ["serde", ] } bitflags = "1.0" - +pcre2 = { version = "0.2.3", optional = true } [profile.release] lto = true @@ -60,10 +60,11 @@ debug = false members = ["melib", "testing", ] [features] -default = ["sqlite3", "notmuch"] +default = ["sqlite3", "notmuch", "regexp"] notmuch = ["melib/notmuch_backend", ] jmap = ["melib/jmap_backend",] sqlite3 = ["melib/sqlite3"] +regexp = ["pcre2"] cli-docs = [] # Print tracing logs as meli runs in stderr -- cgit v1.2.3