{"id":18960254,"url":"https://github.com/multiversecoder/slim4py","last_synced_at":"2025-04-19T09:54:09.638Z","repository":{"id":57468413,"uuid":"222110626","full_name":"multiversecoder/slim4py","owner":"multiversecoder","description":"Use Ruby Slim as a template engine in any python framework","archived":false,"fork":false,"pushed_at":"2019-11-19T12:24:35.000Z","size":21,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T04:44:43.533Z","etag":null,"topics":["bottle","django","flask","frontend","python","python-framework","ruby-slim","slim","template-engine","tornado","turbogears","web-development"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multiversecoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-16T14:24:53.000Z","updated_at":"2022-06-21T08:01:08.000Z","dependencies_parsed_at":"2022-09-19T09:31:38.260Z","dependency_job_id":null,"html_url":"https://github.com/multiversecoder/slim4py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiversecoder%2Fslim4py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiversecoder%2Fslim4py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiversecoder%2Fslim4py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiversecoder%2Fslim4py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiversecoder","download_url":"https://codeload.github.com/multiversecoder/slim4py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249668775,"owners_count":21308532,"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":["bottle","django","flask","frontend","python","python-framework","ruby-slim","slim","template-engine","tornado","turbogears","web-development"],"created_at":"2024-11-08T14:04:57.923Z","updated_at":"2025-04-19T09:54:09.620Z","avatar_url":"https://github.com/multiversecoder.png","language":"Python","readme":"# Slim4Py - Slim Templates for Python\n\n\nWhat is Slim?\n-------------\n\nSlim is a fast, lightweight templating engine whose goal is reduce html syntax to the essential parts without becoming cryptic.\n\nCheck on the official site: [http://slim-lang.com/](http://slim-lang.com/)\n\nWhat is slim4py?\n----------------\n\nSlim4Py is a simple script that allows you to use all the functions of Slim (Ruby)\nin any python framework with the addition that you can also use the\nmako syntax (a popular and fast template engine for python).\n\nHere is a small example of usage:\n\n```python\nfrom slim4py.slim import Slim\n\nslim = Slim(\"slim\")\n\ndef say_hello():\n    return \"Hello World\"\n\nslim.render(\"example.slim\", say_hello=say_hello, year=\"2019\", author=\"https://github.com/multiversecoder/slim4py\")\n```\n\nAbout Magic Comments\n--------------------\n\nIf you need to use python inside the templates, you can define at the beginning of the file a magic comment containing all the variables that will be rendered by mako using the logic written in python.\n\nTo define a magic comment use:\n\n    / mako_vars = [name_var_1, name_var_2, ...]\n\nThis comment will be detected by the engine and rendered using mako and python.\n\n\nCombining Python With Ruby\n--------------------------\n\n``` slim\n/ mako_vars = [list_]\ndoctype 5\nhtml\n  head\n    title Slim4Py Example - Basic\n  body\n    #contents\n      |\n      % for a in list_:\n        % if a.startswith(\"t\"):\n            its two or three\n        % elif a.startswith(\"f\"):\n            four/five\n        % else:\n            one\n        % endif\n      % endfor\n  footer\n    | Copyright - #{author} - #{year}\n```\n\n\nRequirements\n------------\n\nYou need Python 3.7 or later to run slim4py, ruby and the slim gem\n\nIn Ubuntu, Mint and Debian you can install Requirements like this:\n\n    $ apt-get install python3 python3-pip\n    $ apt-get install ruby\n    $ gem install slim\n\nFor RHEL, Fedora and CentOS:\n\n    $ dnf install python3 python3-pip\n    $ dnf install ruby\n    $ gem install slim\n\nFor other systems\n\n    - Install Python3\n    - Install Ruby\n    - gem install slim\n\n\nQuick start\n-----------\n\nslim4py can be installed using pip:\n\n    $ python3 -m pip install -U slim4py\n\nor:\n\n    $ pip install slim4py\n\nfor install slim4py from source:\n\n    $ git clone https://github.com/multiversecoder/slim4py\n    $ cd ./slim4py\n    $ pip install .\n\n\nDevelopment status\n------------------\n\nslim4py is beta software, but it has already been used in production and it has an extensive test suite.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiversecoder%2Fslim4py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiversecoder%2Fslim4py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiversecoder%2Fslim4py/lists"}