Type TSTag = Class
	///缺省构造函数
	Function Create(); overload;
	Begin
	End;
	
	Function Init(tagName, attribute, r); 
	Begin
		tagName_ := tagName;
		attribute_ := attribute;
		runArr_ := r;
		range_ := nil;
		map_ := nil;
	End;
	
	Property Range read readRange;
	Function readRange();
	Begin
		if ifNil(range_) then Begin
			range_ := TOfficeObj('TRange');
			range_.Init(runArr_);
		End;
		return range_;
	End;
	
	///获取TAG中属性 [font size=12]...[/font]
	///  tag.GetAttribute('size');
	///返回：string
	Function GetAttribute(key);
	Begin
		if not ifArray(map_) then Begin
			map_ := array();
			//println('attribute={}',attribute_);
			arr := Str2Array(attribute_, ' ');
			for i := 0 to length(arr)-1 do Begin
				kv := Str2Array(arr[i], '=');
				if length(kv)=2 then 
					map_[kv[0]] := kv[1];
			End;
		End;
		return map_[key];
	End;
	
	Function Apply(); virtual;
	Begin
		case tagName_ of
		'add':
			_add();
		'del':
			_del();
		End;
	End;
	
	Function _add();
	Begin
		Range.Font.Size := 40;
		Range.Font.Color := 'FF0000';
		Range.Font.Bold := true;
		Range.Apply();
	End;
	
	Function _del();
	Begin
		Range.Clear();
	End;
	
	tagName_:string;
	attribute_:string;
	runArr_;
	range_;
	map_;
End;
