comparison core/src/luan/modules/HtmlLuan.java @ 411:23b99a5039b5

remove Luan.newTable()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 29 Apr 2015 16:05:02 -0600
parents 4fe6c9fed486
children 23a93c118042
comparison
equal deleted inserted replaced
410:0d6098a29b3e 411:23b99a5039b5
134 html.add( "&gt;" ); 134 html.add( "&gt;" );
135 // } 135 // }
136 } 136 }
137 } 137 }
138 } 138 }
139 return Luan.newTable(html); 139 return new LuanTable(html);
140 } 140 }
141 141
142 static LuanTable comment(String text) { 142 static LuanTable comment(String text) {
143 LuanTable tbl = Luan.newTable(); 143 LuanTable tbl = new LuanTable();
144 tbl.put("type","comment"); 144 tbl.put("type","comment");
145 tbl.put("text",text); 145 tbl.put("text",text);
146 return tbl; 146 return tbl;
147 } 147 }
148 148
149 static LuanTable cdata(String text) { 149 static LuanTable cdata(String text) {
150 LuanTable tbl = Luan.newTable(); 150 LuanTable tbl = new LuanTable();
151 tbl.put("type","cdata"); 151 tbl.put("type","cdata");
152 tbl.put("text",text); 152 tbl.put("text",text);
153 return tbl; 153 return tbl;
154 } 154 }
155 155
156 static LuanTable textContainer(LuanTable tag,String text) { 156 static LuanTable textContainer(LuanTable tag,String text) {
157 LuanTable tbl = Luan.newTable(); 157 LuanTable tbl = new LuanTable();
158 tbl.put("type","container"); 158 tbl.put("type","container");
159 tbl.put("tag",tag); 159 tbl.put("tag",tag);
160 tbl.put("text",text); 160 tbl.put("text",text);
161 return tbl; 161 return tbl;
162 } 162 }
168 super(msg); 168 super(msg);
169 } 169 }
170 } 170 }
171 171
172 static LuanTable parseTag(String text) { 172 static LuanTable parseTag(String text) {
173 LuanTable tbl = Luan.newTable(); 173 LuanTable tbl = new LuanTable();
174 tbl.put("type","tag"); 174 tbl.put("type","tag");
175 if( text.endsWith("/") ) { 175 if( text.endsWith("/") ) {
176 text = text.substring(0,text.length()-1); 176 text = text.substring(0,text.length()-1);
177 tbl.put("is_empty",true); 177 tbl.put("is_empty",true);
178 } else { 178 } else {
191 throw new BadTag("invalid tag name for <"+text+">"); 191 throw new BadTag("invalid tag name for <"+text+">");
192 i2++; 192 i2++;
193 } 193 }
194 String name = text.substring(i,i2).toLowerCase(); 194 String name = text.substring(i,i2).toLowerCase();
195 tbl.put("name",name); 195 tbl.put("name",name);
196 LuanTable attributes = Luan.newTable(); 196 LuanTable attributes = new LuanTable();
197 tbl.put("attributes",attributes); 197 tbl.put("attributes",attributes);
198 i = i2; 198 i = i2;
199 while( i<len && Character.isWhitespace(text.charAt(i)) ) i++; 199 while( i<len && Character.isWhitespace(text.charAt(i)) ) i++;
200 while( i<len ) { 200 while( i<len ) {
201 i2 = toEndName(text,i,len); 201 i2 = toEndName(text,i,len);