~reesmichael1/chantpointer

ref: fix_ci chantpointer/writer.go -rw-r--r-- 444 bytes View raw
a8ef912f — Michael Rees Only build on master 1 year, 6 months 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
}