{"id":18319773,"url":"https://github.com/redding/deas-erubis","last_synced_at":"2025-04-09T14:22:42.526Z","repository":{"id":23520473,"uuid":"26886711","full_name":"redding/deas-erubis","owner":"redding","description":"Deas template engine for rendering erb templates using Erubis","archived":false,"fork":false,"pushed_at":"2019-05-21T02:26:46.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T19:22:07.492Z","etag":null,"topics":["ruby","template-engine"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/redding.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":"2014-11-19T23:31:29.000Z","updated_at":"2019-05-21T02:26:45.000Z","dependencies_parsed_at":"2022-08-26T13:51:34.881Z","dependency_job_id":null,"html_url":"https://github.com/redding/deas-erubis","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fdeas-erubis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fdeas-erubis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fdeas-erubis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fdeas-erubis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redding","download_url":"https://codeload.github.com/redding/deas-erubis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054200,"owners_count":21039952,"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":["ruby","template-engine"],"created_at":"2024-11-05T18:14:13.063Z","updated_at":"2025-04-09T14:22:42.504Z","avatar_url":"https://github.com/redding.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deas::Erubis\n\n[Deas](https://github.com/redding/deas) template engine for rendering [Erubis](http://www.kuwata-lab.com/erubis/) templates\n\n## Usage\n\nRegister the engine:\n\n```ruby\nrequire 'deas'\nrequire 'deas-erubis'\n\nDeas.configure do |c|\n\n  c.template_source \"/path/to/templates\" do |s|\n    s.engine 'erb', Deas::Erubis::TemplateEngine\n  end\n\nend\n```\n\nAdd `.erb` to any template files in your template source path.  Deas will evaluate their content using Erubis when they are rendered.\n\n### Partials\n\nDeas::Erubis provides template helpers for rendering partial templates.\n\n```erb\n# in /path/to/templates/list.html.erb\n\u003ch1\u003e\u003c%= list.title %\u003e\u003c/h1\u003e\n\u003cul\u003e\n  \u003c% list.items.each do |item| %\u003e\n    \u003c%= partial '_list_item.html', :item =\u003e item %\u003e\n  \u003c% end %\u003e\n\u003c/ul\u003e\n\n# in /path/to/templates/_list_item.html.erb\n\u003cli\u003e\u003c%= item.name %\u003e\u003c/li\u003e\n\n# output\n\u003ch1\u003eMy List\u003c/h1\u003e\n\u003cul\u003e\n  \u003cli\u003eItem 1\u003c/li\u003e\n  \u003cli\u003eItem 2\u003c/li\u003e\n  \u003cli\u003eItem 3\u003c/li\u003e\n\u003c/ul\u003e\n```\n\nThere are also helpers for rendering partials that yield to given content blocks (called \"capture partials\")\n\n```erb\n# in /path/to/templates/list.html.erb\n\u003ch1\u003e\u003c%= list.title %\u003e\u003c/h1\u003e\n\u003cul\u003e\n  \u003c% list.items.each do |item| %\u003e\n    \u003c% capture_partial '_list_item.html' do %\u003e\n      \u003cspan\u003e\u003c%= item.name %\u003e\u003c/span\u003e\n    \u003c% end %\u003e\n  \u003c% end %\u003e\n\u003c/ul\u003e\n\n# in /path/to/templates/_list_item.html.erb\n\u003cli\u003e\u003c%= yield %\u003e\u003c/li\u003e\n\n# output\n# output\n\u003ch1\u003eMy List\u003c/h1\u003e\n\u003cul\u003e\n  \u003cli\u003e\n    \u003cspan\u003eItem 1\u003c/span\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003cspan\u003eItem 2\u003c/span\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003cspan\u003eItem 3\u003c/span\u003e\n  \u003c/li\u003e\n\u003c/ul\u003e\n```\n\n### Notes\n\nThe engine doesn't allow overriding the template scope but instead allows you to pass in data that binds to the template scope as local methods.  By default, the view handler will be bound to the scope via the `view` method in templates.  If you want to change this, provide a `'handler_local'` option when registering:\n\n```ruby\nc.template_source \"/path/to/templates\" do |s|\n  s.engine 'erb', Deas::Erubis::TemplateEngine, 'handler_local' =\u003e 'view_handler'\nend\n```\n\nBy default, `::Erubis::Eruby` is used to evaluate the templates.  However, Erubis provides \"enhancers\" that add certain features.  You can pass in any custom eruby class (with any enhancers you like) useing the `'eruby'` option when registering:\n\n```ruby\n  c.template_source \"/path/to/templates\" do |s|\n    s.engine 'erb', Deas::Erubis::TemplateEngine, 'eruby' =\u003e MyEnhancedEruby\n  end\n```\n\nThe engine doesn't cache templates by default - it opens the file from disk on each render.  To enable caching (which stores the file contents in memory on first use), pass a `'cache'` option when registering:\n\n```ruby\n  c.template_source \"/path/to/templates\" do |s|\n    s.engine 'erb', Deas::Erubis::TemplateEngine, 'cache' =\u003e true\n  end\n```\n\nIf you wish to provide custom template helpers, organize them in module(s) and pass them with the `'helpers'` option when registering:\n\n```ruby\n  c.template_source \"/path/to/templates\" do |s|\n    s.engine 'erb', Deas::Erubis::TemplateEngine, 'helpers' =\u003e [MyAwesomeHelpers, NotSoAwesomeHelpers]\n  end\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'deas-erubis'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install deas-erubis\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fdeas-erubis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredding%2Fdeas-erubis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fdeas-erubis/lists"}