Mercurial Hosting > luan
diff core/src/luan/modules/HtmlLuan.java @ 427:dae264ad6a7b
fix LuanTable.put() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 19:29:07 -0600 |
parents | 23a93c118042 |
children | d9df6d6cb927 |
line wrap: on
line diff
--- a/core/src/luan/modules/HtmlLuan.java Fri May 01 18:44:20 2015 -0600 +++ b/core/src/luan/modules/HtmlLuan.java Fri May 01 19:29:07 2015 -0600 @@ -141,23 +141,23 @@ static LuanTable comment(String text) { LuanTable tbl = new LuanTable(); - tbl.put("type","comment"); - tbl.put("text",text); + tbl.rawPut("type","comment"); + tbl.rawPut("text",text); return tbl; } static LuanTable cdata(String text) { LuanTable tbl = new LuanTable(); - tbl.put("type","cdata"); - tbl.put("text",text); + tbl.rawPut("type","cdata"); + tbl.rawPut("text",text); return tbl; } static LuanTable textContainer(LuanTable tag,String text) { LuanTable tbl = new LuanTable(); - tbl.put("type","container"); - tbl.put("tag",tag); - tbl.put("text",text); + tbl.rawPut("type","container"); + tbl.rawPut("tag",tag); + tbl.rawPut("text",text); return tbl; } @@ -171,12 +171,12 @@ static LuanTable parseTag(String text) { LuanTable tbl = new LuanTable(); - tbl.put("type","tag"); + tbl.rawPut("type","tag"); if( text.endsWith("/") ) { text = text.substring(0,text.length()-1); - tbl.put("is_empty",true); + tbl.rawPut("is_empty",true); } else { - tbl.put("is_empty",false); + tbl.rawPut("is_empty",false); } int len = text.length(); int i = 0; @@ -192,9 +192,9 @@ i2++; } String name = text.substring(i,i2).toLowerCase(); - tbl.put("name",name); + tbl.rawPut("name",name); LuanTable attributes = new LuanTable(); - tbl.put("attributes",attributes); + tbl.rawPut("attributes",attributes); i = i2; while( i<len && Character.isWhitespace(text.charAt(i)) ) i++; while( i<len ) { @@ -213,11 +213,11 @@ if( attrValue.indexOf('<') != -1 || attrValue.indexOf('>') != -1 ) throw new BadTag("invalid attribute value: "+attrValue); attrValue = unquote(attrValue); - attributes.put(attrName,attrValue); + attributes.rawPut(attrName,attrValue); i = i2; while( i<len && Character.isWhitespace(text.charAt(i)) ) i++; } else { - attributes.put(attrName,true); + attributes.rawPut(attrName,true); } } return tbl;