Permalink
Browse files

#224: make it clear in links list what link corresponds to

still allows double-linking in case of
http://www.reddit.com/r/test
  • Loading branch information...
1 parent 2eb5a11 commit c266b43bac5fe6d131bc33c84d0738e6fd2fd006 @talklittle committed Jan 9, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/com/andrewshu/android/reddit/markdown/Markdown.java
View
11 src/com/andrewshu/android/reddit/markdown/Markdown.java
@@ -23,14 +23,15 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import com.andrewshu.android.reddit.common.Constants;
-import com.andrewshu.android.reddit.common.util.Util;
-
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
+
+import com.andrewshu.android.reddit.common.Constants;
+import com.andrewshu.android.reddit.common.util.Util;
+
import dk.brics.automaton.AutomatonMatcher;
import dk.brics.automaton.RegExp;
import dk.brics.automaton.RunAutomaton;
@@ -210,7 +211,7 @@ private String doAutoLinkURLs(String txt, ArrayList<MarkdownURL> urls) {
String linkText = am.group();
String url = Util.absolutePathToURL(am.group());
if (Constants.LOGGING) Log.d(TAG, "pos="+am.start() + " linkText="+linkText + " url="+url);
- urls.add(new MarkdownURL(am.start(), url, am.group()));
+ urls.add(new MarkdownURL(am.start(), url, null));
}
// Don't autolink emails for now. Neither does reddit.com
// m = autoLinkEmail.matcher(ssb);
@@ -243,7 +244,7 @@ private String doAutoLinkSubredditURLs(String txt, ArrayList<MarkdownURL> urls)
while (am.find()) {
String subreddit = am.group();
if (Constants.LOGGING) Log.d(TAG, "pos="+am.start() + " subreddit="+subreddit);
- urls.add(new MarkdownURL(am.start(), Util.absolutePathToURL(subreddit), null));
+ urls.add(new MarkdownURL(am.start(), Util.absolutePathToURL(subreddit), subreddit));
}
return txt;
}

0 comments on commit c266b43

Please sign in to comment.