如何向htmlparser生成器添加其他元素 [英] How to add additional element to htmlparser generator

查看:87
本文介绍了如何向htmlparser生成器添加其他元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用吊索重写管道重写span标签属性中的链接。 htmlparser生成器仅调用 a,链接,脚本,img,表单,正文元素。如何在变压器中添加跨度之类的其他元素?配置示例非常棒!

I want to rewrite links in attributes of span tags with sling rewrite pipeline. The htmlparser generator only calls "a, link, script, img, form, body" elements. How can I add additional element like span to my transformer? An example configuration would be great!

我读到应该使用includeTags属性创建一个generator-htmlparser节点,但这是行不通的!我试图在/ apps / MY_APP / config / rewriter下创建此节点。

I read that a generator-htmlparser node should be created with the includeTags property, but it doesn't work! I tried to create this node under /apps/MY_APP/config/rewriter.

还有另一个generatorType(html-generator),它可以工作,但是它调用每个html元素,这对性能都不利。

There is also an other generatorType (html-generator), which works, but it calls on every html elements, which is not good for performance.

我使用AEM 5.6.1。

I use AEM 5.6.1.

感谢

推荐答案

解决方案:

在您的下面添加一个子节点重写器节点,其generatorType为generator-htmlparser:

Add a child node under your rewriter node, which generatorType is generator-htmlparser:

<generator-htmlparser jcr:primaryType="nt:unstructured" includeTags="[SPAN,/SPAN]"/>

在此配置下,它仅适用于span标签。标签名称必须为大写字母!

It will work only span tags with this configuration. The tag names must be capital letters!

这篇关于如何向htmlparser生成器添加其他元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆