mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-27 11:39:57 -04:00
Add StyleStack.Parent, returning the current style's parent
This commit is contained in:
1 parent
9974d6bad9
commit
ca06d9968c
1 file changed
+8
@@ -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