Complete move map code to page code in render module

This commit is contained in:
lash
2023-04-10 15:26:18 +01:00
parent 765bc2a269
commit 0831a4ea53
11 changed files with 61 additions and 36 deletions

View File

@@ -113,12 +113,11 @@ func (en *Engine) Exec(input []byte, ctx context.Context) (bool, error) {
// - the template for the given node point is note available for retrieval using the resource.Resource implementer.
// - the supplied writer fails to process the writes.
func(en *Engine) WriteResult(w io.Writer) error {
location, idx := en.st.Where()
//location, idx := en.st.Where()
r, err := en.vm.Render()
if err != nil {
return err
}
c, err := io.WriteString(w, r)
log.Printf("%v bytes written as result for %v idx %v", c, location, idx)
_, err = io.WriteString(w, r)
return err
}

View File

@@ -36,9 +36,11 @@ func Loop(en *Engine, startSym string, ctx context.Context, reader io.Reader, wr
if err != nil {
return fmt.Errorf("unexpected termination: %v\n", err)
}
b := bytes.NewBuffer(nil)
en.WriteResult(b)
writer.Write(b.Bytes())
//b := bytes.NewBuffer(nil)
err = en.WriteResult(writer)
if err != nil {
return err
}
writer.Write([]byte{0x0a})
}
return nil