1 5 package org.exoplatform.services.grammar.wiki.impl; 6 7 12 public class AlphabeticalEnumeratedTokenHandler extends TokenHandler { 13 14 public Token handleToken(Token parent, Token token, ParsingContext context) { 15 StringBuffer b = context.getOutputBuffer() ; 16 TokenHandlerManager manager = context.getTokenHandlerManager() ; 17 b.append("<ul class='alphabetical-enumerated'>") ; 18 boolean closeLI = false ; 19 while(token != null) { 20 if(token.type == Token.ALPHABETICAL_ENUMERATED_TOKEN) { 21 if(closeLI) b.append("</li>") ; 22 closeLI = true ; 23 b.append("<li>") ; 24 token = context.nextToken(token) ; 25 } else if(token.type == Token.MULTIPLE_NEW_LINE_TOKEN) { 26 break ; 27 } else { 28 token = manager.handleToken(null ,token, context) ; 29 } 30 } 31 b.append("</li>") ; 32 b.append("</ul>") ; 33 return token ; 34 } 35 36 public String [] getHandleableTokenType() { 37 String [] s = { Token.ALPHABETICAL_ENUMERATED_TOKEN } ; 38 return s; 39 } 40 } | Popular Tags |