Commit Graph

45 Commits

Author SHA1 Message Date
Michael Pfaff 6e09ca7464 Refactor to support custom escaping schemes 2024-03-15 18:05:31 -04:00
Michael Pfaff 878a026851 Ignore escaping on derived templates 2024-03-11 18:43:13 -04:00
Michael Pfaff 4e2232f2de Unify Render* and Template* traits 2024-03-11 17:33:11 -04:00
Michael Pfaff e5a471d9ca Improve API 2024-03-11 16:57:52 -04:00
Lev af91dc5243 remove space 2023-10-21 14:10:31 -07:00
Lev 4c554d1a57 Fix filename conflict 2023-10-21 14:09:00 -07:00
Newton Ni 01ba06707b Use timestamps for change detection
This commit changes the caching mechanism to use the timestamp of
all included templates instead of hashing the contents of the
root template.

The primary downside is that every build now has to parse, transform,
and resolve the input templates instead of just reading and hashing
the data--I didn't measure how much more expensive this is, but it
seems unavoidable if we need information about child templates.
Maybe a hacky regex-based approach could work as an alternative to
a complete parse.

On the bright side, this approach rebuilds parent templates correctly
when a child template has changed, and doesn't require garbage collection
for old compiled template files.
2023-10-02 13:21:29 -05:00
vthg2themax c05154271a Update config.rs and procmacro.rs 2023-07-28 10:28:02 -04:00
liushuyu 2a8e1a7b7d
dep: update syn to v2 (#115)
* dep: update syn to v2

* fix a broken test.

---------

Co-authored-by: Vince Pike <25014503+vthg2themax@users.noreply.github.com>
2023-04-12 10:02:05 -04:00
Kogia-sima 5fe0934aba Add comment about `include_bytes_seq`
`include_bytes_seq` statements are required for cargo to watch child
templates. Without them, compiler won't re-run after the child templates
are updated.

cc #112
2023-03-05 18:08:56 +09:00
Kogia-sima 10ab29be85 Prefer using scope guard for `fallback::unforce()`
This scope guard ensure that `fallback::unforce()` will be called even
if the program panics during compilation.
2021-02-03 15:52:14 +09:00
Kogia-sima 5e12280df1 Fix stable/nightly mismatch error cause by proc-macro2
fix #50
2021-02-03 02:56:15 +09:00
Kogia-sima e69d36b168 refactor: clippy fix 2020-12-29 16:53:46 +09:00
Kogia-sima 92c8f8a852 refactor: remove unused code 2020-12-24 17:41:51 +09:00
Kogia-sima 348a3825f2 perf: join after loop-optimization 2020-12-24 17:22:11 +09:00
Kogia-sima 70033d604d break: forbit implementing TemplateOnce trait by hand 2020-12-19 17:38:57 +09:00
Kogia-sima a1abc2aaa3 refactor: Simplify derive option parsing 2020-12-16 19:55:28 +09:00
Kogia-sima 98edecdb3a refactor: suppress use of to_string_lossy 2020-12-16 19:13:37 +09:00
Kogia-sima 6c7a74823f refactor: use DefaultHasher instead of custom fnv hash implementation 2020-12-16 19:01:28 +09:00
Kogia-sima 790f7366cf break: Update TemplateOnce trait structure
* Remove render_once_to_string method
* Add render_once_to method
* Now TemplateOnce trait requires both method implementation
* Some performance improvement
2020-12-16 19:01:28 +09:00
Tom Jordell 9d405ad9ff Use std::result::Result in derive macro to allow custom Result types 2020-11-21 08:40:46 +01:00
Kogia-sima 4f64a3b7fe Avoid over-size allocation in `render_once_to_string` 2020-07-25 23:56:17 +09:00
Kogia-sima 4fc278ecfb Revert "Improve Template::render() performance"
This reverts commit 4e8b437387.
2020-07-25 07:48:00 +09:00
Kogia-sima 4e8b437387 Improve Template::render() performance 2020-07-23 11:48:19 +09:00
Kogia-sima cc10171b73 Avoid dangerous conversion from String to Buffer 2020-07-22 07:05:15 +09:00
Kogia-sima 119e282945 Avoid generating _size_hint local variable 2020-07-15 00:06:01 +09:00
Kogia-sima 670d936def break: remove runtime::Context API 2020-07-15 00:06:01 +09:00
Kogia-sima 869c58dcb1 Use UFCS instead of receiver coecions
This change is required to achieve filter
2020-07-15 00:06:01 +09:00
Kogia-sima 3040084ca9 do not use `sfrt` as an alias to sailfish::runtime 2020-07-15 00:05:56 +09:00
Kogia-sima 6c72bb17d1 Put all tests in sailfish-tests/ directory 2020-07-14 22:46:58 +09:00
Kogia-sima 9982ab0683 Suppress warning when `config` feature flag is disabled 2020-07-11 17:02:31 +09:00
Kogia-sima f40926122b feat: Add TemplateOnce::render_once_to_string method 2020-06-18 18:37:39 +09:00
Kogia-sima d1b6d2559a feat: New feature flag (config) 2020-06-15 06:44:49 +09:00
Kogia-sima 2d994be4ff feat: Global configuration file 2020-06-15 05:36:39 +09:00
Kogia-sima 98e11b1163 fix: Re-compile when child template is update. 2020-06-13 22:58:57 +09:00
Kogia-sima 8a83c2e278 Avoid method name collision in render* macros
fix #9
2020-06-13 13:16:39 +09:00
Kogia-sima d302f30144 Format code 2020-06-11 19:42:22 +09:00
Kogia-sima 7665690982 Change input/output directory for integration-tests 2020-06-11 15:31:55 +09:00
Kogia-sima 0162e44ff8 Remove unused code 2020-06-07 23:23:45 +09:00
Kogia-sima fd3d224067 Refactor source code with rustfmt and clippy
[skip ci]
2020-06-07 17:58:52 +09:00
Kogia-sima 9c4b6352d5 Add rm_whitespace option 2020-06-07 13:00:28 +09:00
Kogia-sima b24861e158 Skip attribute if it is not wrapped with `template` 2020-06-07 03:44:30 +09:00
Kogia-sima 12174ff5c5 Implement include! macro 2020-06-06 22:49:01 +09:00
Kogia-sima 420d83521c Add Config struct 2020-06-06 11:58:14 +09:00
Kogia-sima 08dacdd263 Add source code 2020-06-05 22:31:38 +09:00