|
@@ -4,6 +4,31 @@ ffoo import inigrep
|
4
|
4
|
ffoo import pretty
|
5
|
5
|
|
6
|
6
|
|
|
7
|
+__saturnin_urimagic__deref() {
|
|
8
|
+ #
|
|
9
|
+ # Turn keyword or query (like "g hello" for google) to URI
|
|
10
|
+ #
|
|
11
|
+ local line # input line, eg. "g hello dolly" or "bug 1234"
|
|
12
|
+ local kw # keyword part, eg. "g" or "bug"
|
|
13
|
+ local query # query part, eg. "hello dolly" or "1234"
|
|
14
|
+ while read line;
|
|
15
|
+ do
|
|
16
|
+ line="$line "
|
|
17
|
+ kw=${line%% *}
|
|
18
|
+ query=${line#$kw }
|
|
19
|
+ debug -v kw query
|
|
20
|
+ if test -n "$query";
|
|
21
|
+ then
|
|
22
|
+ local fmt=$(inigrep -j -1 -p www.query.${kw,,})
|
|
23
|
+ debug -v fmt
|
|
24
|
+ printf "$fmt\n" "$query"
|
|
25
|
+ else
|
|
26
|
+ inigrep -j -1 -p www.bookmark.$kw
|
|
27
|
+ fi
|
|
28
|
+ done
|
|
29
|
+}
|
|
30
|
+
|
|
31
|
+
|
7
|
32
|
__saturnin_urimagic__flt_exps() {
|
8
|
33
|
#
|
9
|
34
|
# Hack expressions like bug = 123 out of the text
|
|
@@ -31,6 +56,14 @@ __saturnin_urimagic__flt_ids() {
|
31
|
56
|
}
|
32
|
57
|
|
33
|
58
|
|
|
59
|
+__saturnin_urimagic__flt_kws() {
|
|
60
|
+ #
|
|
61
|
+ # Hack out lines that look like kw expressions
|
|
62
|
+ #
|
|
63
|
+ grep -Ee '^[a-zA-Z]\w*\s+[^=]' -e '^[a-zA-Z]\w*$'
|
|
64
|
+}
|
|
65
|
+
|
|
66
|
+
|
34
|
67
|
__saturnin_urimagic__flt_tags() {
|
35
|
68
|
#
|
36
|
69
|
# Hack "tags" like bug123 out of the text
|
|
@@ -40,13 +73,6 @@ __saturnin_urimagic__flt_tags() {
|
40
|
73
|
| sed -r 's/([a-zA-Z]+)([0-9])/\1 \2/'
|
41
|
74
|
}
|
42
|
75
|
|
43
|
|
-__saturnin_urimagic__flt_kws() {
|
44
|
|
- #
|
45
|
|
- # Hack out lines that look like kw expressions
|
46
|
|
- #
|
47
|
|
- grep -Ee '^[a-zA-Z]\w*\s+[^=]' -e '^[a-zA-Z]\w*$'
|
48
|
|
-}
|
49
|
|
-
|
50
|
76
|
|
51
|
77
|
__saturnin_urimagic__flt_uris() {
|
52
|
78
|
#
|
|
@@ -106,28 +132,3 @@ saturnin_urimagic__scan() {
|
106
|
132
|
popd >&/dev/null
|
107
|
133
|
rm -rf $d
|
108
|
134
|
}
|
109
|
|
-
|
110
|
|
-
|
111
|
|
-__saturnin_urimagic__deref() {
|
112
|
|
- #
|
113
|
|
- # Turn keyword or query (like "g hello" for google) to URI
|
114
|
|
- #
|
115
|
|
- local line # input line, eg. "g hello dolly" or "bug 1234"
|
116
|
|
- local kw # keyword part, eg. "g" or "bug"
|
117
|
|
- local query # query part, eg. "hello dolly" or "1234"
|
118
|
|
- while read line;
|
119
|
|
- do
|
120
|
|
- line="$line "
|
121
|
|
- kw=${line%% *}
|
122
|
|
- query=${line#$kw }
|
123
|
|
- debug -v kw query
|
124
|
|
- if test -n "$query";
|
125
|
|
- then
|
126
|
|
- local fmt=$(inigrep -j -1 -p www.query.${kw,,})
|
127
|
|
- debug -v fmt
|
128
|
|
- printf "$fmt\n" "$query"
|
129
|
|
- else
|
130
|
|
- inigrep -j -1 -p www.bookmark.$kw
|
131
|
|
- fi
|
132
|
|
- done
|
133
|
|
-}
|