@codeshelldev/goplater-linux-arm64 1.6.7 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +389 -271
  2. package/bin/goplater +0 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -7,13 +7,15 @@
7
7
 
8
8
 
9
9
 
10
+
11
+
10
12
  # library commands
11
13
 
12
14
 
13
15
  -->
14
16
 
15
17
  <p align="center">
16
- <img width="256" height="256" alt="Goplater Logo" src="https://github.com/CodeShellDev/goplater/raw/refs/heads/main/logo/goplater.png">
18
+ <img width="256" height="256" alt="Goplater Logo" src="./images/goplater.png">
17
19
  </p>
18
20
 
19
21
  <h1 align="center">Goplater</h1>
@@ -50,6 +52,24 @@
50
52
 
51
53
  ## See it in action
52
54
 
55
+ <!-- prettier-ignore -->
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+ <p align="center">
70
+ <img width="768" height="384" alt="Goplater Logo" src="./images/terminal.svg">
71
+ </p>
72
+
53
73
  **`TEMPLATE.md`**
54
74
 
55
75
  <!-- prettier-ignore -->
@@ -91,24 +111,26 @@ Run `npm install my-app`
91
111
  - [Standard Library](#standard-library)
92
112
  - [fs](#fs)
93
113
  - [outputto](#outputto)
94
- - [container](#container)
95
- - [conversion](#conversion)
114
+ - [funcs](#funcs)
96
115
  - [globals](#globals)
97
116
  - [import](#import)
98
117
  - [return](#return)
118
+ - [html](#html)
119
+ - [markdown](#markdown)
120
+ - [yaml](#yaml)
121
+ - [container](#container)
122
+ - [conversion](#conversion)
99
123
  - [debug](#debug)
100
124
  - [base64](#base64)
101
125
  - [hex](#hex)
102
126
  - [hash](#hash)
103
- - [html](#html)
104
127
  - [http](#http)
105
128
  - [json](#json)
106
- - [markdown](#markdown)
107
129
  - [formulas](#formulas)
108
130
  - [operators](#operators)
109
131
  - [regex](#regex)
110
132
  - [strings](#strings)
111
- - [yaml](#yaml)
133
+ - [test](#test)
112
134
  - [Contributing](#contributing)
113
135
  - [Support](#support)
114
136
  - [License](#license)
@@ -122,7 +144,7 @@ Need help? Come join our [Matrix Server](https://matrix.to/#/#codeshelldev.oss.g
122
144
  - **Batteries included.** Read and write files, fetch URLs, work with JSON, YAML, HTML and Markdown, run regex and string operations. See the [Standard Library](#standard-library).
123
145
  - **Write your own functions, inside the template.** Define them with `define`, call them with `call`. Arguments and return values included.
124
146
  - **Share and import functions.** Put your functions in a file, import them from disk or from a URL and reuse them everywhere.
125
- - **Not just a CLI.** The engine behind it, `gplt-engine`, is a separate library you can embed in your own Go program.
147
+ - **Not just a CLI.** The engine behind it, `gplt`, is a separate library you can embed in your own Go program.
126
148
  - **Modular.** The library is split into independent modules. Load only what you need. Or let the CLI load them all.
127
149
  - **Automated.** Use the [GitHub Action and Bot](https://github.com/CodeShellDev/goplater-action) to render templates and automate pull requests. See [Automation](#automate-with-github-actions).
128
150
 
@@ -191,7 +213,7 @@ Define a function in the template and call it:
191
213
  <!-- prettier-ignore -->
192
214
  ```handlebars
193
215
  +{{ define "greet(name)" }}
194
- +{{ returnNext (printf "Hello, %s!" .name) }}
216
+ +{{ return (printf "Hello, %s!" .name) }}
195
217
  +{{ end }}
196
218
 
197
219
  +{{ call "greet" "Gopher" }}
@@ -320,7 +342,7 @@ Arguments are available as <code>.arg</code> in the file being read.</p>
320
342
 
321
343
  **Example**:
322
344
  ```handlebars
323
- +{{ readArgs "/path/to/file" (sliceCreate "my" "args") }}
345
+ +{{ readArgs "/path/to/file" (list "my" "args") }}
324
346
  ```
325
347
 
326
348
  </details>
@@ -589,13 +611,20 @@ Errors if path is not allowed.</p>
589
611
 
590
612
 
591
613
  </td></tr></table>
592
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/container/container.go">container</a></h3>
614
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/funcs.go">funcs</a></h3>
593
615
 
594
616
 
595
617
  <table width="100%">
596
- <tr><th align="left"><h4><code>delete(container map[any]any|[]any, key any) (any, throws error)</code></h4></th>
618
+ <tr><th align="left"><h4><code>call(name string, args []any) (any, throws error)</code></h4></th>
597
619
  </tr><tr><td>
598
- <p>Deletes a container entry with the given key.</p>
620
+ <p>Calls a func by name with args, optionally with a namespace handle.
621
+ Fails if func is not accessible or undefined.
622
+ Result:</p>
623
+ <ul>
624
+ <li><code>return</code> not called (or called with no values): captured template output</li>
625
+ <li><code>return</code> with one value: that value</li>
626
+ <li><code>return</code> with multiple values: a slice of all values</li>
627
+ </ul>
599
628
 
600
629
 
601
630
  <details>
@@ -604,72 +633,80 @@ Errors if path is not allowed.</p>
604
633
 
605
634
  **Example**:
606
635
  ```handlebars
607
- +{{ $newSlice := delete (sliceCreate "Apple" "Banana") 0 }}
608
- +{{ echo $newSlice }}
636
+ +{{ define "greet(name)" }}
637
+ +{{ echo (printf "Hello %s!" .name) }}
638
+ +{{ end }}
609
639
  ```
610
640
  **Output**:
611
641
  ```
612
- [Banana]
642
+ Hello John!
613
643
  ```
614
644
 
615
645
 
616
- </details>
617
-
618
- </td></tr></table>
619
-
620
-
621
- <table width="100%">
622
- <tr><th align="left"><h4><code>set(container map[any]any|[]any, key any, value any) (any, throws error)</code></h4></th>
623
- </tr><tr><td>
624
- <p>Set a container entry value with the given key.</p>
625
-
646
+ **Example**:
647
+ ```handlebars
648
+ +{{ define "greet(name)" }}
649
+ Hello +{{ .name }}!
650
+ +{{ end }}
651
+ ```
652
+ **Output**:
653
+ ```
654
+ Hello John!
655
+ ```
626
656
 
627
- <details>
628
- <summary>Examples</summary>
629
- <br/>
630
657
 
631
658
  **Example**:
632
659
  ```handlebars
633
- +{{ $newSlice := set (sliceCreate "Apple" "Banana") 0 "Strawberry" }}
634
- +{{ echo $newSlice }}
660
+ +{{ define "greet(name)" }}
661
+ +{{ return (printf "Hello %s!" .name) }}
662
+ +{{ end }}
635
663
  ```
636
664
  **Output**:
637
665
  ```
638
- [Strawberry Banana]
666
+ Hello John!
639
667
  ```
640
668
 
641
669
 
642
670
  </details>
643
671
 
644
672
  </td></tr></table>
673
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/globals.go">globals</a></h3>
645
674
 
646
675
 
647
676
  <table width="100%">
648
- <tr><th align="left"><h4><code>has(container map[any]any|[]any, key any) (bool, throws error)</code></h4></th>
677
+ <tr><th align="left"><h4><code>globalSet(key string, value any) throws error</code></h4></th>
649
678
  </tr><tr><td>
650
- <p>Returns if an entry with the given key exists in container.</p>
679
+ <p>Defines a global value with a key.</p>
651
680
 
652
681
 
653
- <details>
654
- <summary>Examples</summary>
655
- <br/>
682
+ </td></tr></table>
656
683
 
657
- **Example**:
658
- ```handlebars
659
- +{{ if (has (mapCreate "version" "v1") "version") }}
660
- Container has "version"!
661
- +{{ end }}
662
- ```
663
684
 
664
- </details>
685
+ <table width="100%">
686
+ <tr><th align="left"><h4><code>globalGet(key string) (any, throws error)</code></h4></th>
687
+ </tr><tr><td>
688
+ <p>Tries to retrieve a global value with a key.</p>
689
+
665
690
 
666
691
  </td></tr></table>
667
692
 
668
693
 
669
694
  <table width="100%">
670
- <tr><th align="left"><h4><code>slicePush(container []any, value any) []any</code></h4></th>
695
+ <tr><th align="left"><h4><code>globalHas(key string) bool</code></h4></th>
671
696
  </tr><tr><td>
672
- <p>Appends a value to a slice.</p>
697
+ <p>Returns whether a given global variable exists.</p>
698
+
699
+
700
+ </td></tr></table>
701
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/import.go">import</a></h3>
702
+
703
+
704
+ <table width="100%">
705
+ <tr><th align="left"><h4><code>import(alias string?, path string) throws error</code></h4></th>
706
+ </tr><tr><td>
707
+ <p>Tries to import a template file with func definitions.
708
+ Optionally supply an alias for easier access.
709
+ The fs resolver is only available as an internal module and does not ship with the <code>pkg/gplt/modules</code> directory.</p>
673
710
 
674
711
 
675
712
  <details>
@@ -678,13 +715,21 @@ Container has "version"!
678
715
 
679
716
  **Example**:
680
717
  ```handlebars
681
- +{{ $newSlice := sliceCreate "Apple" "Banana" }}
682
- +{{ $newSlice = slicePush $newSlice "Strawberry" }}
683
- +{{ echo $newSlice }}
718
+ +{{ import "https://domain.com/functions" }}
684
719
  ```
685
720
  **Output**:
686
721
  ```
687
- [Apple Banana Strawberry]
722
+ +{{ call "functions.greet" "John" }}
723
+ ```
724
+
725
+
726
+ **Example**:
727
+ ```handlebars
728
+ +{{ import "funcs" "https://domain.com/functions" }}
729
+ ```
730
+ **Output**:
731
+ ```
732
+ +{{ call "funcs.greet" "John" }}
688
733
  ```
689
734
 
690
735
 
@@ -694,9 +739,9 @@ Container has "version"!
694
739
 
695
740
 
696
741
  <table width="100%">
697
- <tr><th align="left"><h4><code>sliceCreate(values []any) []any</code></h4></th>
742
+ <tr><th align="left"><h4><code>importExact(alias string?, path string, hash string?) throws error</code></h4></th>
698
743
  </tr><tr><td>
699
- <p>Creates a new slice, optionally with values.</p>
744
+ <p>Same <code>import</code>, but only imports if content matches expected SHA-256 hash.</p>
700
745
 
701
746
 
702
747
  <details>
@@ -705,26 +750,24 @@ Container has "version"!
705
750
 
706
751
  **Example**:
707
752
  ```handlebars
708
- +{{ $newSlice := sliceCreate "Apple" "Banana" }}
709
- +{{ echo $newSlice }}
753
+ +{{ importExact "funcs" "https://domain.com/functions" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }}
710
754
  ```
711
755
  **Output**:
712
756
  ```
713
- [Apple Banana]
757
+ +{{ call "funcs.greet" "John" }}
714
758
  ```
715
759
 
716
760
 
717
761
  </details>
718
762
 
719
763
  </td></tr></table>
764
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/return.go">return</a></h3>
720
765
 
721
766
 
722
767
  <table width="100%">
723
- <tr><th align="left"><h4><code>mapCreate(entries []any) (map[string]any, errors)</code></h4></th>
768
+ <tr><th align="left"><h4><code>return(values []any?)</code></h4></th>
724
769
  </tr><tr><td>
725
- <p>Creates a new map, optionally with key value pairs.
726
- Pairs are constructed one by one, a key followed by the given value.
727
- Currently only supports string keys!</p>
770
+ <p>Sets output value(s).</p>
728
771
 
729
772
 
730
773
  <details>
@@ -733,610 +776,685 @@ Currently only supports string keys!</p>
733
776
 
734
777
  **Example**:
735
778
  ```handlebars
736
- +{{ $newMap := mapCreate "key1" "value1" "key2" "value2" }}
737
- +{{ echo $newMap }}
738
- ```
739
- **Output**:
779
+ +{{ return "a" "b" 1 2 }}
780
+ +{{ return (list "3" "4" "5") }}
740
781
  ```
741
- map[key1:value1 key2:value2]
742
- ```
743
-
744
782
 
745
783
  </details>
746
784
 
747
785
  </td></tr></table>
748
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/conversion/conversion.go">conversion</a></h3>
749
786
 
750
787
 
751
788
  <table width="100%">
752
- <tr><th align="left"><h4><code>toString(value any) string</code></h4></th>
789
+ <tr><th align="left"><h4><code>getOutputs() []any</code></h4></th>
753
790
  </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>
791
+ <p>Returns current outputs.</p>
755
792
 
756
793
 
757
794
  </td></tr></table>
795
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/ext/html/html.go">html</a></h3>
758
796
 
759
797
 
760
798
  <table width="100%">
761
- <tr><th align="left"><h4><code>toBytes(str string) []byte</code></h4></th>
799
+ <tr><th align="left"><h4><code>htmlDecode(html string) (*goquery.Document, throws error)</code></h4></th>
762
800
  </tr><tr><td>
763
- <p>Turns a string into bytes.</p>
801
+ <p>Decodes html into a document.</p>
764
802
 
765
803
 
766
804
  </td></tr></table>
767
805
 
768
806
 
769
807
  <table width="100%">
770
- <tr><th align="left"><h4><code>toInt(str string) (int, throws error)</code></h4></th>
808
+ <tr><th align="left"><h4><code>htmlDocFindAll(doc *goquery.Document, selector string) ([]*goquery.Selection, throws error)</code></h4></th>
771
809
  </tr><tr><td>
772
- <p>Attempts to parse a string as int.</p>
810
+ <p>Finds elements in document by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
773
811
 
774
812
 
775
813
  </td></tr></table>
776
814
 
777
815
 
778
816
  <table width="100%">
779
- <tr><th align="left"><h4><code>toFloat64(str string) (float64, throws error)</code></h4></th>
817
+ <tr><th align="left"><h4><code>htmlDocFind(doc *goquery.Document, selector string) (*goquery.Selection, throws error)</code></h4></th>
780
818
  </tr><tr><td>
781
- <p>Attempts to parse a string as float64.</p>
819
+ <p>Finds element in document by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
782
820
 
783
821
 
784
822
  </td></tr></table>
785
823
 
786
824
 
787
825
  <table width="100%">
788
- <tr><th align="left"><h4><code>toFloat32(str string) (float32, throws error)</code></h4></th>
826
+ <tr><th align="left"><h4><code>htmlFindAll(doc *goquery.Document, selector string) ([]*goquery.Selection, throws error)</code></h4></th>
789
827
  </tr><tr><td>
790
- <p>Attempts to parse a string as float32.</p>
828
+ <p>Finds elements in element by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
791
829
 
792
830
 
793
831
  </td></tr></table>
794
832
 
795
833
 
796
834
  <table width="100%">
797
- <tr><th align="left"><h4><code>toBool(str string) (bool, throws error)</code></h4></th>
835
+ <tr><th align="left"><h4><code>htmlFind(doc *goquery.Document, selector string) (*goquery.Selection, throws error)</code></h4></th>
798
836
  </tr><tr><td>
799
- <p>Attempts to parse a string as a bool (using <a href="https://pkg.go.dev/strconv#ParseBool">strconv.ParseBool</a>).</p>
837
+ <p>Finds element in element by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
800
838
 
801
839
 
802
840
  </td></tr></table>
803
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/globals.go">globals</a></h3>
804
841
 
805
842
 
806
843
  <table width="100%">
807
- <tr><th align="left"><h4><code>globalSet(key string, value any) throws error</code></h4></th>
844
+ <tr><th align="left"><h4><code>htmlText(el *goquery.Selection) string</code></h4></th>
808
845
  </tr><tr><td>
809
- <p>Defines a global value with a key.</p>
846
+ <p>Returns the elements text content.</p>
810
847
 
811
848
 
812
849
  </td></tr></table>
813
850
 
814
851
 
815
852
  <table width="100%">
816
- <tr><th align="left"><h4><code>globalGet(key string) (any, throws error)</code></h4></th>
853
+ <tr><th align="left"><h4><code>htmlAttr(el *goquery.Selection, attr string) string</code></h4></th>
817
854
  </tr><tr><td>
818
- <p>Tries to retrieve a global value with a key.</p>
855
+ <p>Returns an elements attribute content.</p>
819
856
 
820
857
 
821
858
  </td></tr></table>
822
859
 
823
860
 
824
861
  <table width="100%">
825
- <tr><th align="left"><h4><code>globalHas(key string) bool</code></h4></th>
862
+ <tr><th align="left"><h4><code>htmlInner(el *goquery.Selection) string</code></h4></th>
826
863
  </tr><tr><td>
827
- <p>Returns whether a given global variable exists.</p>
864
+ <p>Returns the elements inner html.</p>
828
865
 
829
866
 
830
867
  </td></tr></table>
831
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/import.go">import</a></h3>
868
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/ext/markdown/markdown.go">markdown</a></h3>
832
869
 
833
870
 
834
871
  <table width="100%">
835
- <tr><th align="left"><h4><code>import(alias string?, path string) throws error</code></h4></th>
872
+ <tr><th align="left"><h4><code>markdownDecode(md string) *Document</code></h4></th>
836
873
  </tr><tr><td>
837
- <p>Tries to import a template file with func definitions.
838
- Optionally supply an alias for easier access.
839
- The fs resolver is only available as an internal module and does not ship with the <code>pkg/gplt/modules</code> directory.</p>
840
-
841
-
842
- <details>
843
- <summary>Examples</summary>
844
- <br/>
874
+ <p>Decodes markdown into a document.</p>
845
875
 
846
- **Example**:
847
- ```handlebars
848
- +{{ import "https://domain.com/functions" }}
849
- ```
850
- **Output**:
851
- ```
852
- +{{ call "functions.greet" "John" }}
853
- ```
854
876
 
877
+ </td></tr></table>
855
878
 
856
- **Example**:
857
- ```handlebars
858
- +{{ import "funcs" "https://domain.com/functions" }}
859
- ```
860
- **Output**:
861
- ```
862
- +{{ call "funcs.greet" "John" }}
863
- ```
864
879
 
880
+ <table width="100%">
881
+ <tr><th align="left"><h4><code>markdownEncode(doc *Document) string</code></h4></th>
882
+ </tr><tr><td>
883
+ <p>Encodes a document into markdown.</p>
865
884
 
866
- </details>
867
885
 
868
886
  </td></tr></table>
869
887
 
870
888
 
871
889
  <table width="100%">
872
- <tr><th align="left"><h4><code>importExact(alias string?, path string, hash string?) throws error</code></h4></th>
890
+ <tr><th align="left"><h4><code>markdownFindAll(target Searchable, selector string) []*Node</code></h4></th>
873
891
  </tr><tr><td>
874
- <p>Same <code>import</code>, but only imports if content matches expected SHA-256 hash.</p>
892
+ <p>Finds elements in target by selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
875
893
 
876
894
 
877
- <details>
878
- <summary>Examples</summary>
879
- <br/>
895
+ </td></tr></table>
880
896
 
881
- **Example**:
882
- ```handlebars
883
- +{{ importExact "funcs" "https://domain.com/functions" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }}
884
- ```
885
- **Output**:
886
- ```
887
- +{{ call "funcs.greet" "John" }}
888
- ```
889
897
 
898
+ <table width="100%">
899
+ <tr><th align="left"><h4><code>markdownFind(target Searchable, selector string) *Node</code></h4></th>
900
+ </tr><tr><td>
901
+ <p>Finds element in target by selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
890
902
 
891
- </details>
892
903
 
893
904
  </td></tr></table>
894
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/core/return.go">return</a></h3>
895
905
 
896
906
 
897
907
  <table width="100%">
898
- <tr><th align="left"><h4><code>return(i int, value any) throws error</code></h4></th>
908
+ <tr><th align="left"><h4><code>markdownIs(node *Node, selector string) bool</code></h4></th>
899
909
  </tr><tr><td>
900
- <p>Sets an output value at the given index.</p>
910
+ <p>Returns whether node matches selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
901
911
 
902
912
 
903
913
  </td></tr></table>
904
914
 
905
915
 
906
916
  <table width="100%">
907
- <tr><th align="left"><h4><code>returnNext(value any) throws error</code></h4></th>
917
+ <tr><th align="left"><h4><code>markdownHTML(doc *Document) (string, throws error)</code></h4></th>
908
918
  </tr><tr><td>
909
- <p>Appends a value to the output.</p>
919
+ <p>Returns html markdown representation.</p>
910
920
 
911
921
 
912
922
  </td></tr></table>
913
923
 
914
924
 
915
925
  <table width="100%">
916
- <tr><th align="left"><h4><code>returnAll(value []any) throws error</code></h4></th>
926
+ <tr><th align="left"><h4><code>markdownText(node *Node) string</code></h4></th>
917
927
  </tr><tr><td>
918
- <p>Sets the output object as a whole.</p>
919
-
920
-
921
- <details>
922
- <summary>Examples</summary>
923
- <br/>
924
-
925
- **Example**:
926
- ```handlebars
927
- +{{ returnAll "1" "2" "3" }}
928
- +{{ returnAll (sliceCreate "1" "2" "3") }}
929
- ```
928
+ <p>Returns all raw markdown text in a node recursively.</p>
930
929
 
931
- </details>
932
930
 
933
931
  </td></tr></table>
934
932
 
935
933
 
936
934
  <table width="100%">
937
- <tr><th align="left"><h4><code>getOutputs() []any</code></h4></th>
935
+ <tr><th align="left"><h4><code>markdownHeadings(doc *Document) []*Heading</code></h4></th>
938
936
  </tr><tr><td>
939
- <p>Returns current outputs.</p>
937
+ <p>Returns all markdown headings.</p>
940
938
 
941
939
 
942
940
  </td></tr></table>
943
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/debug/debug.go">debug</a></h3>
944
941
 
945
942
 
946
943
  <table width="100%">
947
- <tr><th align="left"><h4><code>echo(data []any)</code></h4></th>
944
+ <tr><th align="left"><h4><code>markdownLinks(doc *Document) []*Link</code></h4></th>
948
945
  </tr><tr><td>
949
- <p>Outputs data to stdout.</p>
946
+ <p>Returns all markdown links.</p>
950
947
 
951
948
 
952
949
  </td></tr></table>
953
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/encoding/base64.go">base64</a></h3>
954
950
 
955
951
 
956
952
  <table width="100%">
957
- <tr><th align="left"><h4><code>base64Encode(str string) string</code></h4></th>
953
+ <tr><th align="left"><h4><code>markdownLinkURL(link *Link) string</code></h4></th>
958
954
  </tr><tr><td>
959
- <p>Encodes strings with base64.</p>
955
+ <p>Returns the url of a markdown link node.</p>
960
956
 
961
957
 
962
958
  </td></tr></table>
963
959
 
964
960
 
965
961
  <table width="100%">
966
- <tr><th align="left"><h4><code>base64Decode(str string) (string, throws error)</code></h4></th>
962
+ <tr><th align="left"><h4><code>markdownLinkSetURL(link *Link, url string)</code></h4></th>
967
963
  </tr><tr><td>
968
- <p>Decodes a base64 string.</p>
964
+ <p>Sets a link node's url.</p>
969
965
 
970
966
 
971
967
  </td></tr></table>
972
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/encoding/hex.go">hex</a></h3>
973
968
 
974
969
 
975
970
  <table width="100%">
976
- <tr><th align="left"><h4><code>hexEncode(str string) string</code></h4></th>
971
+ <tr><th align="left"><h4><code>markdownLinkSetTitle(link *Link, title string)</code></h4></th>
977
972
  </tr><tr><td>
978
- <p>Encodes a string as hex.</p>
973
+ <p>Sets a link node's title.</p>
979
974
 
980
975
 
981
976
  </td></tr></table>
982
977
 
983
978
 
984
979
  <table width="100%">
985
- <tr><th align="left"><h4><code>hexDecode(str string) (string, throws error)</code></h4></th>
980
+ <tr><th align="left"><h4><code>markdownLinkText(link *Link) string</code></h4></th>
986
981
  </tr><tr><td>
987
- <p>Decodes a string as hex.</p>
982
+ <p>Returns the text of a markdown link node.</p>
988
983
 
989
984
 
990
985
  </td></tr></table>
991
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/hash/hash.go">hash</a></h3>
992
986
 
993
987
 
994
988
  <table width="100%">
995
- <tr><th align="left"><h4><code>hash(str string)</code></h4></th>
989
+ <tr><th align="left"><h4><code>markdownImages(doc *Document) []*Image</code></h4></th>
996
990
  </tr><tr><td>
997
- <p>Hashes a given string with SHA-256.</p>
991
+ <p>Returns all markdown images.</p>
998
992
 
999
993
 
1000
994
  </td></tr></table>
1001
995
 
1002
996
 
1003
997
  <table width="100%">
1004
- <tr><th align="left"><h4><code>sha1(str string)</code></h4></th>
998
+ <tr><th align="left"><h4><code>markdownImageURL(image *Image) string</code></h4></th>
1005
999
  </tr><tr><td>
1006
- <p>Hashes a given string with SHA-1.</p>
1000
+ <p>Returns the url of a markdown image node.</p>
1007
1001
 
1008
1002
 
1009
1003
  </td></tr></table>
1010
1004
 
1011
1005
 
1012
1006
  <table width="100%">
1013
- <tr><th align="left"><h4><code>sha512(str string)</code></h4></th>
1007
+ <tr><th align="left"><h4><code>markdownImageSetURL(image *Image, url string)</code></h4></th>
1014
1008
  </tr><tr><td>
1015
- <p>Hashes a given string with SHA-512.</p>
1009
+ <p>Sets a image node's url.</p>
1016
1010
 
1017
1011
 
1018
1012
  </td></tr></table>
1019
1013
 
1020
1014
 
1021
1015
  <table width="100%">
1022
- <tr><th align="left"><h4><code>md5(str string)</code></h4></th>
1016
+ <tr><th align="left"><h4><code>markdownImageSetAlt(image *Image, alt string)</code></h4></th>
1023
1017
  </tr><tr><td>
1024
- <p>Hashes a given string with MD-5.</p>
1018
+ <p>Sets a image node's alt.</p>
1025
1019
 
1026
1020
 
1027
1021
  </td></tr></table>
1028
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/html/html.go">html</a></h3>
1029
1022
 
1030
1023
 
1031
1024
  <table width="100%">
1032
- <tr><th align="left"><h4><code>htmlDecode(html string) (*goquery.Document, throws error)</code></h4></th>
1025
+ <tr><th align="left"><h4><code>markdownParagraphs(doc *Document) []*Paragraph</code></h4></th>
1033
1026
  </tr><tr><td>
1034
- <p>Decodes html into a document.</p>
1027
+ <p>Returns all markdown paragraphs.</p>
1035
1028
 
1036
1029
 
1037
1030
  </td></tr></table>
1038
1031
 
1039
1032
 
1040
1033
  <table width="100%">
1041
- <tr><th align="left"><h4><code>htmlDocFindAll(doc *goquery.Document, selector string) ([]*goquery.Selection, throws error)</code></h4></th>
1034
+ <tr><th align="left"><h4><code>markdownCodeBlocks(doc *Document) []*CodeBlock</code></h4></th>
1042
1035
  </tr><tr><td>
1043
- <p>Finds elements in document by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
1036
+ <p>Returns all markdown code blocks.</p>
1044
1037
 
1045
1038
 
1046
1039
  </td></tr></table>
1047
1040
 
1048
1041
 
1049
1042
  <table width="100%">
1050
- <tr><th align="left"><h4><code>htmlDocFind(doc *goquery.Document, selector string) (*goquery.Selection, throws error)</code></h4></th>
1043
+ <tr><th align="left"><h4><code>markdownBlockquotes(doc *Document) []*Blockquote</code></h4></th>
1051
1044
  </tr><tr><td>
1052
- <p>Finds element in document by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
1045
+ <p>Returns all markdown block quotes.</p>
1053
1046
 
1054
1047
 
1055
1048
  </td></tr></table>
1056
1049
 
1057
1050
 
1058
1051
  <table width="100%">
1059
- <tr><th align="left"><h4><code>htmlFindAll(doc *goquery.Document, selector string) ([]*goquery.Selection, throws error)</code></h4></th>
1052
+ <tr><th align="left"><h4><code>markdownRemove(node *Node)</code></h4></th>
1060
1053
  </tr><tr><td>
1061
- <p>Finds elements in element by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
1054
+ <p>Removes a markdown node.</p>
1062
1055
 
1063
1056
 
1064
1057
  </td></tr></table>
1065
1058
 
1066
1059
 
1067
1060
  <table width="100%">
1068
- <tr><th align="left"><h4><code>htmlFind(doc *goquery.Document, selector string) (*goquery.Selection, throws error)</code></h4></th>
1061
+ <tr><th align="left"><h4><code>markdownAppend(doc *Document, str string)</code></h4></th>
1069
1062
  </tr><tr><td>
1070
- <p>Finds element in element by selector (using <a href="https://pkg.go.dev/github.com/PuerkitoBio/goquery#Selection.Find">goquery.Find</a>).</p>
1063
+ <p>Appends text to a markdown document.</p>
1071
1064
 
1072
1065
 
1073
1066
  </td></tr></table>
1074
1067
 
1075
1068
 
1076
1069
  <table width="100%">
1077
- <tr><th align="left"><h4><code>htmlText(el *goquery.Selection) string</code></h4></th>
1070
+ <tr><th align="left"><h4><code>markdownPrepend(doc *Document, str string)</code></h4></th>
1078
1071
  </tr><tr><td>
1079
- <p>Returns the elements text content.</p>
1072
+ <p>Prepends text to a markdown document.</p>
1080
1073
 
1081
1074
 
1082
1075
  </td></tr></table>
1076
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/ext/yaml/yaml.go">yaml</a></h3>
1083
1077
 
1084
1078
 
1085
1079
  <table width="100%">
1086
- <tr><th align="left"><h4><code>htmlAttr(el *goquery.Selection, attr string) string</code></h4></th>
1080
+ <tr><th align="left"><h4><code>yamlEncode(obj any) (string, throws error)</code></h4></th>
1087
1081
  </tr><tr><td>
1088
- <p>Returns an elements attribute content.</p>
1082
+ <p>Encodes an object into a yaml string.</p>
1089
1083
 
1090
1084
 
1091
1085
  </td></tr></table>
1092
1086
 
1093
1087
 
1094
1088
  <table width="100%">
1095
- <tr><th align="left"><h4><code>htmlInner(el *goquery.Selection) string</code></h4></th>
1089
+ <tr><th align="left"><h4><code>yamlDecode(yaml string) (any, throws error)</code></h4></th>
1096
1090
  </tr><tr><td>
1097
- <p>Returns the elements inner html.</p>
1091
+ <p>Decodes a yaml string into an object.</p>
1098
1092
 
1099
1093
 
1100
1094
  </td></tr></table>
1101
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/http/http.go">http</a></h3>
1095
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/container/container.go">container</a></h3>
1102
1096
 
1103
1097
 
1104
1098
  <table width="100%">
1105
- <tr><th align="left"><h4><code>fetch(url string) (string, throws error)</code></h4></th>
1099
+ <tr><th align="left"><h4><code>delete(container map|slice, key any) (any, throws error)</code></h4></th>
1106
1100
  </tr><tr><td>
1107
- <p>Fetches a resource from a given url.
1108
- Outputs errors as string.</p>
1101
+ <p>Deletes a container entry with the given key (mutates maps, but must return modified slice).</p>
1109
1102
 
1110
1103
 
1111
- </td></tr></table>
1112
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/json/json.go">json</a></h3>
1104
+ <details>
1105
+ <summary>Examples</summary>
1106
+ <br/>
1113
1107
 
1108
+ **Example**:
1109
+ ```handlebars
1110
+ +{{ $slice := list "Apple" "Banana" }}
1111
+ +{{ $newSlice := delete $slice 0 }}
1112
+ +{{ echo $newSlice }}
1113
+ ```
1114
+ **Output**:
1115
+ ```
1116
+ [Banana]
1117
+ ```
1114
1118
 
1115
- <table width="100%">
1116
- <tr><th align="left"><h4><code>jsonEncode(obj any) (string, throws error)</code></h4></th>
1117
- </tr><tr><td>
1118
- <p>Encodes an object into a json string.</p>
1119
1119
 
1120
+ **Example**:
1121
+ ```handlebars
1122
+ +{{ $map := dict "key1" "value1" "key2" "value2" }}
1123
+ +{{ delete $map "key1" }}
1124
+ +{{ echo $map }}
1125
+ ```
1126
+ **Output**:
1127
+ ```
1128
+ map[key2:value2]
1129
+ ```
1130
+
1131
+
1132
+ </details>
1120
1133
 
1121
1134
  </td></tr></table>
1122
1135
 
1123
1136
 
1124
1137
  <table width="100%">
1125
- <tr><th align="left"><h4><code>jsonDecode(json string) (any, throws error)</code></h4></th>
1138
+ <tr><th align="left"><h4><code>set(container map|slice, key any, value any) throws error</code></h4></th>
1126
1139
  </tr><tr><td>
1127
- <p>Decodes a json string into an object.</p>
1140
+ <p>Set a container entry value with the given key.</p>
1141
+
1128
1142
 
1143
+ <details>
1144
+ <summary>Examples</summary>
1145
+ <br/>
1146
+
1147
+ **Example**:
1148
+ ```handlebars
1149
+ +{{ $slice := list "Apple" "Banana" }}
1150
+ +{{ set $slice 0 "Strawberry" }}
1151
+ +{{ echo $slice }}
1152
+ ```
1153
+ **Output**:
1154
+ ```
1155
+ [Strawberry Banana]
1156
+ ```
1157
+
1158
+
1159
+ </details>
1129
1160
 
1130
1161
  </td></tr></table>
1131
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/markdown/markdown.go">markdown</a></h3>
1132
1162
 
1133
1163
 
1134
1164
  <table width="100%">
1135
- <tr><th align="left"><h4><code>markdownDecode(md string) *Document</code></h4></th>
1165
+ <tr><th align="left"><h4><code>hasKey(container map|slice, key any) (bool, throws error)</code></h4></th>
1136
1166
  </tr><tr><td>
1137
- <p>Decodes markdown into a document.</p>
1167
+ <p>Returns if an entry with the given key exists in container.</p>
1168
+
1169
+
1170
+ <details>
1171
+ <summary>Examples</summary>
1172
+ <br/>
1173
+
1174
+ **Example**:
1175
+ ```handlebars
1176
+ +{{ if (hasKey (list "version" "v1") "version") }}
1177
+ Container has "version"!
1178
+ +{{ end }}
1179
+ ```
1138
1180
 
1181
+ </details>
1139
1182
 
1140
1183
  </td></tr></table>
1141
1184
 
1142
1185
 
1143
1186
  <table width="100%">
1144
- <tr><th align="left"><h4><code>markdownEncode(doc *Document) string</code></h4></th>
1187
+ <tr><th align="left"><h4><code>includes(container map|slice, value any) (bool, throws error)</code></h4></th>
1145
1188
  </tr><tr><td>
1146
- <p>Encodes a document into markdown.</p>
1189
+ <p>Returns if an entry with the given value exists in container.</p>
1147
1190
 
1148
1191
 
1192
+ <details>
1193
+ <summary>Examples</summary>
1194
+ <br/>
1195
+
1196
+ **Example**:
1197
+ ```handlebars
1198
+ +{{ if (includes (list "version" "v1") "v1") }}
1199
+ Container includes "v1"!
1200
+ +{{ end }}
1201
+ ```
1202
+
1203
+ </details>
1204
+
1149
1205
  </td></tr></table>
1150
1206
 
1151
1207
 
1152
1208
  <table width="100%">
1153
- <tr><th align="left"><h4><code>markdownFindAll(target Searchable, selector string) []*Node</code></h4></th>
1209
+ <tr><th align="left"><h4><code>append(container []any, value any) []any</code></h4></th>
1154
1210
  </tr><tr><td>
1155
- <p>Finds elements in target by selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
1211
+ <p>Appends a value to a slice (returns a new copy).</p>
1212
+
1213
+
1214
+ <details>
1215
+ <summary>Examples</summary>
1216
+ <br/>
1217
+
1218
+ **Example**:
1219
+ ```handlebars
1220
+ +{{ $slice := list "Apple" "Banana" }}
1221
+ +{{ $newSlice = append $slice "Strawberry" }}
1222
+ +{{ echo $newSlice }}
1223
+ ```
1224
+ **Output**:
1225
+ ```
1226
+ [Apple Banana Strawberry]
1227
+ ```
1156
1228
 
1157
1229
 
1230
+ </details>
1231
+
1158
1232
  </td></tr></table>
1159
1233
 
1160
1234
 
1161
1235
  <table width="100%">
1162
- <tr><th align="left"><h4><code>markdownFind(target Searchable, selector string) *Node</code></h4></th>
1236
+ <tr><th align="left"><h4><code>list(values []any) []any</code></h4></th>
1163
1237
  </tr><tr><td>
1164
- <p>Finds element in target by selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
1238
+ <p>Creates a new slice, optionally with values.</p>
1239
+
1240
+
1241
+ <details>
1242
+ <summary>Examples</summary>
1243
+ <br/>
1244
+
1245
+ **Example**:
1246
+ ```handlebars
1247
+ +{{ $slice := list "Apple" "Banana" }}
1248
+ +{{ echo $slice }}
1249
+ ```
1250
+ **Output**:
1251
+ ```
1252
+ [Apple Banana]
1253
+ ```
1165
1254
 
1166
1255
 
1256
+ </details>
1257
+
1167
1258
  </td></tr></table>
1168
1259
 
1169
1260
 
1170
1261
  <table width="100%">
1171
- <tr><th align="left"><h4><code>markdownIs(node *Node, selector string) bool</code></h4></th>
1262
+ <tr><th align="left"><h4><code>dict(entries []any) (map[string]any, errors)</code></h4></th>
1172
1263
  </tr><tr><td>
1173
- <p>Returns whether node matches selector (using <a href="https://pkg.go.dev/github.com/codeshelldev/goplater/pkg/gplt/modules/markdown#TypeMatches">custom</a>).</p>
1264
+ <p>Creates a new map, optionally with key value pairs.
1265
+ Pairs are constructed one by one, a key followed by the given value.
1266
+ Currently only supports string keys!</p>
1267
+
1268
+
1269
+ <details>
1270
+ <summary>Examples</summary>
1271
+ <br/>
1272
+
1273
+ **Example**:
1274
+ ```handlebars
1275
+ +{{ $map := dict "key1" "value1" "key2" "value2" }}
1276
+ +{{ echo $map }}
1277
+ ```
1278
+ **Output**:
1279
+ ```
1280
+ map[key1:value1 key2:value2]
1281
+ ```
1174
1282
 
1175
1283
 
1284
+ </details>
1285
+
1176
1286
  </td></tr></table>
1287
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/conversion/conversion.go">conversion</a></h3>
1177
1288
 
1178
1289
 
1179
1290
  <table width="100%">
1180
- <tr><th align="left"><h4><code>markdownHTML(doc *Document) (string, throws error)</code></h4></th>
1291
+ <tr><th align="left"><h4><code>toString(value any) string</code></h4></th>
1181
1292
  </tr><tr><td>
1182
- <p>Returns html markdown representation.</p>
1293
+ <p>Returns a given value as string (using <a href="https://pkg.go.dev/fmt#Sprint">fmt.Sprint</a>, bytes are handled separately).</p>
1183
1294
 
1184
1295
 
1185
1296
  </td></tr></table>
1186
1297
 
1187
1298
 
1188
1299
  <table width="100%">
1189
- <tr><th align="left"><h4><code>markdownText(node *Node) string</code></h4></th>
1300
+ <tr><th align="left"><h4><code>toBytes(str string) []byte</code></h4></th>
1190
1301
  </tr><tr><td>
1191
- <p>Returns all raw markdown text in a node recursively.</p>
1302
+ <p>Turns a string into bytes.</p>
1192
1303
 
1193
1304
 
1194
1305
  </td></tr></table>
1195
1306
 
1196
1307
 
1197
1308
  <table width="100%">
1198
- <tr><th align="left"><h4><code>markdownHeadings(doc *Document) []*Heading</code></h4></th>
1309
+ <tr><th align="left"><h4><code>toInt(str string) (int, throws error)</code></h4></th>
1199
1310
  </tr><tr><td>
1200
- <p>Returns all markdown headings.</p>
1311
+ <p>Attempts to parse a string as int.</p>
1201
1312
 
1202
1313
 
1203
1314
  </td></tr></table>
1204
1315
 
1205
1316
 
1206
1317
  <table width="100%">
1207
- <tr><th align="left"><h4><code>markdownLinks(doc *Document) []*Link</code></h4></th>
1318
+ <tr><th align="left"><h4><code>toFloat64(str string) (float64, throws error)</code></h4></th>
1208
1319
  </tr><tr><td>
1209
- <p>Returns all markdown links.</p>
1320
+ <p>Attempts to parse a string as float64.</p>
1210
1321
 
1211
1322
 
1212
1323
  </td></tr></table>
1213
1324
 
1214
1325
 
1215
1326
  <table width="100%">
1216
- <tr><th align="left"><h4><code>markdownLinkURL(link *Link) string</code></h4></th>
1327
+ <tr><th align="left"><h4><code>toFloat32(str string) (float32, throws error)</code></h4></th>
1217
1328
  </tr><tr><td>
1218
- <p>Returns the url of a markdown link node.</p>
1329
+ <p>Attempts to parse a string as float32.</p>
1219
1330
 
1220
1331
 
1221
1332
  </td></tr></table>
1222
1333
 
1223
1334
 
1224
1335
  <table width="100%">
1225
- <tr><th align="left"><h4><code>markdownLinkSetURL(link *Link, url string)</code></h4></th>
1336
+ <tr><th align="left"><h4><code>toBool(str string) (bool, throws error)</code></h4></th>
1226
1337
  </tr><tr><td>
1227
- <p>Sets a link node's url.</p>
1338
+ <p>Attempts to parse a string as a bool (using <a href="https://pkg.go.dev/strconv#ParseBool">strconv.ParseBool</a>).</p>
1228
1339
 
1229
1340
 
1230
1341
  </td></tr></table>
1342
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/debug/debug.go">debug</a></h3>
1231
1343
 
1232
1344
 
1233
1345
  <table width="100%">
1234
- <tr><th align="left"><h4><code>markdownLinkSetTitle(link *Link, title string)</code></h4></th>
1346
+ <tr><th align="left"><h4><code>echo(data []any)</code></h4></th>
1235
1347
  </tr><tr><td>
1236
- <p>Sets a link node's title.</p>
1348
+ <p>Outputs data to stdout.</p>
1237
1349
 
1238
1350
 
1239
1351
  </td></tr></table>
1352
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/encoding/base64.go">base64</a></h3>
1240
1353
 
1241
1354
 
1242
1355
  <table width="100%">
1243
- <tr><th align="left"><h4><code>markdownLinkText(link *Link) string</code></h4></th>
1356
+ <tr><th align="left"><h4><code>base64Encode(str string) string</code></h4></th>
1244
1357
  </tr><tr><td>
1245
- <p>Returns the text of a markdown link node.</p>
1358
+ <p>Encodes strings with base64.</p>
1246
1359
 
1247
1360
 
1248
1361
  </td></tr></table>
1249
1362
 
1250
1363
 
1251
1364
  <table width="100%">
1252
- <tr><th align="left"><h4><code>markdownImages(doc *Document) []*Image</code></h4></th>
1365
+ <tr><th align="left"><h4><code>base64Decode(str string) (string, throws error)</code></h4></th>
1253
1366
  </tr><tr><td>
1254
- <p>Returns all markdown images.</p>
1367
+ <p>Decodes a base64 string.</p>
1255
1368
 
1256
1369
 
1257
1370
  </td></tr></table>
1371
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/encoding/hex.go">hex</a></h3>
1258
1372
 
1259
1373
 
1260
1374
  <table width="100%">
1261
- <tr><th align="left"><h4><code>markdownImageURL(image *Image) string</code></h4></th>
1375
+ <tr><th align="left"><h4><code>hexEncode(str string) string</code></h4></th>
1262
1376
  </tr><tr><td>
1263
- <p>Returns the url of a markdown image node.</p>
1377
+ <p>Encodes a string as hex.</p>
1264
1378
 
1265
1379
 
1266
1380
  </td></tr></table>
1267
1381
 
1268
1382
 
1269
1383
  <table width="100%">
1270
- <tr><th align="left"><h4><code>markdownImageSetURL(image *Image, url string)</code></h4></th>
1384
+ <tr><th align="left"><h4><code>hexDecode(str string) (string, throws error)</code></h4></th>
1271
1385
  </tr><tr><td>
1272
- <p>Sets a image node's url.</p>
1386
+ <p>Decodes a string as hex.</p>
1273
1387
 
1274
1388
 
1275
1389
  </td></tr></table>
1390
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/hash/hash.go">hash</a></h3>
1276
1391
 
1277
1392
 
1278
1393
  <table width="100%">
1279
- <tr><th align="left"><h4><code>markdownImageSetAlt(image *Image, alt string)</code></h4></th>
1394
+ <tr><th align="left"><h4><code>hash(str string)</code></h4></th>
1280
1395
  </tr><tr><td>
1281
- <p>Sets a image node's alt.</p>
1396
+ <p>Hashes a given string with SHA-256.</p>
1282
1397
 
1283
1398
 
1284
1399
  </td></tr></table>
1285
1400
 
1286
1401
 
1287
1402
  <table width="100%">
1288
- <tr><th align="left"><h4><code>markdownParagraphs(doc *Document) []*Paragraph</code></h4></th>
1403
+ <tr><th align="left"><h4><code>sha1(str string)</code></h4></th>
1289
1404
  </tr><tr><td>
1290
- <p>Returns all markdown paragraphs.</p>
1405
+ <p>Hashes a given string with SHA-1.</p>
1291
1406
 
1292
1407
 
1293
1408
  </td></tr></table>
1294
1409
 
1295
1410
 
1296
1411
  <table width="100%">
1297
- <tr><th align="left"><h4><code>markdownCodeBlocks(doc *Document) []*CodeBlock</code></h4></th>
1412
+ <tr><th align="left"><h4><code>sha512(str string)</code></h4></th>
1298
1413
  </tr><tr><td>
1299
- <p>Returns all markdown code blocks.</p>
1414
+ <p>Hashes a given string with SHA-512.</p>
1300
1415
 
1301
1416
 
1302
1417
  </td></tr></table>
1303
1418
 
1304
1419
 
1305
1420
  <table width="100%">
1306
- <tr><th align="left"><h4><code>markdownBlockquotes(doc *Document) []*Blockquote</code></h4></th>
1421
+ <tr><th align="left"><h4><code>md5(str string)</code></h4></th>
1307
1422
  </tr><tr><td>
1308
- <p>Returns all markdown block quotes.</p>
1423
+ <p>Hashes a given string with MD-5.</p>
1309
1424
 
1310
1425
 
1311
1426
  </td></tr></table>
1427
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/http/http.go">http</a></h3>
1312
1428
 
1313
1429
 
1314
1430
  <table width="100%">
1315
- <tr><th align="left"><h4><code>markdownRemove(node *Node)</code></h4></th>
1431
+ <tr><th align="left"><h4><code>fetch(url string) (string, throws error)</code></h4></th>
1316
1432
  </tr><tr><td>
1317
- <p>Removes a markdown node.</p>
1433
+ <p>Fetches a resource from a given url.
1434
+ Outputs errors as string.</p>
1318
1435
 
1319
1436
 
1320
1437
  </td></tr></table>
1438
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/json/json.go">json</a></h3>
1321
1439
 
1322
1440
 
1323
1441
  <table width="100%">
1324
- <tr><th align="left"><h4><code>markdownAppend(doc *Document, str string)</code></h4></th>
1442
+ <tr><th align="left"><h4><code>jsonEncode(obj any) (string, throws error)</code></h4></th>
1325
1443
  </tr><tr><td>
1326
- <p>Appends text to a markdown document.</p>
1444
+ <p>Encodes an object into a json string.</p>
1327
1445
 
1328
1446
 
1329
1447
  </td></tr></table>
1330
1448
 
1331
1449
 
1332
1450
  <table width="100%">
1333
- <tr><th align="left"><h4><code>markdownPrepend(doc *Document, str string)</code></h4></th>
1451
+ <tr><th align="left"><h4><code>jsonDecode(json string) (any, throws error)</code></h4></th>
1334
1452
  </tr><tr><td>
1335
- <p>Prepends text to a markdown document.</p>
1453
+ <p>Decodes a json string into an object.</p>
1336
1454
 
1337
1455
 
1338
1456
  </td></tr></table>
1339
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/math/formulas.go">formulas</a></h3>
1457
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/math/formulas.go">formulas</a></h3>
1340
1458
 
1341
1459
 
1342
1460
  <table width="100%">
@@ -1394,9 +1512,9 @@ Outputs errors as string.</p>
1394
1512
 
1395
1513
 
1396
1514
  <table width="100%">
1397
- <tr><th align="left"><h4><code>round(number int|float64) (int, throws error)</code></h4></th>
1515
+ <tr><th align="left"><h4><code>round(number int|float64, digits int?) (int, throws error)</code></h4></th>
1398
1516
  </tr><tr><td>
1399
- <p>Rounds a number to the nearest integer.</p>
1517
+ <p>Rounds a number to the specified number of decimal digits (default: 0).</p>
1400
1518
 
1401
1519
 
1402
1520
  </td></tr></table>
@@ -1418,7 +1536,7 @@ Outputs errors as string.</p>
1418
1536
 
1419
1537
 
1420
1538
  </td></tr></table>
1421
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/math/operators.go">operators</a></h3>
1539
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/math/operators.go">operators</a></h3>
1422
1540
 
1423
1541
 
1424
1542
  <table width="100%">
@@ -1440,7 +1558,7 @@ Outputs errors as string.</p>
1440
1558
 
1441
1559
 
1442
1560
  <table width="100%">
1443
- <tr><th align="left"><h4><code>mult(numbers [](int|float64)) (int|float64, throws error)</code></h4></th>
1561
+ <tr><th align="left"><h4><code>mul(numbers [](int|float64)) (int|float64, throws error)</code></h4></th>
1444
1562
  </tr><tr><td>
1445
1563
  <p>Multiplies numbers together.</p>
1446
1564
 
@@ -1449,7 +1567,7 @@ Outputs errors as string.</p>
1449
1567
 
1450
1568
 
1451
1569
  <table width="100%">
1452
- <tr><th align="left"><h4><code>divd(numbers [](int|float64)) (int|float64, throws error)</code></h4></th>
1570
+ <tr><th align="left"><h4><code>div(numbers [](int|float64)) (int|float64, throws error)</code></h4></th>
1453
1571
  </tr><tr><td>
1454
1572
  <p>Divides numbers from each other.</p>
1455
1573
 
@@ -1464,7 +1582,7 @@ Outputs errors as string.</p>
1464
1582
 
1465
1583
 
1466
1584
  </td></tr></table>
1467
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/regex/regex.go">regex</a></h3>
1585
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/regex/regex.go">regex</a></h3>
1468
1586
 
1469
1587
 
1470
1588
  <table width="100%">
@@ -1477,9 +1595,9 @@ Outputs errors as string.</p>
1477
1595
 
1478
1596
 
1479
1597
  <table width="100%">
1480
- <tr><th align="left"><h4><code>regexFind(regex string) ([]string, throws error)</code></h4></th>
1598
+ <tr><th align="left"><h4><code>regexFindAll(regex string) ([]string, throws error)</code></h4></th>
1481
1599
  </tr><tr><td>
1482
- <p>Returns all matches against the given regex pattern in a string.</p>
1600
+ <p>Returns all (optionally up to n) matches against the given regex pattern in a string.</p>
1483
1601
 
1484
1602
 
1485
1603
  </td></tr></table>
@@ -1504,13 +1622,13 @@ Outputs errors as string.</p>
1504
1622
 
1505
1623
 
1506
1624
  <table width="100%">
1507
- <tr><th align="left"><h4><code>regexReplace(regex string) (string, throws error)</code></h4></th>
1625
+ <tr><th align="left"><h4><code>regexReplaceAll(regex string) (string, throws error)</code></h4></th>
1508
1626
  </tr><tr><td>
1509
- <p>Replaces all matches from the given regex pattern in a string with the replaceWith param (which allows using '$1', etc.).</p>
1627
+ <p>Replaces all matches from the given regex pattern in a string with new (which for allows using '$1', etc.).</p>
1510
1628
 
1511
1629
 
1512
1630
  </td></tr></table>
1513
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/strings/strings.go">strings</a></h3>
1631
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/std/strings/strings.go">strings</a></h3>
1514
1632
 
1515
1633
 
1516
1634
  <table width="100%">
@@ -1568,7 +1686,7 @@ Outputs errors as string.</p>
1568
1686
 
1569
1687
 
1570
1688
  <table width="100%">
1571
- <tr><th align="left"><h4><code>startsWith(str string, prefix string) bool</code></h4></th>
1689
+ <tr><th align="left"><h4><code>hasPrefix(str string, prefix string) bool</code></h4></th>
1572
1690
  </tr><tr><td>
1573
1691
  <p>Returns whether a string starts with the given prefix.</p>
1574
1692
 
@@ -1577,7 +1695,7 @@ Outputs errors as string.</p>
1577
1695
 
1578
1696
 
1579
1697
  <table width="100%">
1580
- <tr><th align="left"><h4><code>endsWith(str string, suffix string) bool</code></h4></th>
1698
+ <tr><th align="left"><h4><code>hasSuffix(str string, suffix string) bool</code></h4></th>
1581
1699
  </tr><tr><td>
1582
1700
  <p>Returns whether a string ends with the given suffix.</p>
1583
1701
 
@@ -1595,9 +1713,9 @@ Outputs errors as string.</p>
1595
1713
 
1596
1714
 
1597
1715
  <table width="100%">
1598
- <tr><th align="left"><h4><code>replace(str string, sub string, replaceWith string) string</code></h4></th>
1716
+ <tr><th align="left"><h4><code>replace(str string, old string, new string) string</code></h4></th>
1599
1717
  </tr><tr><td>
1600
- <p>Replaces all occurences of a substring in the given string with the replaceWith param.</p>
1718
+ <p>Replaces all occurences of old with new.</p>
1601
1719
 
1602
1720
 
1603
1721
  </td></tr></table>
@@ -1658,7 +1776,7 @@ Outputs errors as string.</p>
1658
1776
 
1659
1777
 
1660
1778
  <table width="100%">
1661
- <tr><th align="left"><h4><code>cutPrefix(str string, sub string) string</code></h4></th>
1779
+ <tr><th align="left"><h4><code>trimPrefix(str string, sub string) string</code></h4></th>
1662
1780
  </tr><tr><td>
1663
1781
  <p>Removes a substring at the start of the given string.</p>
1664
1782
 
@@ -1667,7 +1785,7 @@ Outputs errors as string.</p>
1667
1785
 
1668
1786
 
1669
1787
  <table width="100%">
1670
- <tr><th align="left"><h4><code>cutSuffix(str string, sub string) string</code></h4></th>
1788
+ <tr><th align="left"><h4><code>trimSuffix(str string, sub string) string</code></h4></th>
1671
1789
  </tr><tr><td>
1672
1790
  <p>Removes a substring at the end of the given string.</p>
1673
1791
 
@@ -1676,7 +1794,7 @@ Outputs errors as string.</p>
1676
1794
 
1677
1795
 
1678
1796
  <table width="100%">
1679
- <tr><th align="left"><h4><code>slice(str string, start int, end int) string</code></h4></th>
1797
+ <tr><th align="left"><h4><code>substr(str string, start int, end int) string</code></h4></th>
1680
1798
  </tr><tr><td>
1681
1799
  <p>Slices a string based on start and end index.</p>
1682
1800
 
@@ -1700,22 +1818,22 @@ Outputs errors as string.</p>
1700
1818
 
1701
1819
 
1702
1820
  </td></tr></table>
1703
- <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/yaml/yaml.go">yaml</a></h3>
1704
1821
 
1705
1822
 
1706
1823
  <table width="100%">
1707
- <tr><th align="left"><h4><code>yamlEncode(obj any) (string, throws error)</code></h4></th>
1824
+ <tr><th align="left"><h4><code>concat(strs string) string</code></h4></th>
1708
1825
  </tr><tr><td>
1709
- <p>Encodes an object into a yaml string.</p>
1826
+ <p>Concat strings together (join without sep).</p>
1710
1827
 
1711
1828
 
1712
1829
  </td></tr></table>
1830
+ <h3><a href="https://github.com/codeshelldev/goplater/blob/main/pkg/gplt/modules/test/test.go">test</a></h3>
1713
1831
 
1714
1832
 
1715
1833
  <table width="100%">
1716
- <tr><th align="left"><h4><code>yamlDecode(yaml string) (any, throws error)</code></h4></th>
1834
+ <tr><th align="left"><h4><code>emit(label string?, value any) throws error</code></h4></th>
1717
1835
  </tr><tr><td>
1718
- <p>Decodes a yaml string into an object.</p>
1836
+ <p>Records a value, optionally with a label.</p>
1719
1837
 
1720
1838
 
1721
1839
  </td></tr></table>
@@ -1737,7 +1855,7 @@ This Project is licensed under the [MIT License](./LICENSE).
1737
1855
 
1738
1856
  ## Legal
1739
1857
 
1740
- Logo designed by [@CodeShellDev](https://github.com/CodeShellDev) — All Rights Reserved.
1858
+ Logo designed by [@CodeShellDev](https://github.com/CodeShellDev). All rights reserved for original design contributions.
1741
1859
 
1742
1860
  Go gopher mascot originally created by [Renée French](https://instagram.com/reneefrench/),
1743
- used under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license.
1861
+ used and adapted under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) license.