java中简单的自定义标签解析
我有一个客户想要将视频、图像、表单元素等插入到他的文本中,同时保留tinymce 生成的html 元素。
我想到的一件事是创建特殊标签来让他执行此操作,然后使用接受输入的转换引擎 -> 。输出。
因此,对于视频标签,它可以注入必要的 JavaScript 来制作视频播放器(就像类似 YouTube 的播放器),对于图像,它只制作图像标签,对于表单元素,它创建输入标签。
对于表单,我认为使用 ${name} 就可以了。名称将是程序可以使用的值的唯一标识符。他只需要确保他没有重复它们。
我想对于图像和视频,我可以使用 BB 代码风格的标签,例如 [IMG] 和 [VIDEO]。
java 领域中是否已经有类似的东西,或者我是否必须从头开始编码?
I have a client that wants to insert videos, images, form elements, etc. into his text while also keeping html elements that tinymce generates.
One thing thing that came to mind is to create special tags that lets him do this, and then use a transformation engine that takes the input -> output.
So for a video tag, it could inject the necessary javascript to make the video player (like a youtube-like player), and for an image, it just makes an image tag and for a form element, it creates an input tag.
For the forms, I thought using ${name} would be alright. Name would be unique identifier for the value that the program could use. He's just have to make sure he didn't duplicate them.
I guess for images and video, I could use BB Code-style tags like [IMG] and [VIDEO].
Is there anything that already does stuff like this in the java space, or do I have to code it from scratch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个很好的可定制解析器,可以转换 BBCodes 或您自己的标签,例如 HTML:
http://kefir-bb .sourceforge.net/
A good customizable parser that can transform BBCodes or you're own tags in for example HTML:
http://kefir-bb.sourceforge.net/