将 Pharo 的语法突出显示引入网络
我想知道是否有办法在用 Iliad 编码的 Web 应用程序中获得 Pharo 的语法突出显示。
实际上,框架并不重要,因为我需要的是一个简单的 HTML 字符串:
<span style="color: rgb(102, 0, 0);">^</span> Set <span
style="color: rgb(0, 0, 153);">withAll:</span> <span
style="color: rgb(102, 0, 0);">self</span>
我猜这根本不是小事......:)
I'd like to know whether there's a way to get Pharo's syntax highlighting in a web app coded in Iliad.
Actually, the framework shouldn't matter, as what I'd need is a plain HTML string of the sort:
<span style="color: rgb(102, 0, 0);">^</span> Set <span
style="color: rgb(0, 0, 153);">withAll:</span> <span
style="color: rgb(102, 0, 0);">self</span>
I'm guessing this is not going to be trivial at all... :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
还有一个用于 pygments 的smalltalk 词法分析器,它比基于smalltalk 的替代方案具有更强的渗透性。
There is also a smalltalk lexer for pygments which has a bit more penetration than the smalltalk based alternatives.
Pier 支持语法高亮。可以在此处找到示例:http://book.seaside.st/。这是在 Pier-Shout 包中实现的(请参阅 Lukas Renggli 的 SqueakSource 存储库)。
Pier supports syntax highlighting. An example can be found here: http://book.seaside.st/. This is implemented in the package Pier-Shout (see Lukas Renggli's SqueakSource repository).
我们在 Pharo for Seaside 中编写了一个小但相当完整的语法荧光笔。它采用一个方法,解析它并输出带注释的 html。您只需在 css 中指定一些规则即可更改不同 AST 节点(选择器、字符串、符号、数字、关键字、变量)的颜色。
您可以在 WebDoc 项目中找到完整的示例.squeaksource.com/" rel="nofollow">squeaksource。查找
SourceFormatter
类,您需要的一切都在那里。We wrote a small, but rather complete syntax highlighter in Pharo for Seaside. It takes a method, parses it and outputs annotated html. You only have to specify some rules in css to change the color of the different AST nodes (selectors, strings, symbols, numbers, keywords, variables).
You will find a complete example in the WebDoc project on squeaksource. Look for the
SourceFormatter
class, everything you need is there.