Mercurial Hosting > luan
diff src/luan/modules/parsers/BBCode.java @ 1563:8fbcc4747091
remove LuanFunction.luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 09 Nov 2020 01:37:57 -0700 |
parents | 27efb1fcbcb5 |
children |
line wrap: on
line diff
--- a/src/luan/modules/parsers/BBCode.java Sun Nov 08 16:50:59 2020 -0700 +++ b/src/luan/modules/parsers/BBCode.java Mon Nov 09 01:37:57 2020 -0700 @@ -12,21 +12,23 @@ public final class BBCode { - public static String toHtml(String bbcode,LuanFunction quoter) throws LuanException { - return new BBCode(bbcode,quoter,true).parse(); + public static String toHtml(Luan luan,String bbcode,LuanFunction quoter) throws LuanException { + return new BBCode(luan,bbcode,quoter,true).parse(); } - public static String toText(String bbcode,LuanFunction quoter) throws LuanException { - return new BBCode(bbcode,quoter,false).parse(); + public static String toText(Luan luan,String bbcode,LuanFunction quoter) throws LuanException { + return new BBCode(luan,bbcode,quoter,false).parse(); } + private final Luan luan; private final Parser parser; private final LuanFunction quoter; private final boolean toHtml; - private BBCode(String text,LuanFunction quoter,boolean toHtml) throws LuanException { + private BBCode(Luan luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException { Utils.checkNotNull(text,1); // Utils.checkNotNull(quoter,2); + this.luan = luan; this.parser = new Parser(text); this.quoter = quoter; this.toHtml = toHtml; @@ -283,7 +285,7 @@ else return ""; } - Object obj = quoter.call(args); + Object obj = quoter.call(luan,args); if( !(obj instanceof String) ) throw new LuanException("BBCode quoter function returned "+Luan.type(obj)+" but string required"); return (String)obj;