|
@@ -30,6 +30,16 @@ filter_ids() {
|
30
|
30
|
}
|
31
|
31
|
|
32
|
32
|
|
|
33
|
+filter_tags() {
|
|
34
|
+ #
|
|
35
|
+ # Hack "tags" like bug123 out of the text
|
|
36
|
+ #
|
|
37
|
+ tr ' ' '\n' \
|
|
38
|
+ | grep -E '^[a-zA-Z]+[0-9]+$' \
|
|
39
|
+ | debug_pipe tag_lookalikes
|
|
40
|
+}
|
|
41
|
+
|
|
42
|
+
|
33
|
43
|
filter_kws() {
|
34
|
44
|
#
|
35
|
45
|
# Hack out lines that look like kw expressions
|
|
@@ -57,7 +67,8 @@ find_uri() {
|
57
|
67
|
# Scan stdin for what looks like URI, ID or keyword
|
58
|
68
|
#
|
59
|
69
|
# Output URIs: first what were apparent uris, then IDs converted to
|
60
|
|
- # URIs, then equal sign expressions, then things that looked like
|
|
70
|
+ # URIs, then equal sign expressions, then "tags" like bug1234 (i.e.
|
|
71
|
+ # letters+nubmbers, no spaces), then things that looked like
|
61
|
72
|
# kw expressions, converted to URIs.
|
62
|
73
|
#
|
63
|
74
|
# Note that kw expressions (e.g. "bug 123") work only if they start
|
|
@@ -71,15 +82,16 @@ find_uri() {
|
71
|
82
|
##
|
72
|
83
|
# heat up and fill pipes
|
73
|
84
|
#
|
74
|
|
- mkfifo maybe_uris maybe_ids maybe_exprs maybe_kws \
|
75
|
|
- uris uris_from_ids uris_from_exprs uris_from_kws
|
76
|
|
- cat | tee maybe_uris maybe_ids maybe_exprs maybe_kws >/dev/null &
|
|
85
|
+ mkfifo maybe_uris maybe_ids maybe_exprs maybe_tags maybe_kws \
|
|
86
|
+ uris uris_from_ids uris_from_exprs uris_from_tags uris_from_kws
|
|
87
|
+ cat | tee maybe_uris maybe_ids maybe_exprs maybe_tags maybe_kws >/dev/null &
|
77
|
88
|
##
|
78
|
89
|
# process each pipe *async* by different filter
|
79
|
90
|
#
|
80
|
91
|
< maybe_uris filter_uris > uris &
|
81
|
92
|
< maybe_ids filter_ids | id2kw | kw2uri > uris_from_ids &
|
82
|
93
|
< maybe_exprs filter_exprs | expr2kw | kw2uri > uris_from_exprs &
|
|
94
|
+ < maybe_tags filter_tags | tag2kw | kw2uri > uris_from_tags &
|
83
|
95
|
< maybe_kws filter_kws | kw2uri > uris_from_kws &
|
84
|
96
|
##
|
85
|
97
|
# print result *sync* in correct order
|
|
@@ -88,6 +100,7 @@ find_uri() {
|
88
|
100
|
cat uris
|
89
|
101
|
cat uris_from_ids
|
90
|
102
|
cat uris_from_exprs
|
|
103
|
+ cat uris_from_tags
|
91
|
104
|
cat uris_from_kws
|
92
|
105
|
} | grep . # throw away empties; add missing LF
|
93
|
106
|
popd >&/dev/null
|
|
@@ -103,6 +116,14 @@ id2kw() {
|
103
|
116
|
}
|
104
|
117
|
|
105
|
118
|
|
|
119
|
+tag2kw() {
|
|
120
|
+ #
|
|
121
|
+ # Convert tag to kw expression
|
|
122
|
+ #
|
|
123
|
+ sed -r 's/([a-zA-Z]+)([0-9])/\1 \2/'
|
|
124
|
+}
|
|
125
|
+
|
|
126
|
+
|
106
|
127
|
expr2kw() {
|
107
|
128
|
#
|
108
|
129
|
# Convert equal sign expression to kw expression
|