Commit Graph

85 Commits

Author SHA1 Message Date
Ralph Kühnert
6df64896f4 Add / as a valid partialNameChar and use it in parse (#71)
* Add / as a valid partialNameChar and use it in parse

* maybe let's not keep "bla" in the tests
2025-08-30 16:13:26 +01:00
Go Takagi
2add8847a1 Support Swift 6 mode (#65)
* Enable swift 6 mode

* Attach Sendable

* Stop async context because enumerator can use only synchronous contexts

* Fix global shared mutable state for MustacheContentTypes

* Revert "Fix global shared mutable state for MustacheContentTypes"

This reverts commit d4ccc83e07aeb48f4aa4024b71eb8e5f70131bc5.

* Use  instead of lock

* Support 5 and 6 versions

* Lock on access in Swift 6

* Support 5.9

* Revert "Support 5.9"

This reverts commit 9845b3bc448b2af7238c3ac88aabe6d764b2e667.

* Fix 5.9 compatibility

* Unify to manage the same lock logic in 5.9 and 6

* Add withLock backport in NSLock
2025-03-26 09:53:44 +00:00
hummingbird-automation[bot]
ec4ef9aa04 Update from Hummingbird Project Template (#58)
* Update from hummingbird-project-template 572d468b2cabeca286314c5a35196bd42445c8ef

* run swift-format

* Remove .swiftformat

---------

Co-authored-by: adam-fowler <adam-fowler@users.noreply.github.com>
Co-authored-by: Adam Fowler <adamfowler71@gmail.com>
2024-11-28 07:31:09 +00:00
Adam Fowler
9de71fc4d1 Update docs again 2024-09-20 10:23:54 +01:00
Adam Fowler
8726b2d119 Update docs 2024-09-20 10:22:47 +01:00
Adam Fowler
933fa3d60f Add support for proper lambdas (#48)
* Add support for proper lambdas

* Get rid of recursion

Remove renderSectionLambda as I can use renderUnescapedLambda for that.
2024-09-19 17:17:50 +01:00
Adam Fowler
8fba85e28c doc comment update 2024-09-19 11:28:57 +01:00
Adam Fowler
b6736b2ce8 Changes required by docc 2024-09-13 17:32:50 +01:00
Adam Fowler
01b1f21ed6 Dynamic names support (#49)
* Dynamic names support

* Add support for dynamic names in parent tags

* Support all dynamic names spec

* Swift 5.8 compile fix
2024-08-28 08:31:06 +01:00
Adam Fowler
cde358e364 Fixes for swift 5.8 (#42)
* Fixes for swift 5.8

* Add 5.8 to CI

* More fixes
2024-07-19 10:52:49 +01:00
Adam Fowler
5bb66ac425 Add development support for reloading templates when you render them (#30)
* Add support for reloading templates when you render them

* comment

* Ensure reload is only available in DEBUG

* move preprocessor block

* swift format

* MustacheTemplate.init?(filename:) internal

* Only pass reload flag down in DEBUG builds

* Rebase with main
2024-07-16 15:46:57 +01:00
Adam Fowler
7689de0a42 Fix issues from Inheritance spec (#36)
* Separate inheritance block and expansion

* Catch top level partial definition, and block newlines

* Add testTrailingNewLines to verify output of trailing newlines in partials

* Remove comment

* If block,partial has indentation add indent for first line

* Re-enable full sections spec

* withBlockExpansion

* Get indentation of blocks correct
2024-07-15 09:36:15 +01:00
Mahdi Bahrami
cc0eaffa06 Make MustacheSequence public (#38)
* Make `MustacheSequence` public

* `MustacheSequence` require conformance to `Sequence`

* remove protocol requirements

* `MustacheContext` revert to `internal`
2024-07-14 18:44:59 +01:00
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
d642832ffe Make deprecations unavailable (#31) 2024-07-03 09:30:21 +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
94bbca47ae Swift Format 0.48.17 2021-10-30 11:23:58 +01:00
Adam Fowler
8b38438f17 Make HBMustacheParent public 2021-09-28 15:41:11 +01:00
Adam Fowler
187c7f977c Help text for HBMustacheCustomRenderable 2021-05-03 17:05:17 +01: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
eaaeea0166 If running a transform and object doesn't recognise it return nil 2021-03-24 16:20:06 +00: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
ef4eb40eb7 Comments 2021-03-22 14:14:34 +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
a08b1e8087 Swift format, swift 5.3 2021-03-21 11:56:08 +00:00
Adam Fowler
3c50d1c15c comments 2021-03-19 17:49:02 +00:00
Adam Fowler
f9f8c1320a Renaming
HBMustacheMethods -> HBMustacheTransformable
HBMustacheContext -> HBMustacheSequenceContext
2021-03-19 14:48:44 +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
a602593b5d Remove Logging imports 2021-03-18 16:29:23 +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
4af21bb4cf Fix issue where parser return bad sub parsers if you reach end of text 2021-03-18 15:25:00 +00:00
Adam Fowler
b637c4c4a4 Tidy standalone processing 2021-03-18 12:58:48 +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
169a7bbbf4 Added SpecPartialsTests and fixed issues 2021-03-17 18:30:55 +00:00