~reesmichael1/chantpointer

ref: 0ba42d0dff660f88ca66c3b97a6fed56d37721a4 chantpointer/writer.go -rw-r--r-- 448 bytes View raw
0ba42d0dMichael Rees Use .ssh/config as secret 1 year, 5 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
}