~reesmichael1/chantpointer

ref: 6df64b10f376416ac967c295029c278b33791f13 chantpointer/writer.go -rw-r--r-- 448 bytes
6df64b10Michael Rees Fix missing style on code block 2 years 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
}