Also try to extract URLs inside `'' and update comments. - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
(HTM) hg clone https://bitbucket.org/iamleot/plumb
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) changeset ee6593051dce2bad6797f84289ecd69f58a5957b
(DIR) parent 8cca9654034c63ad8835657900d3492553eb9c83
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Mon, 26 Mar 2018 09:33:09
Also try to extract URLs inside `'' and update comments.
- Also extract URLs inside '...' delimeters (this is done with the kludgy
'"'"' syntax)
- Move the list of possible delimeters on the general comment about dplumb so
we're inside real comments and can easily use `'' inside these comments.
Diffstat:
dplumb | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff -r 8cca9654034c -r ee6593051dce dplumb
--- a/dplumb Mon Mar 26 09:24:35 2018 +0200
+++ b/dplumb Mon Mar 26 09:33:09 2018 +0200
@@ -36,7 +36,8 @@
#
# - Put a word per line
# - URL-ize patterns
-# - Get rid of possible delimiters in the URLs
+# - Extract URLs inside possible delimeters
+# (<...>, (...), [...], "...", '...')
# - Pipe all URLs to ${PLUMB_DMENU}
# - Invoke plumb against the selected entry
#
@@ -49,11 +50,12 @@
awk \
'
/:\/\// {
- # Extract URLs inside possible delimiters (<...>, (...), [...], "...")
+ # Extract URLs inside possible delimiters
if (match($0, /\<[[:alnum:]]+:\/\/[^>]+\>/) ||
match($0, /\([[:alnum:]]+:\/\/[^)]+\)/) ||
match($0, /\[[[:alnum:]]+:\/\/[^]]+\]/) ||
- match($0, /"[[:alnum:]]+:\/\/[^]]+"/)) {
+ match($0, /"[[:alnum:]]+:\/\/[^]]+"/) ||
+ match($0, /'"'"'[[:alnum:]]+:\/\/[^]]+'"'"'/)) {
print substr($0, RSTART + 1, RLENGTH - 2)
} else {
print $0