mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Add support for bitcoin URIs
This commit is contained in:
parent
dab8d3807f
commit
9b807c325d
@ -392,7 +392,9 @@ public class HtmlConverter {
|
||||
* @param outputBuffer Buffer to append linked text to.
|
||||
*/
|
||||
private static void linkifyText(final String text, final StringBuffer outputBuffer) {
|
||||
Matcher m = Regex.WEB_URL_PATTERN.matcher(text);
|
||||
String prepared = text.replaceAll(Regex.BITCOIN_URI_PATTERN, "<a href=\"$0\">$0</a>");
|
||||
|
||||
Matcher m = Regex.WEB_URL_PATTERN.matcher(prepared);
|
||||
while (m.find()) {
|
||||
int start = m.start();
|
||||
if (start == 0 || (start != 0 && text.charAt(start - 1) != '@')) {
|
||||
|
@ -103,4 +103,7 @@ public class Regex {
|
||||
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
|
||||
")+"
|
||||
);
|
||||
|
||||
public static final String BITCOIN_URI_PATTERN =
|
||||
"bitcoin:[1-9a-km-zA-HJ-NP-Z]{27,34}(\\?[a-zA-Z0-9$\\-_.+!*'(),%:@&=]*)?";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user