{"id":16305693,"url":"https://github.com/cafe01/template-plift","last_synced_at":"2026-02-15T04:36:19.034Z","repository":{"id":56840226,"uuid":"63109233","full_name":"cafe01/template-plift","owner":"cafe01","description":null,"archived":false,"fork":false,"pushed_at":"2016-10-27T14:24:31.000Z","size":138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-15T03:53:34.907Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cafe01.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2016-07-11T23:23:34.000Z","updated_at":"2016-07-11T23:23:52.000Z","dependencies_parsed_at":"2022-08-29T05:01:00.347Z","dependency_job_id":null,"html_url":"https://github.com/cafe01/template-plift","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/cafe01/template-plift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafe01%2Ftemplate-plift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafe01%2Ftemplate-plift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafe01%2Ftemplate-plift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafe01%2Ftemplate-plift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cafe01","download_url":"https://codeload.github.com/cafe01/template-plift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cafe01%2Ftemplate-plift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29469650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T04:35:06.950Z","status":"ssl_error","status_checked_at":"2026-02-15T04:33:41.357Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-10-10T21:08:07.677Z","updated_at":"2026-02-15T04:36:19.016Z","avatar_url":"https://github.com/cafe01.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/cafe01/template-plift.svg?branch=master)](https://travis-ci.org/cafe01/template-plift) [![Coverage Status](https://img.shields.io/coveralls/cafe01/template-plift/master.svg?style=flat)](https://coveralls.io/r/cafe01/template-plift?branch=master)\n# NAME\n\nPlift - HTML Template Engine + Custom HTML Elements\n\n# SYNOPSIS\n\n    use Plift;\n\n    my $plift = Plift-\u003enew(\n        path    =\u003e \\@paths,                               # default ['.']\n        plugins =\u003e [qw/ Script Blog Gallery GoogleMap /], # plugins not included\n    );\n\n    my $tpl = $plift-\u003etemplate(\"index\");\n\n    # set render directives\n    $tpl-\u003eat({\n        '#name' =\u003e 'fullname',\n        '#contact' =\u003e [\n            '.phone' =\u003e 'contact.phone',\n            '.email' =\u003e 'contact.email'\n        ]\n    });\n\n    # render render with data\n    my $document = $tpl-\u003erender({\n\n        fullname =\u003e 'Carlos Fernando Avila Gratz',\n        contact =\u003e {\n            phone =\u003e '+55 27 1234-5678',\n            email =\u003e 'cafe@example.com'\n        }\n    });\n\n    # print\n    print $document-\u003eas_html;\n\n# DESCRIPTION\n\nPlift is a HTML template engine which enforces strict separation of business logic\nfrom the view. It is designer friendly, safe, extensible and fast enough to\nbe used as a web request renderer. This engine tries to follow the principles\ndescribed in the paper _Enforcing Strict Model-View Separation in Template Engines_\nby Terence Parr of University of San Francisco. The goal is to provide suficient\npower without providing constructs that allow separation violations.\n\n# MANUAL\n\nThis document is the reference for the Plift class. The manual pages (not yet\ncomplete) are:\n\n- [Plift::Manual::Tutorial](https://metacpan.org/pod/Plift::Manual::Tutorial)\n\n    Step-by-step intruduction to Plift. \"Hello World\" style.\n\n- [Plift::Manual::DesignerFriendly](https://metacpan.org/pod/Plift::Manual::DesignerFriendly)\n\n    Pure HTML5 template files makes everything easier to write and better to maintain.\n    Designers can use their WYSIWYG editor, backend developers can unit test their\n    element renderers.\n\n- [Plift::Manual::Inception](https://metacpan.org/pod/Plift::Manual::Inception)\n\n    Talks about the web framework that inspired Plift, and its 'View-First'\n    approach to web request handling. (As opposed to the widespread 'Controller-First').\n\n- [Plift::Manual::CustomHandler](https://metacpan.org/pod/Plift::Manual::CustomHandler)\n\n    Explains how Plift is just an engine for reading/parsing HTML files, and\n    dispaching subroutine handlers bound to XPath expressions. You will learn how\n    to write your custom handlers using the same dispaching loop as the builtin\n    handlers.\n\n# METHODS\n\n## add\\_handler\n\n- Arguments: \\\\%parameters\n\nBinds a handler to one or more html tags, attributes, or xpath expression.\nValid parameters are:\n\n- tag\n\n    Scalar or arrayref of HTML tags bound to this handler.\n\n- attribute\n\n    Scalar or arrayref of HTML attributes bound to this handler.\n\n- xpath\n\n    XPath expression matching the nodes bound this handler.\n\nSee [Plift::Manual::CustomHandler](https://metacpan.org/pod/Plift::Manual::CustomHandler).\n\n## template\n\n    $context = $plift-\u003etemplate($template_name, \\%options)\n\nCreates a new [Plift::Context](https://metacpan.org/pod/Plift::Context) instance, which will load, process and render\ntemplate `$template_name`. See [\"at\" in Plift::Context](https://metacpan.org/pod/Plift::Context#at), [\"set\" in Plift::Context](https://metacpan.org/pod/Plift::Context#set) and\n[\"render\" in Plift::Context](https://metacpan.org/pod/Plift::Context#render).\n\n## process\n\n    $document = $plift-\u003eprocess($template_name, \\%data, \\@directives)\n\nA shortcut method.\nA new context is created via  [\"template\"](#template), rendering directives are set via\n[\"at\" in Plift::Context](https://metacpan.org/pod/Plift::Context#at) and finally the template is rendered via [\"render\" in Plift::Context](https://metacpan.org/pod/Plift::Context#render).\nReturns a [XML::LibXML::jQuery](https://metacpan.org/pod/XML::LibXML::jQuery) object representing the final processed document.\n\n    my %data = (\n        fullname =\u003e 'John Doe',\n        contact =\u003e {\n            phone =\u003e 123,\n            email =\u003e 'foo@example'\n        }\n    );\n\n    my @directives =\n        '#name' =\u003e 'fullname',\n        '#name@title' =\u003e 'fullname',\n        '#contact' =\u003e {\n            'contact' =\u003e [\n                '.phone' =\u003e 'phone',\n                '.email' =\u003e 'email',\n            ]\n    );\n\n    my $document = $plift-\u003eprocess('index', \\%data, \\@directives);\n\n    print $document-\u003eas_html;\n\n## render\n\n    $html = $plift-\u003erender($template_name, \\%data, \\@directives)\n\nA shortcut for `$plift-\u003eprocess()-\u003eas_html`.\n\n## load\\_components\n\n    $plift = $plift-\u003eload_components(@components)\n\nLoads one or more Plift components. For each component, we build a class name\nby prepending `Plift::` to the component name, then load the class, instantiate\na new object and call `$component-\u003eregister($self)`.\n\nSee [Plift::Manual::CustomHandler](https://metacpan.org/pod/Plift::Manual::CustomHandler).\n\n# SIMILAR PROJECTS\n\nThis is a list of modules (that I know of) that pursue similar goals:\n\n- [HTML::Template](https://metacpan.org/pod/HTML::Template)\n\n    Probably one of the first to use (almost) valid html files as templates, and\n    encourage less business logic to be embedded in the templates.\n\n- [Template::Pure](https://metacpan.org/pod/Template::Pure)\n\n    Perl implementation of Pure.js. This module inspired Plift's render directives.\n\n- [Template::Semantic](https://metacpan.org/pod/Template::Semantic)\n\n    Similar to Template::Pure, but the render directives points to the actual data\n    values, instead of datapoints. Which IMHO makes the work harder.\n\n- [Template::Flute](https://metacpan.org/pod/Template::Flute)\n\n    Uses a XML specification format for the rendering directives. Has lots of other\n    features.\n\n# LICENSE\n\nCopyright (C) Carlos Fernando Avila Gratz.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nCarlos Fernando Avila Gratz \u003ccafe@kreato.com.br\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafe01%2Ftemplate-plift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcafe01%2Ftemplate-plift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcafe01%2Ftemplate-plift/lists"}