mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-04 23:30:25 +08:00
fix(#21): br decoding
This commit is contained in:
@@ -117,12 +117,12 @@ func (r *Run) parse(d *xml.Decoder, tt xml.StartElement) (child interface{}, err
|
|||||||
case "tab":
|
case "tab":
|
||||||
child = &Tab{}
|
child = &Tab{}
|
||||||
case "br":
|
case "br":
|
||||||
var brvalue BarterRabbet
|
var value BarterRabbet
|
||||||
err = d.DecodeElement(&brvalue, &tt)
|
err = d.DecodeElement(&value, &tt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
child = &brvalue
|
child = &value
|
||||||
case "AlternateContent":
|
case "AlternateContent":
|
||||||
/*var value AlternateContent
|
/*var value AlternateContent
|
||||||
value.file = r.file
|
value.file = r.file
|
||||||
|
|||||||
@@ -94,6 +94,19 @@ type BarterRabbet struct {
|
|||||||
Type string `xml:"w:type,attr,omitempty"`
|
Type string `xml:"w:type,attr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalXML ...
|
||||||
|
func (f *BarterRabbet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||||
|
for _, attr := range start.Attr {
|
||||||
|
switch attr.Name.Local {
|
||||||
|
case "type":
|
||||||
|
f.Type = attr.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Consume the end element
|
||||||
|
_, err := d.Token()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Text object contains the actual text
|
// Text object contains the actual text
|
||||||
type Text struct {
|
type Text struct {
|
||||||
XMLName xml.Name `xml:"w:t,omitempty"`
|
XMLName xml.Name `xml:"w:t,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user