~reesmichael1/chantpointer

ref: e8f306b2bbd69105afce04178a12356fcae8bc14 chantpointer/writer.go -rw-r--r-- 448 bytes View raw
e8f306b2Michael Rees Update URL of personal website 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 {
	t, err := template.New("psalm.tem").Delims("((", "))").ParseFiles("templates/tex/psalm.tem")
	if err != nil {
		return err
	}

	err = t.ExecuteTemplate(f, "psalm.tem", c)
	if err != nil {
		return err
	}

	return nil
}