Mercurial Hosting > luan
comparison src/luan/modules/parsers/BBCode.java @ 1333:25746915a241
merge Luan and LuanState
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Feb 2019 22:33:40 -0700 |
parents | 475905984870 |
children | e0cf0d108a77 |
comparison
equal
deleted
inserted
replaced
1332:11b7e11f9ed5 | 1333:25746915a241 |
---|---|
1 package luan.modules.parsers; | 1 package luan.modules.parsers; |
2 | 2 |
3 import java.util.List; | 3 import java.util.List; |
4 import java.util.ArrayList; | 4 import java.util.ArrayList; |
5 import luan.Luan; | 5 import luan.Luan; |
6 import luan.LuanState; | |
7 import luan.LuanFunction; | 6 import luan.LuanFunction; |
8 import luan.LuanException; | 7 import luan.LuanException; |
9 import luan.modules.Utils; | 8 import luan.modules.Utils; |
10 import luan.modules.HtmlLuan; | 9 import luan.modules.HtmlLuan; |
11 import luan.lib.parser.Parser; | 10 import luan.lib.parser.Parser; |
12 | 11 |
13 | 12 |
14 public final class BBCode { | 13 public final class BBCode { |
15 | 14 |
16 public static String toHtml(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { | 15 public static String toHtml(Luan luan,String bbcode,LuanFunction quoter) throws LuanException { |
17 return new BBCode(luan,bbcode,quoter,true).parse(); | 16 return new BBCode(luan,bbcode,quoter,true).parse(); |
18 } | 17 } |
19 | 18 |
20 public static String toText(LuanState luan,String bbcode,LuanFunction quoter) throws LuanException { | 19 public static String toText(Luan luan,String bbcode,LuanFunction quoter) throws LuanException { |
21 return new BBCode(luan,bbcode,quoter,false).parse(); | 20 return new BBCode(luan,bbcode,quoter,false).parse(); |
22 } | 21 } |
23 | 22 |
24 private final LuanState luan; | 23 private final Luan luan; |
25 private final Parser parser; | 24 private final Parser parser; |
26 private final LuanFunction quoter; | 25 private final LuanFunction quoter; |
27 private final boolean toHtml; | 26 private final boolean toHtml; |
28 | 27 |
29 private BBCode(LuanState luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException { | 28 private BBCode(Luan luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException { |
30 Utils.checkNotNull(text,1); | 29 Utils.checkNotNull(text,1); |
31 // Utils.checkNotNull(quoter,2); | 30 // Utils.checkNotNull(quoter,2); |
32 this.luan = luan; | 31 this.luan = luan; |
33 this.parser = new Parser(text); | 32 this.parser = new Parser(text); |
34 this.quoter = quoter; | 33 this.quoter = quoter; |