{"id":13629701,"url":"https://github.com/atifaziz/Transplator","last_synced_at":"2025-04-17T09:35:57.528Z","repository":{"id":45544112,"uuid":"327118851","full_name":"atifaziz/Transplator","owner":"atifaziz","description":"Simple C# source generator for text templates","archived":false,"fork":false,"pushed_at":"2022-11-11T17:12:49.000Z","size":62,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T11:42:16.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atifaziz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-05T21:03:36.000Z","updated_at":"2024-04-03T08:51:05.000Z","dependencies_parsed_at":"2023-01-21T16:49:54.547Z","dependency_job_id":null,"html_url":"https://github.com/atifaziz/Transplator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atifaziz%2FTransplator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atifaziz%2FTransplator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atifaziz%2FTransplator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atifaziz%2FTransplator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atifaziz","download_url":"https://codeload.github.com/atifaziz/Transplator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751385,"owners_count":17196628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:01:16.920Z","updated_at":"2024-11-08T20:31:46.432Z","avatar_url":"https://github.com/atifaziz.png","language":"C#","funding_links":[],"categories":["Do not want to test 112 ( old ISourceGenerator )","Source Generators"],"sub_categories":["1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category","Text templating"],"readme":"# Transplator\n\nThis project is currently an experiment into the idea of generating C# source\ncode from a text template. The code generation is integrated into the C#\ncompiler using the [source generator] feature made available starting with\nthe version supporting C# 9.\n\nThe input to Transplator is a simple text template file, where literal text is\ninterspersed with C# source code. The output is C# code that, when executed as\npart of the compiled product, will produce text with literal parts copied over\nas they are and the C# code in the template contributing dynamic text.\n\nUsing the [source generator] feature has the benefit that the template is\nturned into strong- and statically-typed C# source code. Any type errors will\nbe caught at compile-time. At run-time, the template output will be produced\nat native speed, without any interpretation.\n\nThe text templates can be used, for example, to generate e-mail messages with\ncertain parts replaced dynamically at run-time.\n\n## Format\n\nAnything between `{%` and `%}` is considered C# code and everthing else is\ntreated as literal text. For example:\n\n    The current date and time is {% DateTime.Now %}.\n\nTransplator has some smarts to distinguish between control flow blocks or\nstatement and expressions that contribute dynamic text, so syntactically,\nyou only need to remember to use `{%` and `%}` as delimiters:\n\n    {%\n        for (var i = 0; i \u003c 10; i++) {\n    %}\n            i = {% i + 1 %}\n    {%\n        }\n    %}\n\nLike the [Liquid] templating language, you can use `-` to trim whitespace\nfrom the left or right side:\n\n    {%- \"left whitespace is trimmed\" %}\n    {% \"right whitespace is trimmed\" -%}\n    {%- \"left and right whitespace is trimmed\" -%}\n\nLike the [Scriban] templating language, you can use `~` to for [non-greedy\nwhitespace trimming][scrws]:\n\n\u003e - Using a `{{~` will remove any whitespace before but will stop on the\n\u003e   first newline without including it\n\u003e - Using a `~}}` will remove any whitespace after including the first\n\u003e   newline but will stop after\n\n\n  [source generator]: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/\n  [Liquid]: https://shopify.github.io/liquid/\n  [Scriban]: https://github.com/scriban/scriban\n  [scrws]: https://github.com/scriban/scriban/blob/master/doc/language.md#14-whitespace-control\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatifaziz%2FTransplator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatifaziz%2FTransplator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatifaziz%2FTransplator/lists"}