Mercurial Hosting > luan
comparison core/src/luan/modules/parsers/BBCode.java @ 638:3ab4f282f0bd 0.16
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Mar 2016 22:52:41 -0700 |
parents | 6ea90dc10375 |
children | cdc70de628b5 |
comparison
equal
deleted
inserted
replaced
637:6ea90dc10375 | 638:3ab4f282f0bd |
---|---|
10 | 10 |
11 | 11 |
12 public final class BBCode { | 12 public final class BBCode { |
13 | 13 |
14 public static String toHtml(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { | 14 public static String toHtml(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { |
15 return new BBCode(luan,bbcode,true,quoter).parse(); | 15 return new BBCode(luan,bbcode,quoter,true).parse(); |
16 } | 16 } |
17 | 17 |
18 public static String toText(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { | 18 public static String toText(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { |
19 return new BBCode(luan,bbcode,false,quoter).parse(); | 19 return new BBCode(luan,bbcode,quoter,false).parse(); |
20 } | 20 } |
21 | 21 |
22 private final LuanState luan; | 22 private final LuanState luan; |
23 private final Parser parser; | 23 private final Parser parser; |
24 private final LuanFunction quoter; | |
24 private final boolean toHtml; | 25 private final boolean toHtml; |
25 private final LuanFunction quoter; | 26 |
26 | 27 private BBCode(LuanState luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException { |
27 private BBCode(LuanState luan,String text,boolean toHtml,LuanFunction quoter) throws LuanException { | |
28 Utils.checkNotNull(luan,text,1); | 28 Utils.checkNotNull(luan,text,1); |
29 Utils.checkNotNull(luan,quoter,3); | 29 Utils.checkNotNull(luan,quoter,2); |
30 this.luan = luan; | 30 this.luan = luan; |
31 this.parser = new Parser(text); | 31 this.parser = new Parser(text); |
32 this.quoter = quoter; | |
32 this.toHtml = toHtml; | 33 this.toHtml = toHtml; |
33 this.quoter = quoter; | |
34 } | 34 } |
35 | 35 |
36 private String parse() throws LuanException { | 36 private String parse() throws LuanException { |
37 StringBuilder sb = new StringBuilder(); | 37 StringBuilder sb = new StringBuilder(); |
38 while( !parser.endOfInput() ) { | 38 while( !parser.endOfInput() ) { |