label-tool: unindent template

This commit is contained in:
Přemysl Eric Janouch 2019-04-14 21:38:26 +02:00
parent 412efcb1ae
commit 32ad36a287
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -19,59 +19,59 @@ import (
var font *bdf.Font var font *bdf.Font
var tmpl = template.Must(template.New("form").Parse(` var tmpl = template.Must(template.New("form").Parse(`
<!DOCTYPE html> <!DOCTYPE html>
<html><body> <html><body>
<h1>PT-CBP label printing tool</h1> <h1>PT-CBP label printing tool</h1>
<table><tr> <table><tr>
<td valign=top> <td valign=top>
<img border=1 src='?img&amp;scale={{.Scale}}&amp;text={{.Text}}'> <img border=1 src='?img&amp;scale={{.Scale}}&amp;text={{.Text}}'>
</td> </td>
<td valign=top> <td valign=top>
<fieldset> <fieldset>
{{ if .Printer }} {{ if .Printer }}
<p>Printer: {{ .Printer.Manufacturer }} {{ .Printer.Model }} <p>Printer: {{ .Printer.Manufacturer }} {{ .Printer.Model }}
<p>Tape: <p>Tape:
{{ if .Printer.LastStatus }} {{ if .Printer.LastStatus }}
{{ .Printer.LastStatus.MediaWidthMM }} mm &times; {{ .Printer.LastStatus.MediaWidthMM }} mm &times;
{{ .Printer.LastStatus.MediaLengthMM }} mm {{ .Printer.LastStatus.MediaLengthMM }} mm
{{ if .MediaInfo }} {{ if .MediaInfo }}
(offset: {{ .MediaInfo.SideMarginPins }} pt, (offset: {{ .MediaInfo.SideMarginPins }} pt,
print area: {{ .MediaInfo.PrintAreaPins }} pt) print area: {{ .MediaInfo.PrintAreaPins }} pt)
{{ else }} {{ else }}
(unknown media) (unknown media)
{{ end }} {{ end }}
{{ if .Printer.LastStatus.Errors }} {{ if .Printer.LastStatus.Errors }}
{{ range .Printer.LastStatus.Errors }} {{ range .Printer.LastStatus.Errors }}
<p>Error: {{ . }} <p>Error: {{ . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .InitErr }} {{ if .InitErr }}
{{ .InitErr }} {{ .InitErr }}
{{ end }} {{ end }}
{{ else }} {{ else }}
<p>Error: {{ .PrinterErr }} <p>Error: {{ .PrinterErr }}
{{ end }} {{ end }}
</fieldset> </fieldset>
<fieldset> <fieldset>
<p>Font: {{ .Font.Name }} <p>Font: {{ .Font.Name }}
</fieldset> </fieldset>
<form><fieldset> <form><fieldset>
<p><label for=text>Text:</label> <p><label for=text>Text:</label>
<input id=text name=text value='{{.Text}}'> <input id=text name=text value='{{.Text}}'>
<label for=scale>Scale:</label> <label for=scale>Scale:</label>
<input id=scale name=scale value='{{.Scale}}' size=1> <input id=scale name=scale value='{{.Scale}}' size=1>
<p><input type=submit value='Update'> <p><input type=submit value='Update'>
<input type=submit name=print value='Update and Print'> <input type=submit name=print value='Update and Print'>
</fieldset></form> </fieldset></form>
</td> </td>
</tr></table> </tr></table>
</body></html> </body></html>
`)) `))
func getPrinter() (*ql.Printer, error) { func getPrinter() (*ql.Printer, error) {