]> gitweb.fperrin.net Git - DictionaryPC.git/blobdiff - src/com/hughes/android/dictionary/parser/WikiTokenizer.java
Eliminated <ref>s.
[DictionaryPC.git] / src / com / hughes / android / dictionary / parser / WikiTokenizer.java
index 4a28cee74b79660d8363c7a4427d898b76abe3e6..c8b150e815d6e33e4806bb296a09dd21d7f8dc43 100644 (file)
@@ -84,6 +84,9 @@ public final class WikiTokenizer {
         "=|" +  // Need the = because we might have to find unescaped =
                "<!--|" +
                "''|" +
+        "<pre>|" +
+        "<math>|" +
+        "<ref>|" +
                "$)", Pattern.MULTILINE);
   private static final String listChars = "*#:;";
   
@@ -155,6 +158,9 @@ public final class WikiTokenizer {
       "\\[\\[|" +
       "<!--|" +
       "''|" +
+      "<pre>|" +
+      "<math>|" +
+      "<ref>|" +
       "[\n]"
       );
 
@@ -338,7 +344,7 @@ public final class WikiTokenizer {
       return this;
     }
     
-    if (justReturnedNewline) {    
+    if (justReturnedNewline) {   
       justReturnedNewline = false;
 
       final char firstChar = wikiText.charAt(end);
@@ -406,6 +412,12 @@ public final class WikiTokenizer {
       return this;
     }
 
+    if (wikiText.startsWith("<ref>", start)) {
+        end = safeIndexOf(wikiText, start, "</ref>", "\n");
+        isHtml = true;
+        return this;
+      }
+
     if (wikiText.startsWith("<math>", start)) {
       end = safeIndexOf(wikiText, start, "</math>", "\n");
       isHtml = true;
@@ -519,7 +531,7 @@ public final class WikiTokenizer {
             errors.add("Unmatched <!-- error: " + wikiText.substring(start));
             return safeIndexOf(wikiText, start, "\n", "\n");
           }
-        } else if (matchText.equals("''")) {
+        } else if (matchText.equals("''") || (matchText.startsWith("<") && matchText.endsWith(">"))) {
           // Don't care.
         } else {
           assert false : "Match text='" + matchText + "'";