- Timestamp:
- Dec 4, 2023, 5:21:08 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cmd/aya/main.go
r76 r77 1 // $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6. 7 2023-12-04 01:55:36+0000, yakumo_izuru Exp $1 // $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.8 2023-12-04 15:43:44+0000, yakumo_izuru Exp $ 2 2 package main 3 3 … … 142 142 // Render expanding aya plugins and variables 143 143 func render(s string, vars Vars) (string, error) { 144 delim _open := "{{"145 delim _close := "}}"144 delimOpen := "{{" 145 delimClose := "}}" 146 146 147 147 out := &bytes.Buffer{} 148 148 for { 149 if from := strings.Index(s, delim _open); from == -1 {149 if from := strings.Index(s, delimOpen); from == -1 { 150 150 out.WriteString(s) 151 151 return out.String(), nil 152 152 } else { 153 if to := strings.Index(s, delim _close); to == -1 {154 return "", fmt.Errorf("Clos e delimnot found")153 if to := strings.Index(s, delimClose); to == -1 { 154 return "", fmt.Errorf("Closing delimiter not found") 155 155 } else { 156 156 out.WriteString(s[:from]) 157 cmd := s[from+len(delim _open) : to]158 s = s[to+len(delim _close):]157 cmd := s[from+len(delimOpen) : to] 158 s = s[to+len(delimClose):] 159 159 m := strings.Fields(cmd) 160 160 if len(m) == 1 { … … 309 309 if ext == ".md" || ext == ".mkd" || ext == ".markdown" { 310 310 return buildMarkdown(path, w, vars) 311 } else if ext == ".htm l" || ext == ".xml" {311 } else if ext == ".htm" || ext == ".html" || ext == ".xht" || ext == ".xhtml" { 312 312 return buildHTML(path, w, vars) 313 313 } else if ext == ".amber" {
Note:
See TracChangeset
for help on using the changeset viewer.