sageit / markupengine
Allows you to create HTML custom tags that aids in templating and providing easy to use extendable functionality that designers find easy to work with.
Requires
- php: ^7.0
README
MarkupEngine
Allows you to create HTML markup tags that are rendered via class extensions to the included CustomMarkup Class. Markup intended for simple visual elements reaused throughout code and should not inlcude Database calls (separate of View and Modal)
View Demo · Report Bug · Request Feature
Table of Contents
About The Project
Built With
Getting Started
To get a local copy up and running follow these simple steps.
Installation
Git:
git clone https://github.com/SageITSolutions/MarkupEngine.git
Composer:
composer require sageit/markupengine
Usage
This project consists of an included MarkupEngine class which parses custom HTML tags into valid HTML.
Components:
- MarkupEngine.php class (parser)
- CustomMarkup.php class (abstract base class used by parser)
- tags/mytagname.php (customizable folder containing tag classes which must extend CustomMarkup)
Example Tag.
<header title="attribute"> This is an example block of code. This body would return as the Tag's "Content" while some would be an accessible attribute in the header class. </header> <youtube src="QR-tZqiKCrg"/>
Integrated Example
<?php require_once '../lib/MarkupEngine.php'; $ME = new MarkupEngine([] 'parse_on_shutdown' => true, 'tag_directory' => __DIR__.DIRECTORY_SEPARATOR.'tags'.DIRECTORY_SEPARATOR, 'sniff_for_buried_tags' => true ]); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Example Page</title> <meta name="author" content="Daniel S. Davis"> <!-- Date: 2020-10-06 --> </head> <body> <youtube src="QR-tZqiKCrg"/> </body> </html>
Inside the related tag file; tags/youtube.php:
<?php namespace MarkupEngine; class Youtube extends CustomMarkup{ public function render(){ return <<< HTML <iframe width="560" height="315" src="https://www.youtube.com/embed/{$this->src}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> HTML; } } ?>
Resulting output:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Example Page</title> <meta name="author" content="Daniel S. Davis"> <!-- Date: 2020-10-06 --> </head> <body> <iframe width="560" height="315" src="https://www.youtube.com/embed/QR-tZqiKCrg" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> </body> </html>
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Sage IT Solutions - Email
Project Link: https://github.com/SageITSolutions/MarkupEngine