Commit Graph

187 Commits

Author SHA1 Message Date
Ilya Puchka
6649b7e716 Parse variables as expressions
removed static boolean expressions
added test for rendering template with boolean expression
2022-07-29 01:47:55 +02:00
Ilya Puchka
dd7ea1e097 Access outer loop context via its label 2022-07-28 23:59:31 +02:00
Ilya Puchka
91df84b1a5 Loop labels 2022-07-28 23:59:31 +02:00
Ilya Puchka
a7448b74cf Added break and continue nodes 2022-07-28 23:59:31 +02:00
Ilya Puchka
8c379296ca Cache rendered blocks content to reuse them in further calls 2022-07-28 19:01:13 +02:00
yonaskolb
ef97973e85 Implement trim whitespace 2022-07-28 16:43:24 +02:00
David Jennes
888797b27e Move source files to where SPM expectes them to be 2022-07-28 03:15:53 +02:00
David Jennes
f32c772b99 Warnings-- 2022-07-28 03:13:01 +02:00
David Jennes
e6ee27f64e Drop swift 4.2 support 2022-07-28 03:10:38 +02:00
Ilya Puchka
7247d0a83d Dynamic member lookup (via marker protocol) 2022-07-28 03:05:17 +02:00
Ilya Puchka
701221c0fb always evaluate block.super even if it is not used 2022-07-27 18:51:52 +02:00
David Jennes
99cc1cac4a Make render with context public 2022-07-27 03:01:37 +02:00
David Jennes
0bbb8005bb Fix bunch of warnings 2022-07-27 02:56:21 +02:00
Stefano Mondino
c444fb959d Make tokens public 2022-07-26 15:02:39 +02:00
Łukasz Kuczborski
521a599a60 Fixed logic and tests 2021-04-09 23:37:54 +02:00
Łukasz Kuczborski
371a4737d9 Fixed missing braces 2021-04-09 23:27:00 +02:00
Łukasz Kuczborski
61919c5e8e PR fixes 2021-04-09 23:21:46 +02:00
Łukasz Kuczborski
7c635975d1 Fix for crashing range indexes when variable length is 1 2021-04-09 22:51:55 +02:00
Dan Palmer
f5f85d95a9 Fix build warning
`components` is not mutated, so it can be a `let`. This fixes the build warning that otherwise shows up in build logs.
2021-01-18 17:33:13 +00:00
David Jennes
19646bcddf Update SwiftLint to 0.39.2 (#295)
* Update SwiftLint to 0.39.2

* Enable a bunch of extra rules

* Fix all warnings

* Ignore this Xcode generated folder

Co-authored-by: Olivier Halligon <olivier@halligon.net>
2020-08-12 22:52:00 +02:00
David Jennes
386e9d0234 Remove unneeded backports 2020-05-27 00:58:28 +02:00
Michael Zuccarino
9c3468e300 Public Context initialization (#280)
Co-authored-by: Ilya Puchka <ilyapuchka@gmail.com>
2020-01-12 15:39:04 +00:00
Andreas Ley
a1718ae350 Fix for incorrect tokenization due to index difference of Unicode character/scalar (#286)
* Fix: `Scanner` now uses indices of the respective UnicodeScalarView

* Fix: `Scanner` now uses indices of the respective UnicodeScalarView

* Extended test for Unicode `Combining Diaeresis`

* Fixed test for combining diaeresis

* Inlined template for testing Unicode combining diaeresis

Co-authored-by: Ilya Puchka <ilyapuchka@gmail.com>
2020-01-12 15:21:02 +00:00
kawoou
782ffdd4c7 Code review by @djbe 2019-01-30 15:29:04 +09:00
kawoou
305dc31abd Support swift 5.0 2019-01-29 15:17:26 +09:00
Ilya Puchka
693565ddda syntax error on empty variable tag 2019-01-12 22:28:09 +00:00
David Jennes
3f4622f54f Fix issues in Sources
Sources

sources
2018-11-11 17:34:47 +01:00
Ilya Puchka
08fc21d177 Merge branch 'master' into dynamic-filter 2018-10-01 22:45:21 +01:00
Ilya Puchka
da6a0ccaca added some doc comments 2018-10-01 22:12:21 +01:00
Ilya Puchka
dbb5e14e9f solve merge conflict issues 2018-10-01 21:59:03 +01:00
Ilya Puchka
0269052d6a Merge branch 'master' into dynamic-filter
# Conflicts:
#	CHANGELOG.md
#	Sources/ForTag.swift
#	Sources/IfTag.swift
#	Sources/Parser.swift
#	Sources/Variable.swift
#	Tests/StencilTests/ExpressionSpec.swift
#	Tests/StencilTests/FilterSpec.swift
#	Tests/StencilTests/ForNodeSpec.swift
#	Tests/StencilTests/VariableSpec.swift
2018-10-01 21:21:56 +01:00
andy
4154cd31ff Changed to if swift package generate-xcodeproj(>=4.1) 2018-10-01 15:11:03 +01:00
andy
fd79045053 removed whitespace changes 2018-10-01 14:56:09 +01:00
andy
9bd86d9fd5 Moved swift4.0 support into single file 2018-10-01 14:54:10 +01:00
andy
66a9bc563a Feat: Add support for Swift 4.0 2018-10-01 11:58:20 +01:00
Ilya Puchka
01afae9b79 Fix parsing token components with parenthesis without spaces (#254)
* fix parsing token components with brackets without spaces

* handle more edge cases

* do not use force unwrap

* use first/last instead of hasPrefix/hasSuffix

* update CHANGELOG
2018-09-30 21:57:19 +01:00
Ilya Puchka
d9f6a82f97 Convert Token from enum to struct (#256)
* convert Token from enum to struct

* private setter for components

* updated CHANGELOG
2018-09-30 21:48:44 +01:00
David Jennes
2e67755118 Fix a bug where tokens without spaces were parsed incorrectly 2018-09-26 03:06:49 +02:00
David Jennes
cb4e514846 Code documentation 2018-09-26 00:33:15 +02:00
ethorpe
07a6b2aea5 Rewrites scanner for better performance. This is primarily an improvement under Ubuntu
Cleanup readability a little bit
Rewrite original scan function so it's available. Syntax improvements

Fix deprecation warnings in Lexer

Cleanup some syntax issues

lexer

t

t
2018-09-26 00:33:15 +02:00
Ilya Puchka
fce3dc5e48 Added method to register boolean filters (#160)
* added method to register boolean filters

* parametrised negative filter name

* Update Extension.swift

* Update CHANGELOG.md

* renamed registerBooleanFilter to registerFilter

* updated docs
2018-09-25 23:29:21 +01:00
Ilya Puchka
f7bda226e8 Update to Spectre 0.9.0 (#247)
* update to Spectre 0.9.0

* fix variable spec tests

* fix flatMap warning

* updated CHANGELOG
2018-09-23 03:46:27 +03:00
Ilya Puchka
d238c25eef Allow using collection accessors on strings (#245)
* allow using collection accessors on strings

* refactored resolving collection accessors

* refactored to fileprivate function

* Update Variable.swift

* Update templates.rst
2018-09-22 16:41:45 +03:00
Ilya Puchka
df2e193891 Allow conditions in variable node (#243)
* use condition in variable node

* added support for else expression

* addressing code review comments
2018-09-22 14:09:25 +03:00
Ilya Puchka
2c3962a3de Added support for brackets in boolean expressions (#165)
* added support for brackets in boolean expressions

* more descriptive error messages

* use array slices

* added test for nested expressions

* removed brackets validation step

* address code review comments

* added doc comment

* simplify expression spec

* fixed docs
2018-09-21 22:07:28 +03:00
David Jennes
fce4e85a63 Ensure the "for" iteration over a dictionary is consistent 2018-09-21 00:17:42 +02:00
David Jennes
0d4dee29b2 Use multiline strings
multi

t

t
2018-09-20 04:17:42 +02:00
David Jennes
1704cd2ddf Use auto equatable 2018-09-20 02:20:21 +02:00
Ilya Puchka
0074ee1d4a check for property via selector before using value(forKey:) 2018-09-11 18:12:27 +01:00
Yonas Kolb
93ccc56540 update lexer to swift 4 2018-09-10 21:19:25 +10:00