mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 00:47:15 -04:00
Add StyleStack.Parent, returning the current style's parent
This commit is contained in:
@@ -83,6 +83,14 @@ func (s StyleStack) Indent() uint {
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s StyleStack) Parent() *ElementStyle {
|
||||||
|
if len(s) < 2 {
|
||||||
|
return s.Current()
|
||||||
|
}
|
||||||
|
|
||||||
|
return cascadeStyles(s[0:len(s)-2], s[len(s)-2])
|
||||||
|
}
|
||||||
|
|
||||||
func (s StyleStack) Current() *ElementStyle {
|
func (s StyleStack) Current() *ElementStyle {
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user