aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2022-10-09 16:44:31 -0500
committerGitHub <noreply@github.com>2022-10-09 16:44:31 -0500
commitaf45328bca34b5dad4dddbce41d6529a5123c3f9 (patch)
tree79e30642c2f88ef3e0bce7e81ee18778d6c99250 /doc
parentMinor edits to `docs/data.mdz` (diff)
parentMerge pull request #85 from tionis/master (diff)
Merge branch 'master' into data
Diffstat (limited to 'doc')
-rw-r--r--doc/misc.mdz18
-rw-r--r--doc/temple.mdz2
2 files changed, 18 insertions, 2 deletions
diff --git a/doc/misc.mdz b/doc/misc.mdz
index af8a004..a497e9c 100644
--- a/doc/misc.mdz
+++ b/doc/misc.mdz
@@ -126,7 +126,7 @@ pairs arguments and setting its prototype to prototype.
Factory function for creating new objects from prototypes.
@codeblock[janet]```
-(def Proto @{:greet |(string "Hello " ($ :name))})
+(def Proto @{:greet (fn [self] (string "Hello " (self :name)))})
(def t (misc/make Proto :name "pepe"))
(:greet t)
# => "Hello pepe"
@@ -384,3 +384,19 @@ Returns an array of hexs from the string with pgp words.
(misc/pgp/words->hexs "absurd-scavenger accrue_universe upshot.village")
# => @["01" "D1" "02" "EE" "F4" "F6"]
```
+
+## base64/encode
+Converts a string of any format (UTF-8, binary, ..) to base64 encoding.
+@codeblock[janet]```
+(misc/base64/encode "this is a test")
+# => "dGhpcyBpcyBhIHRlc3Q="
+```
+
+
+## base64/decode
+Converts a base64 encoded string to its binary representation of any format (UTF-8, binary, ..).
+@codeblock[janet]```
+(misc/base64/decode "dGhpcyBpcyBhIHRlc3Q=")
+# => "this is a test"
+```
+
diff --git a/doc/temple.mdz b/doc/temple.mdz
index a4662ba..19dd624 100644
--- a/doc/temple.mdz
+++ b/doc/temple.mdz
@@ -22,7 +22,7 @@ output.
### foo.temple
-@codeblock[janet]```
+@codeblock```
{$ (def n 20) # Run at template compile time $}
<html>
<body>