From 9ce594776d3239b3779596e0057b00d5f003fdfe Mon Sep 17 00:00:00 2001 From: WindowsSov8forUs Date: Wed, 19 Jun 2024 13:33:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=8C=87=E6=98=8E=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E4=B8=8D=E6=98=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/message/message_element_extend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/message/message_element_extend.go b/pkg/message/message_element_extend.go index 7394dbc..4d4037e 100644 --- a/pkg/message/message_element_extend.go +++ b/pkg/message/message_element_extend.go @@ -39,7 +39,7 @@ func (e *MessageElementExtend) Parse(n *html.Node) (MessageElement, error) { return result, nil } -func NewMessageElementExtend(tag string, attrs map[string]string, children ...MessageElement) MessageElement { +func NewMessageElementExtend(tag string, attrs map[string]string, children ...MessageElement) *MessageElementExtend { result := &MessageElementExtend{ tag: tag, } From 5de5949de8d70d54045859cc3ada9cffd8c6c05d Mon Sep 17 00:00:00 2001 From: WindowsSov8forUs Date: Wed, 19 Jun 2024 13:57:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E5=AD=90=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E4=B8=8E=E6=89=A9=E5=B1=95=E5=B1=9E=E6=80=A7=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=AE=BE=E7=BD=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/message/message_element.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/message/message_element.go b/pkg/message/message_element.go index e3b0bfc..e65ae7f 100644 --- a/pkg/message/message_element.go +++ b/pkg/message/message_element.go @@ -57,6 +57,11 @@ func (e *ChildrenMessageElement) GetChildren() []MessageElement { return e.children } +func (e *ChildrenMessageElement) SetChildren(children []MessageElement) *ChildrenMessageElement { + e.children = children + return e +} + type ExtendAttributes struct { attributes map[string]string } @@ -72,6 +77,14 @@ func (e *ExtendAttributes) AddAttribute(key, value string) *ExtendAttributes { return result } +func (e *ExtendAttributes) DelAttribute(key string) *ExtendAttributes { + if e == nil { + return nil + } + delete(e.attributes, key) + return e +} + func (e *ExtendAttributes) Get(key string) (string, bool) { if e == nil { return "", false