该包最新版本(dev-master)没有可用的许可证信息。

inML - 内联标记语言

dev-master 2012-12-25 21:41 UTC

This package is not auto-updated.

Last update: 2024-09-14 12:44:34 UTC


README

inML是一种简洁直观的标记语言。本仓库包含inML标记语言的描述以及用于将inML格式文本渲染为HTML和文本格式的PHP库和示例脚本。

基本inML -> HTML转换规则

    1. 将具有样式的段落转换为具有类的HTML段落
.style            <p class="style">
Paragraph.   =>       Paragraph.
                  </p>
    1. 将具有样式的行转换为具有类的HTML span
.style Line        <span class="style">
OR            =>       Line
Line .style        </span>
    1. 将具有样式的单词转换为具有类的HTML span
                  <span class="style">
word.style   =>       word
                  </span>
    1. 如果解析器找到等于HTML5标签的样式,它将转换为相应的标签(不是类)
.div.style        <div class="style">
Paragraph.   =>       Paragraph.
                  </div>
    1. 您可以直接在文档中定义自己的样式。解析器将自动识别样式类型。例如,您可以通过定义具有url的自定义样式来创建超链接
inML.link is intuitive markup language.        
                                          =>   <a href="https://github.com/ptrofimov/inml">inML</a>
#link https://github.com/ptrofimov/inml            is intuitive markup language.

带有截图的示例

inML格式文本

.h1 inML - inline markup language

.i
inML.b is simple and compact markup
that could be easily transformed into HTML.b

.b Key points:

.ul
.li Easy text formatting
.li Traditional embedded HTML.b styles
.li Ability to add user styles

转换为HTML

<p>
    <h1>inML - inline markup language</h1>
</p>
<i>
    <b>inML</b> is simple and compact markup
        that could be easily transformed into <b>HTML</b>
</i>
<p>
    <b>Key points:</b>
</p>
<ul>
    <li>Easy text formatting</li>
    <li>Traditional embedded <b>HTML</b> styles</li>
    <li>Ability to add user styles</li>
</ul>

并看起来像这样(带有预定义的CSS样式)

Example inML to HTML transformation

安装和用法

    1. 如果需要,请安装composer
    1. 创建composer.json或添加依赖项
{
   "require":{
       "ptrofimov/inml":"*"
   }
}
    1. 安装包
composer install
    1. 使用示例
use \Inml\Text;
use \Inml\Render\Html;

$html = (new Html)->render(new Text($inml));
    1. 享受吧!