{"id":16934251,"url":"https://github.com/anteru/lina","last_synced_at":"2025-03-21T04:17:05.543Z","repository":{"id":80398332,"uuid":"134078921","full_name":"Anteru/lina","owner":"Anteru","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-19T15:38:52.000Z","size":288,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T01:17:13.178Z","etag":null,"topics":["python","text-templating"],"latest_commit_sha":null,"homepage":"https://sh13.net/projects/Lina/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anteru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T16:27:34.000Z","updated_at":"2024-08-19T15:38:55.000Z","dependencies_parsed_at":"2024-08-19T18:39:33.214Z","dependency_job_id":null,"html_url":"https://github.com/Anteru/lina","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anteru%2Flina","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anteru%2Flina/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anteru%2Flina/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anteru%2Flina/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anteru","download_url":"https://codeload.github.com/Anteru/lina/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244734196,"owners_count":20501018,"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":["python","text-templating"],"created_at":"2024-10-13T20:51:39.666Z","updated_at":"2025-03-21T04:17:05.523Z","avatar_url":"https://github.com/Anteru.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lina\r\n=======\r\n\r\nLina is a template engine in the spirit of Google's [CTemplate](http://code.google.com/p/ctemplate/?redir=1) written in Python 3. It can be used to generate any kind of text-based documents. Lina has been used since several years in a large C/C++ project to generate code.\r\n\r\nUntil late August 2014, this library was known as *Miranda*.\r\n\r\nRequirements\r\n------------\r\n\r\nPython 3.4 or later. Previous versions of Python will not work due to the lack of enumerations.\r\n\r\nInstallation\r\n------------\r\n\r\nLina is available from PyPi, so you can install directly using ``pip``:\r\n\r\n    pip install lina\r\n\r\nGetting started\r\n---------------\r\n\r\nThe most trivial template is:\r\n\r\n    Hello {{name}}!\r\n\r\nIt can be evaluated using\r\n\r\n    import lina\r\n    template = lina.Template ('Hello {{name}}!')\r\n    print (template.RenderSimple (name = \"Bob\"))\r\n\r\nThis will print:\r\n\r\n    Hello Bob!\r\n\r\nThe real power comes from blocks which can be repeated and nested. For instance:\r\n\r\n    {{#Users}}Hello {{name}}!{{/Users}\r\n\r\nrendered with\r\n\r\n    Users = [{'name':'Alice'}, {'name':'Bob'}]\r\n\r\nwill print:\r\n\r\n    Hello Alice!Hello Bob!\r\n\r\nThis can be further improved by using formatters. A formatter modifies a value just before it is written to the output stream. Lina comes with a set of predefined formatters like upper-case transformation. Formatters can be defined for values or blocks. A good example for a block-level formatter is the `list-separator` formatter. If we change the template of the previous example to:\r\n\r\n    {{#Users:list-separator=NEWLINE}}Hello {{name}}!{{/Users}\r\n\r\nthe result will be:\r\n\r\n    Hello Alice!\r\n    Hello Bob!\r\n\r\nValue-level formatters are for example the upper-case formatter. `{{value:upper-case}}` with `value` set to `Test` will result in `TEST`.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanteru%2Flina","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanteru%2Flina","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanteru%2Flina/lists"}