@@ -91,13 +91,15 @@ Run `npm install my-app`
9191- [ Standard Library] ( #standard-library )
9292 - [fs](#fs)
9393 - [outputto](#outputto)
94- - [base64](#base64)
9594 - [container](#container)
9695 - [conversion](#conversion)
9796 - [globals](#globals)
9897 - [import](#import)
9998 - [return](#return)
10099 - [debug](#debug)
100+ - [base64](#base64)
101+ - [hex](#hex)
102+ - [hash](#hash)
101103 - [html](#html)
102104 - [http](#http)
103105 - [json](#json)
@@ -308,7 +310,8 @@ Need something that is not there? Add your own with a custom module or your own
308310<table width =" 100% " >
309311<tr ><th align =" left " ><h4 ><code >readArgs(path string, args any) (string, throws error)</code ></h4 ></th >
310312</tr ><tr ><td >
311- <p >Reads file and passes arguments to it.</p >
313+ <p >Reads file and passes arguments to it.
314+ Arguments are available as <code >.arg</code > in the file being read.</p >
312315
313316
314317<details >
@@ -585,25 +588,6 @@ The returned path will always be relative to basePath, even if basePath and targ
585588Errors if path is not allowed.</p >
586589
587590
588- </td ></tr ></table >
589- <h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/base64/base64.go " >base64</a ></h3 >
590-
591-
592- <table width =" 100% " >
593- <tr ><th align =" left " ><h4 ><code >base64Encode(encode string) string</code ></h4 ></th >
594- </tr ><tr ><td >
595- <p >Encodes strings with base64.</p >
596-
597-
598- </td ></tr ></table >
599-
600-
601- <table width =" 100% " >
602- <tr ><th align =" left " ><h4 ><code >base64Decode(decode string) (string, throws error)</code ></h4 ></th >
603- </tr ><tr ><td >
604- <p >Decodes a base64 string.</p >
605-
606-
607591</td ></tr ></table >
608592<h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/container/container.go " >container</a ></h3 >
609593
@@ -765,9 +749,18 @@ map[key1:value1 key2:value2]
765749
766750
767751<table width =" 100% " >
768- <tr ><th align =" left " ><h4 ><code >toString(value string) string</code ></h4 ></th >
752+ <tr ><th align =" left " ><h4 ><code >toString(value any) string</code ></h4 ></th >
753+ </tr ><tr ><td >
754+ <p >Returns a given value as string (using <a href =" https://pkg.go.dev/fmt#Sprint " >fmt.Sprint</a >, bytes are handled separately).</p >
755+
756+
757+ </td ></tr ></table >
758+
759+
760+ <table width =" 100% " >
761+ <tr ><th align =" left " ><h4 ><code >toBytes(str string) []byte</code ></h4 ></th >
769762</tr ><tr ><td >
770- <p >Returns a given value as string (using < a href = " https://pkg.go.dev/fmt#Sprint " >fmt.Sprint</ a >) .</p >
763+ <p >Turns a string into bytes .</p >
771764
772765
773766</td ></tr ></table >
@@ -931,6 +924,81 @@ The fs resolver is only available as an internal module and does not ship with t
931924<p >Outputs data to stdout.</p >
932925
933926
927+ </td ></tr ></table >
928+ <h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/encoding/base64.go " >base64</a ></h3 >
929+
930+
931+ <table width =" 100% " >
932+ <tr ><th align =" left " ><h4 ><code >base64Encode(str string) string</code ></h4 ></th >
933+ </tr ><tr ><td >
934+ <p >Encodes strings with base64.</p >
935+
936+
937+ </td ></tr ></table >
938+
939+
940+ <table width =" 100% " >
941+ <tr ><th align =" left " ><h4 ><code >base64Decode(str string) (string, throws error)</code ></h4 ></th >
942+ </tr ><tr ><td >
943+ <p >Decodes a base64 string.</p >
944+
945+
946+ </td ></tr ></table >
947+ <h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/encoding/hex.go " >hex</a ></h3 >
948+
949+
950+ <table width =" 100% " >
951+ <tr ><th align =" left " ><h4 ><code >hexEncode(str string) string</code ></h4 ></th >
952+ </tr ><tr ><td >
953+ <p >Encodes a string as hex.</p >
954+
955+
956+ </td ></tr ></table >
957+
958+
959+ <table width =" 100% " >
960+ <tr ><th align =" left " ><h4 ><code >hexDecode(str string) (string, throws error)</code ></h4 ></th >
961+ </tr ><tr ><td >
962+ <p >Decodes a string as hex.</p >
963+
964+
965+ </td ></tr ></table >
966+ <h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/hash/hash.go " >hash</a ></h3 >
967+
968+
969+ <table width =" 100% " >
970+ <tr ><th align =" left " ><h4 ><code >hash(str string)</code ></h4 ></th >
971+ </tr ><tr ><td >
972+ <p >Hashes a given string with SHA-256.</p >
973+
974+
975+ </td ></tr ></table >
976+
977+
978+ <table width =" 100% " >
979+ <tr ><th align =" left " ><h4 ><code >sha1(str string)</code ></h4 ></th >
980+ </tr ><tr ><td >
981+ <p >Hashes a given string with SHA-1.</p >
982+
983+
984+ </td ></tr ></table >
985+
986+
987+ <table width =" 100% " >
988+ <tr ><th align =" left " ><h4 ><code >sha512(str string)</code ></h4 ></th >
989+ </tr ><tr ><td >
990+ <p >Hashes a given string with SHA-512.</p >
991+
992+
993+ </td ></tr ></table >
994+
995+
996+ <table width =" 100% " >
997+ <tr ><th align =" left " ><h4 ><code >md5(str string)</code ></h4 ></th >
998+ </tr ><tr ><td >
999+ <p >Hashes a given string with MD-5.</p >
1000+
1001+
9341002</td ></tr ></table >
9351003<h3 ><a href =" https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/html/html.go " >html</a ></h3 >
9361004
@@ -1009,7 +1077,7 @@ The fs resolver is only available as an internal module and does not ship with t
10091077
10101078
10111079<table width =" 100% " >
1012- <tr ><th align =" left " ><h4 ><code >fetch(url string) string</code ></h4 ></th >
1080+ <tr ><th align =" left " ><h4 ><code >fetch(url string) ( string, throws error) </code ></h4 ></th >
10131081</tr ><tr ><td >
10141082<p >Fetches a resource from a given url.
10151083Outputs errors as string.</p >
0 commit comments