YAML结构模板加工胶

yglu的Python项目详细描述


Build StatusPyPI version

* Try Yglu Online *

伊格卢瓦!?在

Yglu是用高级表达式语言扩充的YAML。与通常的文本模板不同,Yglu依赖于YAML结构,并利用其结合了YAQL查询语言的标记系统。在

这种关联支持模板化和函数化处理,有点像YAML节点是电子表格单元一样。在

Yglu输入文档是纯有效的YAML,使用tags作为计算节点。在

input ^{pr 1}$ output ^{pr 2}$
^{tb2}$

在上面的例子中,names序列是隐藏的,image是一个函数(类似于模板块),而{}是一个表达式,它迭代所有名称,将图像函数应用于每个名称,并通过将它们合并为一个映射来聚合各个结果。在

由于经常需要这样的操作,Yglu提供了一个!for标记,用于合并在函数上迭代的序列:

^{3}$

更多示例请参见测试samples。在

* Try Yglu Online *

安装

pip3 install yglu

Usage: yglu [options] [<filename>]

Options:
  -v - -version          Print version and exit.
  -h - -help             Print help and exit.

标签

标记指定文档结构的更改。在

TagDescription
^{}Evaluate an expression. The result can be a scalar, mapping or sequence. Can also be used in mapping keys.
^{}Hide the node in the output but keep it accessible from expressions. Can be an expression.
^{}Make the node reusable in expressions as a function.
^{}Conditional merge. See if.yml.
^{}Merge the results of a function applied to all items of a sequence . See for.yml.
^{}Apply a function or function block to a block. See function.yml.

表达式

表达式是用YAQL编写的。在

它们在定义了以下变量的上下文中进行计算:

VariableDescription
^{}Refers to the current document root. Can be omitted at the beginning of the expression if it starts with a dot.
^{}Implicit argument of functions.
^{}Gives access to environment variables. Disabled by default. Set the ^{} environment variable to enable this feature.
^{}Refers to the current function block node in order to access its children nodes. See function.yml

内置函数

除了standard YAQL library,Yglu还定义了以下函数:

FunctionDescription
^{}Imports another document in the current node. By default, it is only permitted to import files from within the directory hierarchy of the input file. Set ^{} to a list of permitted directories.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何从数组中打印int值?   prepared语句Java中奇怪的异常PreparedStatement:参数索引超出范围   封装如何在OOP Java中为主方法编码?   java某些手机显示快捷方式徽章需要什么权限?   java TextView不会随OnItemSelectedListener更改   java注释处理器不会自动触发吗?   java Spring JPA如何计算外键数   c#对于这个简单的OOAD问题,哪种设计最优雅?   java如何处理while循环中的异常?   Android Studio错误:进程'command'/home/draven/Downloads/安卓studio/jre/bin/java''结束,退出值为非零2   在使用Payara服务器的Vaadin应用程序中导航到根目录时,java将丢失上下文根目录   使用contentType application/json而不是application/jsonpatch+json的java修补程序   带有tomcat的java HAproxy连接不足   Java:在应用过滤器后创建一个简单的通用方法进行计数   java如何使用多态性创建一个实例化对象的方法,然后用它们高效地填充ArrayList?