1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-05 07:40:24 +08:00

shrink xmlns

This commit is contained in:
源文雨
2023-02-15 16:08:28 +08:00
parent e2bc804cc1
commit 2771d05a51
8 changed files with 116 additions and 32 deletions

View File

@@ -8,9 +8,9 @@ import (
// Run is part of a paragraph that has its own style. It could be
// a piece of text in bold, or a link
type Run struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main r,omitempty"`
RunProperties *RunProperties `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main rPr,omitempty"`
InstrText string `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main instrText,omitempty"`
XMLName xml.Name `xml:"w:r,omitempty"`
RunProperties *RunProperties `xml:"w:rPr,omitempty"`
InstrText string `xml:"w:instrText,omitempty"`
Text *Text
Drawing *Drawing
}
@@ -54,11 +54,11 @@ func (r *Run) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// RunProperties encapsulates visual properties of a run
type RunProperties struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main rPr,omitempty"`
Color *Color `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main color,omitempty"`
Size *Size `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main sz,omitempty"`
RunStyle *RunStyle `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main rStyle,omitempty"`
Style *Style `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main pStyle,omitempty"`
XMLName xml.Name `xml:"w:rPr,omitempty"`
Color *Color `xml:"w:color,omitempty"`
Size *Size `xml:"w:sz,omitempty"`
RunStyle *RunStyle `xml:"w:rStyle,omitempty"`
Style *Style `xml:"w:pStyle,omitempty"`
}
func (r *RunProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
@@ -100,25 +100,25 @@ func (r *RunProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err
// RunStyle contains styling for a run
type RunStyle struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main rStyle,omitempty"`
XMLName xml.Name `xml:"w:rStyle,omitempty"`
Val string `xml:"w:val,attr"`
}
// Style contains styling for a paragraph
type Style struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main pStyle,omitempty"`
XMLName xml.Name `xml:"w:pStyle,omitempty"`
Val string `xml:"w:val,attr"`
}
// Color contains the sound of music. :D
// I'm kidding. It contains the color
type Color struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main color"`
XMLName xml.Name `xml:"w:color"`
Val string `xml:"w:val,attr"`
}
// Size contains the font size
type Size struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main sz"`
XMLName xml.Name `xml:"w:sz"`
Val string `xml:"w:val,attr"`
}