mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 01:05:32 +00:00
finalversion marginalien
This commit is contained in:
@@ -122,6 +122,10 @@ type Tokens struct {
|
||||
Out []outToken
|
||||
}
|
||||
|
||||
func (s *Tokens) Prepend(token outToken) {
|
||||
s.Out = append([]outToken{token}, s.Out...)
|
||||
}
|
||||
|
||||
func (s *Tokens) AppendDefaultElement(token xmlparsing.Token, ids ...string) {
|
||||
t := Default(token)
|
||||
if len(ids) > 0 {
|
||||
@@ -131,6 +135,18 @@ func (s *Tokens) AppendDefaultElement(token xmlparsing.Token, ids ...string) {
|
||||
s.Out = append(s.Out, t)
|
||||
}
|
||||
|
||||
func (s *Tokens) AppendCustomAttribute(name, value string) {
|
||||
if len(s.Out) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if s.Out[len(s.Out)-1].Attributes == nil {
|
||||
s.Out[len(s.Out)-1].Attributes = make(map[string]string)
|
||||
}
|
||||
|
||||
s.Out[len(s.Out)-1].Attributes[name] = value
|
||||
}
|
||||
|
||||
func (s *Tokens) AppendEndElement() {
|
||||
skip := 0
|
||||
for i := len(s.Out) - 1; i >= 0; i-- {
|
||||
|
||||
Reference in New Issue
Block a user