Commit f869d64
committed
reddit: handle post and comment links in one regex
It's entirely impractical to try to handle post and comment links in
separate callables, because comment links contain an entire post link.
Before, this was handled by anchoring the post URL pattern at the end,
but that broke Sopel handling e.g. `?sort=confidence` if someone sorted
the comments before copying the link into IRC.
Lookaround assertions didn't appear to prevent matching the post link
contained in every comment link, so this solution seemed like the only
way forward. It's a nice tidy dispatcher pattern, really.1 parent f8db436 commit f869d64
1 file changed
+18
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | | - | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
110 | | - | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
116 | | - | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | | - | |
| 123 | + | |
120 | 124 | | |
121 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
| |||
205 | 215 | | |
206 | 216 | | |
207 | 217 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 218 | + | |
212 | 219 | | |
213 | | - | |
| 220 | + | |
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
| |||
0 commit comments