From eee91d8af37a8ee2bc22427992170af0fd8df214 Mon Sep 17 00:00:00 2001 From: William Melody Date: Fri, 12 Jul 2024 18:22:16 -0700 Subject: [PATCH] Support non-ascii `[:alnum:]` characters in `search --tags`. refs gh-328 refs gh-329 --- nb | 4 ++-- test/search-list-tags.bats | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nb b/nb index 8500f6abf..59ab07af9 100755 --- a/nb +++ b/nb @@ -16987,7 +16987,7 @@ _search() { "-I" "--ignore-case" "--only-matching" - -e '(^|[[:space:]])#[A-Za-z0-9_-]+' + -e '(^|[[:space:]])#[[:alnum:]_-]+' ) else local _grep_arguments=( @@ -16995,7 +16995,7 @@ _search() { "-I" "--ignore-case" "--only-matching" - -e '[[:space:]]#[A-Za-z0-9_-]+' + -e '[[:space:]]#[[:alnum:]_-]+' -e '^#[A-Za-z0-9_-]+' ) fi diff --git a/test/search-list-tags.bats b/test/search-list-tags.bats index ee4734a45..f469adb60 100644 --- a/test/search-list-tags.bats +++ b/test/search-list-tags.bats @@ -20,7 +20,7 @@ Example Content Two #tag3 Example #tag1 Phrase. More content. -#low-tag +#lõw-tag ## Content @@ -81,7 +81,7 @@ HEREDOC [[ "${output}" =~ \#tag1 ]] [[ "${output}" =~ \#tag2 ]] [[ "${output}" =~ \#tag3 ]] - [[ "${output}" =~ \#low-tag ]] + [[ "${output}" =~ \#lõw-tag ]] } # _GIT_ENABLED=0 ############################################################## @@ -104,7 +104,7 @@ HEREDOC [[ "${output}" =~ \#tag1 ]] [[ "${output}" =~ \#tag2 ]] [[ "${output}" =~ \#tag3 ]] - [[ "${output}" =~ \#low-tag ]] + [[ "${output}" =~ \#lõw-tag ]] } # edge cases ################################################################## @@ -225,7 +225,7 @@ HEREDOC [[ "${lines[0]}" =~ \#tag3 ]] [[ "${lines[1]}" =~ \#tag1 ]] - [[ "${lines[2]}" =~ \#low-tag ]] + [[ "${lines[2]}" =~ \#lõw-tag ]] } @test "'/ --tags' lists all unique tags in ." { @@ -263,7 +263,7 @@ HEREDOC [[ "${lines[2]}" =~ \#tag1 ]] [[ "${lines[3]}" =~ \#tag2 ]] [[ "${lines[4]}" =~ \#tag3 ]] - [[ "${lines[5]}" =~ \#low-tag ]] + [[ "${lines[5]}" =~ \#lõw-tag ]] } @test "'--tags --all' lists all unique tags in all notebooks." { @@ -284,7 +284,7 @@ HEREDOC [[ "${lines[2]}" =~ \#nested-tag2 ]] [[ "${lines[3]}" =~ \#tag1 ]] [[ "${lines[4]}" =~ \#tag2 ]] - [[ "${lines[6]}" =~ \#low-tag ]] + [[ "${lines[6]}" =~ \#lõw-tag ]] [[ "${lines[5]}" =~ \#tag3 ]] } @@ -305,7 +305,7 @@ HEREDOC [[ "${lines[0]}" =~ \#tag3 ]] [[ "${lines[1]}" =~ \#tag1 ]] - [[ "${lines[2]}" =~ \#low-tag ]] + [[ "${lines[2]}" =~ \#lõw-tag ]] } @test "'list / --tags' lists all unique tags in ." { @@ -343,7 +343,7 @@ HEREDOC [[ "${lines[2]}" =~ \#tag1 ]] [[ "${lines[3]}" =~ \#tag2 ]] [[ "${lines[4]}" =~ \#tag3 ]] - [[ "${lines[5]}" =~ \#low-tag ]] + [[ "${lines[5]}" =~ \#lõw-tag ]] } @test "'list --tags --all' lists all unique tags in all notebooks." { @@ -365,7 +365,7 @@ HEREDOC [[ "${lines[3]}" =~ \#tag1 ]] [[ "${lines[4]}" =~ \#tag2 ]] [[ "${lines[5]}" =~ \#tag3 ]] - [[ "${lines[6]}" =~ \#low-tag ]] + [[ "${lines[6]}" =~ \#lõw-tag ]] } # `search` #################################################################### @@ -385,7 +385,7 @@ HEREDOC [[ "${lines[0]}" =~ \#tag3 ]] [[ "${lines[1]}" =~ \#tag1 ]] - [[ "${lines[2]}" =~ \#low-tag ]] + [[ "${lines[2]}" =~ \#lõw-tag ]] } @test "'search / --tags' lists all unique tags in ." { @@ -423,7 +423,7 @@ HEREDOC [[ "${lines[2]}" =~ \#tag1 ]] [[ "${lines[3]}" =~ \#tag2 ]] [[ "${lines[4]}" =~ \#tag3 ]] - [[ "${lines[5]}" =~ \#low-tag ]] + [[ "${lines[5]}" =~ \#lõw-tag ]] } @test "'search --tags --all' lists all unique tags in all notebooks." { @@ -445,5 +445,5 @@ HEREDOC [[ "${lines[3]}" =~ \#tag1 ]] [[ "${lines[4]}" =~ \#tag2 ]] [[ "${lines[5]}" =~ \#tag3 ]] - [[ "${lines[6]}" =~ \#low-tag ]] + [[ "${lines[6]}" =~ \#lõw-tag ]] }