Passed through golint only to get a load of garbage
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja> git-svn-id: file:///srv/svn/repo/aya/trunk@77 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.7 2023-12-04 01:55:36+0000, yakumo_izuru Exp $
|
||||
// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.8 2023-12-04 15:43:44+0000, yakumo_izuru Exp $
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -141,21 +141,21 @@ func getVars(path string, globals Vars) (Vars, string, error) {
|
||||
|
||||
// Render expanding aya plugins and variables
|
||||
func render(s string, vars Vars) (string, error) {
|
||||
delim_open := "{{"
|
||||
delim_close := "}}"
|
||||
delimOpen := "{{"
|
||||
delimClose := "}}"
|
||||
|
||||
out := &bytes.Buffer{}
|
||||
for {
|
||||
if from := strings.Index(s, delim_open); from == -1 {
|
||||
if from := strings.Index(s, delimOpen); from == -1 {
|
||||
out.WriteString(s)
|
||||
return out.String(), nil
|
||||
} else {
|
||||
if to := strings.Index(s, delim_close); to == -1 {
|
||||
return "", fmt.Errorf("Close delim not found")
|
||||
if to := strings.Index(s, delimClose); to == -1 {
|
||||
return "", fmt.Errorf("Closing delimiter not found")
|
||||
} else {
|
||||
out.WriteString(s[:from])
|
||||
cmd := s[from+len(delim_open) : to]
|
||||
s = s[to+len(delim_close):]
|
||||
cmd := s[from+len(delimOpen) : to]
|
||||
s = s[to+len(delimClose):]
|
||||
m := strings.Fields(cmd)
|
||||
if len(m) == 1 {
|
||||
if v, ok := vars[m[0]]; ok {
|
||||
@@ -308,7 +308,7 @@ func build(path string, w io.Writer, vars Vars) error {
|
||||
ext := filepath.Ext(path)
|
||||
if ext == ".md" || ext == ".mkd" || ext == ".markdown" {
|
||||
return buildMarkdown(path, w, vars)
|
||||
} else if ext == ".html" || ext == ".xml" {
|
||||
} else if ext == ".htm" || ext == ".html" || ext == ".xht" || ext == ".xhtml" {
|
||||
return buildHTML(path, w, vars)
|
||||
} else if ext == ".amber" {
|
||||
return buildAmber(path, w, vars)
|
||||
|
||||
Reference in New Issue
Block a user