Update help page

This commit is contained in:
Fred Boniface 2023-09-01 23:01:08 +01:00
parent 8e7350a355
commit cc08f8358e
3 changed files with 24 additions and 30 deletions

View File

@ -30,7 +30,7 @@
{{end}} {{end}}
</ul> </ul>
<p><code>width</code> and <code>height</code> are in pixels</p> <p><code>width</code> and <code>height</code> are in pixels - PDF417 is a fixed size and these options will only change the canvas size.</p>
<p><code>ecc_level</code> should be 1, 2, 3 or 4 where 1 is least resilient and 4 is most resilient</p> <p><code>ecc_level</code> should be 1, 2, 3 or 4 where 1 is least resilient and 4 is most resilient</p>

View File

@ -41,13 +41,13 @@ var FormatRules = map[string]rule{
divisible: 1, divisible: 1,
}, },
"code39": { /* "code39": {
minLength: 1, minLength: 1,
maxLength: 80, maxLength: 80,
charset: *CODE39, charset: *CODE39,
divisible: 1, divisible: 1,
}, },
*/
"code93": { "code93": {
minLength: 1, minLength: 1,
maxLength: 80, maxLength: 80,
@ -68,7 +68,7 @@ var FormatRules = map[string]rule{
charset: *ANY, charset: *ANY,
divisible: 1, divisible: 1,
}, },
/*
"ean8": { "ean8": {
minLength: 7, minLength: 7,
maxLength: 7, maxLength: 7,
@ -82,7 +82,7 @@ var FormatRules = map[string]rule{
charset: *NUMERAL, charset: *NUMERAL,
divisible: 1, divisible: 1,
}, },
*/
"pdf417": { "pdf417": {
minLength: 1, minLength: 1,
maxLength: 1100, maxLength: 1100,

View File

@ -1,7 +1,6 @@
package web package web
import ( import (
"fmt"
"html/template" "html/template"
"net/http" "net/http"
@ -23,14 +22,9 @@ func buildPage(w http.ResponseWriter, r *http.Request) {
BarcodeOptions: barcodeOptions, BarcodeOptions: barcodeOptions,
} }
tmpl, err := template.New("help").ParseFiles("templates/help.html") // Match template name and file name tmpl := template.Must(template.New("help.html").ParseFiles("templates/help.html"))
if err != nil {
fmt.Println("Error templating page: ", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
err = tmpl.Execute(w, data) err := tmpl.Execute(w, data)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return