Skip to content

Commit

Permalink
Added substring support, fixed template (#1)
Browse files Browse the repository at this point in the history
* added substring support, fixed template

* adjustment to template
  • Loading branch information
FestinaLente666 authored Dec 18, 2021
1 parent 3206471 commit 0e54798
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
7 changes: 4 additions & 3 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ func renderWallet(wallet model.KaspaperWallet) (string, error) {
return "", err
}

tmpl, err := template.New("kaspaper").Parse(templateString)
if err != nil {
return "", err
funcMap := template.FuncMap{
"sub": func(str string, i, j int) string { return str[i:j] },
}

tmpl := template.Must(template.New("kaspaper").Funcs(funcMap).Parse(templateString))

buf := &bytes.Buffer{}
err = tmpl.Execute(buf, walletTemplate)
if err != nil {
Expand Down
20 changes: 9 additions & 11 deletions template.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
float: right;
font-family: monospace;
font-size: 30pt;
margin-top: 10px;
margin-right: 50px;
width: 400px;
word-wrap: break-word;
text-align: right;
}

#QR {
Expand All @@ -110,13 +110,7 @@
margin-top : -45px;
margin-left: 300px;
}

#bg1 {
position: absolute;
left:0px;
top:0px;
z-index:-1;
}

</style>
<title>KASPAPER — KASPA Paper Wallet</title>
</head>
Expand Down Expand Up @@ -168,8 +162,12 @@ <h1 style="margin-top: 0px;">
<div class = "QR">
<img id = "QR" src="data:image/png;base64, {{.AddressQR}}" alt="Address QR" />
</div>
<div class="addr">
{{.Address}}
<div class="addr">
{{sub .Address 0 18}}<br>
{{sub .Address 18 30}}<br>
{{sub .Address 30 42}}<br>
{{sub .Address 42 54}}<br>
{{sub .Address 54 67}}<br>
</div>
</div>
</page>
Expand Down

0 comments on commit 0e54798

Please sign in to comment.