diff src/goodjava/html/Html.java @ 1714:31a82b0d0a87

bbcode and html work
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 18 Jul 2022 23:49:47 -0600
parents 36c28be6d432
children a045f30fa67d
line wrap: on
line diff
--- a/src/goodjava/html/Html.java	Fri Jul 15 11:55:27 2022 -0600
+++ b/src/goodjava/html/Html.java	Mon Jul 18 23:49:47 2022 -0600
@@ -72,12 +72,18 @@
 		public final Map<String,Object> attributes;
 		public final boolean isEmpty;
 		public final String raw;
+		public final Map<String,String> style;
 
 		private Tag(String name,Map<String,Object> attributes,boolean isEmpty,String raw) {
+			this(name,attributes,isEmpty,raw,null);
+		}
+
+		private Tag(String name,Map<String,Object> attributes,boolean isEmpty,String raw,Map<String,String> style) {
 			this.name = name;
 			this.attributes = attributes;
 			this.isEmpty = isEmpty;
 			this.raw = raw;
+			this.style = style;
 		}
 	}
 
@@ -209,23 +215,20 @@
 		String name = parser.textFrom(start).toLowerCase();
 		Map<String,Object> attributes = new HashMap<String,Object>();
 		String attrName;
+		Map<String,String> style = null;
 		while( (attrName = parseAttrName()) != null ) {
 			String attrValue = parseAttrValue();
 			attributes.put( attrName, attrValue!=null ? attrValue : true );
-/*
-			if( attrName.equals("style") && attrValue!=null ) {
-				LuanTable style = Css.style(attrValue);
-				if( style!=null )
-					tbl.rawPut("style",style);
+			if( attrName.equals("style") && attrValue!=null && style==null ) {
+				style = Css.style(attrValue);
 			}
-*/
 		}
 		while( matchSpace() );
 		boolean isEmpty = parser.match('/');
 		if( !parser.match('>') )
 			return parser.failure(null);
 		String raw = parser.textFrom(tagStart);
-		Tag tag = new Tag(name,attributes,isEmpty,raw);
+		Tag tag = new Tag(name,attributes,isEmpty,raw,style);
 		return parser.success(tag);
 	}