~reesmichael1/chantpointer

ref: b0b65c712e541f0b613f923396fbf46db099f920 chantpointer/writer.go -rw-r--r-- 444 bytes
b0b65c71 — Michael Rees Try without ls 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
	"io"
	"text/template"
)

// WriteTexForChant writes the given Chant to an io.Writer
// (in practice, a text file, or for testing, an in-memory buffer)
func WriteTexForChant(f io.Writer, c *Chant) error {
	templatePath := "psalm.tem"
	t, err := template.New(templatePath).Delims("((", "))").ParseFiles(templatePath)
	if err != nil {
		return err
	}

	err = t.Execute(f, c)
	if err != nil {
		return err
	}

	return nil
}