Commit Graph

55 Commits

Author SHA1 Message Date
Mahdi Bahrami
58b9c3b00c Implement Recursive Transforms (#37)
* Implement Recursive Transforms

* Correct test names

* apply suggestions

* format

* add comments

* move the parse function

* refine `parseTransforms()` function

* refinements

* format

* Swift Format again

---------

Co-authored-by: Adam Fowler <adamfowler71@gmail.com>
2024-07-14 12:49:16 +01:00
Adam Fowler
2663d13ea7 Rename package to swift-mustache (#27)
* Rename package to swift-mustache

* Update CI
2024-03-15 07:28:57 +00:00
Adam Fowler
bdfa05391a Remove HB prefix, make Parser private (#26) 2024-03-11 22:07:05 +00:00
Adam Fowler
f029081b61 Project template updates (#25)
* Project template updates

* More changes

* run swiftformat
2024-03-08 12:04:49 +00:00
Adam Fowler
071b182a00 2.x.x Template struct (#22)
* Start of turning template into a struct

* Everything is Sendable now, just doesnt work

* Add library to context

* Make sure render is initialized with library

* comment about inheritance spec

* Add register back in

* Re-instate register functions

* Re-instate commented out print

* Fix tabbing in Partial tests

* Make HBMustacheLibrary.loadTemplates async

* Update platforms, swift version
2024-01-31 15:43:46 +00:00
Adam Fowler
fa56176223 Fix issue with indented partials (#19)
* Fix issue with indented partials

* Add test

* Add empty transform for string
2023-01-14 08:50:51 +00:00
Adam Fowler
f95e19206e Use special set of chars for partial filename (#18) 2022-08-08 11:18:41 +01:00
Adam Fowler
02d019b632 Swift 5.6 2022-03-17 11:23:21 +00:00
Adam Fowler
c65a7956c8 Custom renderable fixups (#13)
* Mark HBMustacheCustomRenderable public

* Add HBMustacheCustomRenderable tests

* swift format
2021-05-03 16:55:10 +01:00
Adam Fowler
a2569dd667 Use newly merged inheritance spec tests 2021-05-03 15:58:50 +01:00
Adam Fowler
4a78d44712 Add HBMustacheCustomRenderable
Support custom rendering of swift types
Fixes tests that rely on NSNull
2021-05-03 15:33:28 +01:00
Adam Fowler
1c51fcfe8c Add file header via swift format 2021-04-08 17:36:54 +01:00
Adam Fowler
883e1e3446 No need to ignore Variable test in spec tests 2021-04-06 16:22:19 +01:00
Adam Fowler
7ebd84a328 Stop context stack climbing with "." prefix 2021-03-24 11:12:38 +00:00
Adam Fowler
f7bd02267e Add transforms empty() and equalzero() 2021-03-23 18:17:44 +00:00
Adam Fowler
40ef59c897 Allow for space after value in {{%var:value}} 2021-03-23 17:45:17 +00:00
Adam Fowler
d3edef1b8e Add support for custom text escaping (#11)
* Add support for custom text escaping

* swift format

* Remove withDefaultDelimiters

* Update README.md

* Don't pass content type into partial
2021-03-23 17:36:28 +00:00
Adam Fowler
c21651ce50 method -> transform 2021-03-22 12:11:22 +00:00
Adam Fowler
35d52603e2 Template inheritance (#9)
* Move all context variables into HBMustacheContext

* Add support for reading inherited sections

* Render inherited tokens

* Test inheritance spec, fix two minor issues

* fix warning

* swift format
2021-03-22 12:02:22 +00:00
Adam Fowler
af345e9138 Link FoundationNetworking on Linux 2021-03-22 11:46:04 +00:00
Adam Fowler
c4f8aea756 Use mustache spec json files for tests (#10)
* swift format

* Use json files for mustache/spec repo for testing spec

* Add option to ignore certain tests

* Clean up error messages, swift format

* more swift format
2021-03-22 11:41:52 +00:00
Adam Fowler
a08b1e8087 Swift format, swift 5.3 2021-03-21 11:56:08 +00:00
Adam Fowler
05740bd7bc Replace raw UTF8 parser with String parser (#6)
* Replace UTF8 parser with String based one

* swift format

* Add parsing errors that include context about where error is

* Remove old error tests
2021-03-18 17:26:42 +00:00
Adam Fowler
0ff5038162 End sections includes method 2021-03-18 15:33:47 +00:00
Adam Fowler
aa30dcbddf Don't log files that dont load throw error instead
remove swift-log dependency
2021-03-18 15:25:46 +00:00
Adam Fowler
751126d729 Add support for Set Delimiters (#5)
* Added ParserState

* Add support for setting delimiters

* Add spec tests for setting delimiters

* swift format
2021-03-18 12:43:36 +00:00
Adam Fowler
9b17bd6827 Render optimisation 2021-03-18 10:55:55 +00:00
Adam Fowler
c560bd0fd9 swift format 2021-03-18 10:34:52 +00:00
Adam Fowler
16a2c54be6 Added sections tests. Allow for searching of context stack 2021-03-18 10:32:42 +00:00
Adam Fowler
b07ad42b49 Started section spec tests 2021-03-17 22:33:30 +00:00
Adam Fowler
169a7bbbf4 Added SpecPartialsTests and fixed issues 2021-03-17 18:30:55 +00:00
Adam Fowler
b4d6a518c7 Fixed all issues found in spec so far
parse has got quite complex might look to simplify
2021-03-17 17:02:59 +00:00
Adam Fowler
753079fa9d Add inverted tests 2021-03-16 17:16:51 +00:00
Adam Fowler
9ddc49b7bc Add interpolation tests, start inverted 2021-03-15 20:35:05 +00:00
Adam Fowler
a76a02a8dc Add Comment spec 2021-03-15 18:57:55 +00:00
Adam Fowler
66edcba185 swift format 2021-03-15 18:24:06 +00:00
Adam Fowler
5dd3ab2af1 render(_, withTemplateNamed) -> render(_, withTemplate) 2021-03-15 15:18:50 +00:00
Adam Fowler
978b14a96a Wrap Lambda function in a struct to avoid crash in Mirror 2021-03-15 14:46:40 +00:00
Adam Fowler
e2cfbb7acc Make runMethod calls public, add some comments 2021-03-15 14:27:32 +00:00
Adam Fowler
0f2c3bcea9 Added sorted methods 2021-03-15 10:53:33 +00:00
Adam Fowler
465ad49f1f Add index filter 2021-03-14 17:53:20 +00:00
Adam Fowler
33b488fe40 Add support for first/last functions 2021-03-14 12:47:00 +00:00
Adam Fowler
06251739d7 Keep pointer to Library in template 2021-03-14 08:51:16 +00:00
Adam Fowler
aaf285154d Add support for Lambdas 2021-03-14 08:32:50 +00:00
Adam Fowler
8df4e63432 Add methods for Array and Dictionary 2021-03-12 17:37:25 +00:00
Adam Fowler
c9e33153f3 Basic method setup and calling 2021-03-12 14:03:46 +00:00
Adam Fowler
902c300969 Add template library loading from FileSystem 2021-03-12 11:04:17 +00:00
Adam Fowler
6be7a382fb Added error tests 2021-03-12 10:14:17 +00:00
Adam Fowler
633f494e18 Moving stuff about, renaming 2021-03-12 09:55:12 +00:00
Adam Fowler
02af0ec296 Add support for dynamic partials 2021-03-12 08:54:49 +00:00