mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 01:05:32 +00:00
linker seitenrand
This commit is contained in:
@@ -147,13 +147,22 @@ func (s *Tokens) AppendCustomAttribute(name, value string) {
|
||||
s.Out[len(s.Out)-1].Attributes[name] = value
|
||||
}
|
||||
|
||||
func (s *Tokens) AppendElement(name string, id string, classes ...string) {
|
||||
s.Out = append(s.Out, outToken{
|
||||
Name: name,
|
||||
Id: id,
|
||||
Classes: classes,
|
||||
Type: Element,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Tokens) AppendEndElement() {
|
||||
skip := 0
|
||||
for i := len(s.Out) - 1; i >= 0; i-- {
|
||||
if s.Out[i].Type == EndElement {
|
||||
skip++
|
||||
}
|
||||
if s.Out[i].Type == Element {
|
||||
if s.Out[i].Type == Element && s.Out[i].Name != "p" && s.Out[i].Name != "br" {
|
||||
if skip == 0 {
|
||||
s.Out = append(s.Out, outToken{
|
||||
Name: s.Out[i].Name,
|
||||
|
||||
@@ -64,7 +64,7 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
ps := LenzParseState{CloseElement: true}
|
||||
ps := LenzParseState{CloseElement: true, PC: "1"}
|
||||
|
||||
for elem, err := range xmlparsing.Iterate(s, ps) {
|
||||
if err != nil {
|
||||
@@ -158,9 +158,14 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
|
||||
if val := elem.Token.Attributes["type"]; val != "empty" {
|
||||
ps.LC += 1
|
||||
if ps.Break {
|
||||
// if elem.Token.Attributes["tab"] == "1" {
|
||||
// ps.Tokens.AppendElement("p", ps.PC+"-"+strconv.Itoa(ps.LC), "tab-1")
|
||||
// ps.CloseElement = false
|
||||
// } else {
|
||||
ps.Tokens.AppendEmptyElement("br", ps.PC+"-"+strconv.Itoa(ps.LC))
|
||||
ps.Tokens.AppendDefaultElement(elem.Token) // This is for indents, must be closed
|
||||
// }
|
||||
}
|
||||
ps.Tokens.AppendDefaultElement(elem.Token) // This is for indents, must be closed
|
||||
} else {
|
||||
ps.Tokens.AppendEmptyElement("br", "", "empty")
|
||||
ps.CloseElement = false // Here Indents make no sense, so we dont open an element
|
||||
|
||||
Reference in New Issue
Block a user