appertly / axe
Appertly XHP Extras: Some useful XHP tags and utilities
Installs: 295
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Language:Hack
Requires
- hhvm: ~3.12
- facebook/xhp-lib: ~2.2
Requires (Dev)
- hackpack/hackunit: ~0.6
README
A ppertly X HP E xtras: Some useful XHP tags and utilities for Hack/HHVM.
Installation
You can install this library using Composer:
$ composer require appertly/axe
- The master branch (version 0.x) of this project requires HHVM 3.12 and depends on XHP 2.2+.
Compliance
Releases of this library will conform to Semantic Versioning.
Our code is intended to comply with PSR-1 and PSR-2. If you find any issues related to standards compliance, please send a pull request!
Features
Page + Layout
The class Axe\Page
allows collaborating classes to influence the tags that appear on a rendered page.
:axe:layout
takes a Axe\Page
object and renders a correct HTML document complete with DOCTYPE, html
, head
, and body
tags. Any settings in the Axe\Page
object will appear in the rendered :axe:layout
.
$page = new Axe\Page(); $page->setTitle('My example title') ->addBodyScript('/script.js') ->addBodyClasses(['foo', 'bar']) ->addStylesheet('/styles.css') ->addHeadScriptInline('console.log("Hello world!");'); $html = <axe:layout page={$page}><p>Hello world!</p></axe:layout>; echo (string)$html;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf8"> <title>My example title</title> <script>console.log("Hello world!");</script> <link rel="stylesheet" href="/styles.css"> </head> <body class="foo bar"> <p>Hello world!</p> <script src="/script.js"></script> </body> </html>
Helper Tags
We've included several helper tags for common stuff.
- Gravatar image
- Columns (and golden ratio columns)
- Bootstrap-compatible breadcrumbs, form groups, pagination, and fieldsets
- Nearly Bootstrap-compatible alerts
- Email and Phone Number links
- Convert text with line endings to multiple
<p>
s <select>
and<option>
s generated from aMap
of values<input type="checkbox">
or<input type="radio">
and<label>
s generated from aMap
of values- …and more!