Welcome to peml
an extensible, haml inspired markup for php
Introduction
peml is a markup pre-processor for PHP, that allows you to write more semantic code in less lines, and assists in styling through the clear layout of css selectors.
The peml core version has all the power necessary to represent essentially any HTML page, but the SCL (standard control library) adds the flow-control and variables of PHP into the mix, along with a host of shortcuts for common (long-winded) HTML.
Easy to start
peml is able to be run standalone, preprocessing your files and then serving them to the user. To see how this works, just look at the source of this file. This is just peml, with the SCL loaded.
peml
<?php $filepath = __FILE__;
require(getenv("DOCUMENT_ROOT") . "/peml/pemlRender.php"); ?>
:include menu.php
:doctype
html(lang:en)
head
meta(http-equiv: content-type `
content: text/html; charset=utf-8)
:css stylesheets/screen
:css IE stylesheets/ie
title peml :: a haml inspired markup language for php
body#peml
#container
#header
h1 peml
PHP
<?php include('menu.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type"
content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css"
href="stylesheets/screen.css"><![endif]-->
<!--[if IE]><link rel="stylesheet"
type="text/css" href="stylesheets/ie.css"><![endif]-->
<title>
peml :: a haml inspired markup language for php</title>
</head>
<body id="peml">
<div id="container">
<div id="header">
<h1>peml</h1>
</div>
Framework friendly
It's also easy to integrate into frameworks, and add framework-specific shortcuts and commands to. The control library for Yii (YiiCL) with the YiiML wrapper shows this in action.
Extensible
The language is also easily extensible for your own projects or sites needs. The actual tag syntax of peml is written in the same form as other extensions, making the core engine extremely customisable.
There are only 2 (or 3) fixed aspects of the core parser:
- The indentation style for delimiting blocks
- The idea that blocks only depend on themselves and (possibly) the type of block following them.
- The form that attributes take, but this can be changed if required by extending the pemlCore and writing your own overriding function.
Everything else can be done through your own extensions, including replacing the tag processing with your own scheme.