comparison core/src/luan/modules/HtmlLuan.java @ 578:60c549d43988

remove LuanState.exception()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Jul 2015 17:40:48 -0600
parents 7c3ad6db8ac3
children a3c1e11fb6aa
comparison
equal deleted inserted replaced
577:d7a85fbe15f1 578:60c549d43988
282 buf.append( o ); 282 buf.append( o );
283 } else if( o instanceof LuanTable ) { 283 } else if( o instanceof LuanTable ) {
284 LuanTable t = (LuanTable)o; 284 LuanTable t = (LuanTable)o;
285 String type = (String)t.get(luan,"type"); 285 String type = (String)t.get(luan,"type");
286 if( type==null ) 286 if( type==null )
287 throw luan.exception( "no type in element of table for 'Html.to_string'" ); 287 throw new LuanException(luan, "no type in element of table for 'Html.to_string'" );
288 if( type.equals("comment") ) { 288 if( type.equals("comment") ) {
289 buf.append( "<!--" ).append( t.get(luan,"text") ).append( "-->" ); 289 buf.append( "<!--" ).append( t.get(luan,"text") ).append( "-->" );
290 } else if( type.equals("cdata") ) { 290 } else if( type.equals("cdata") ) {
291 buf.append( "<![CDATA[" ).append( t.get(luan,"text") ).append( "]]" ); 291 buf.append( "<![CDATA[" ).append( t.get(luan,"text") ).append( "]]" );
292 } else if( type.equals("tag") ) { 292 } else if( type.equals("tag") ) {
295 LuanTable tag = (LuanTable)t.get(luan,"tag"); 295 LuanTable tag = (LuanTable)t.get(luan,"tag");
296 buf.append( tagToString(luan,tag) ); 296 buf.append( tagToString(luan,tag) );
297 buf.append( t.get(luan,"text") ); 297 buf.append( t.get(luan,"text") );
298 buf.append( "</" ).append( tag.get(luan,"name") ).append( ">" ); 298 buf.append( "</" ).append( tag.get(luan,"name") ).append( ">" );
299 } else { 299 } else {
300 throw luan.exception( "invalid element type for 'Html.to_string'" ); 300 throw new LuanException(luan, "invalid element type for 'Html.to_string'" );
301 } 301 }
302 } else 302 } else
303 throw luan.exception( "invalid value ("+Luan.type(o)+") in table for 'Html.to_string'" ); 303 throw new LuanException(luan, "invalid value ("+Luan.type(o)+") in table for 'Html.to_string'" );
304 } 304 }
305 return buf.toString(); 305 return buf.toString();
306 } 306 }
307 307
308 private static String tagToString(LuanState luan,LuanTable tbl) throws LuanException { 308 private static String tagToString(LuanState luan,LuanTable tbl) throws LuanException {