code: private void removeDoubleBraceMarkup(StringBuilder article) {
          int braceStart = article.indexOf("{{");
          // Repeatedly loop while {{ }} text still exists in the document
          while (braceStart >= 0) {
              // Find the matching closing }} if it exists.  Some wikipedia
              // text is malformated, with no matching brace. so take no
              // action in this case.
              int braceEnd = article.indexOf("}}", braceStart);
          
              int nextBraceStart = article.indexOf("{{", braceStart + 1);
              // Some {{ content has embedded {{ content, which causes problems
              // for nearest matching.  Recursively search until a nearest-match
              // is found and then 
              while (nextBraceStart > braceStart && nextBraceStart < braceEnd) {
                  removeEmbeddedBrace(article, nextBraceStart);
                  // Recompute the ending brace, since removing the embedded {{
                  // will have removed the }} as well.
                  braceEnd = article.indexOf("}}", braceStart);
                  nextBraceStart = article.indexOf("{{", braceStart + 1);
              }
  
              if (braceEnd < 0)
                  break;
  
              article.delete(braceStart, braceEnd + 2);
              // Search for the next {{ if it exists
              braceStart = article.indexOf("{{", braceStart);            
          }
      }
docs: Remove wiki citations of the form "{{cite ... }}", which links to some
  text or another wikipedia link.
  
  @param article The article text to clean.