我正在使用带有Rails 2.1.1的RedCloth。纺织品<del>标签标记格式(即-delete-)根本没有转换。我试了几个选项。
> x=RedCloth.new('foobar -blah-')
=> "foobar -blah-"
> x.to_html
=> "<p>foobar <del>blah</del></p>" # WORKED!
> x=RedCloth.new('foobar * -blah-')
=> "foobar * -blah-"
> x.to_html
=> "<p>foobar * <del>blah</del></p>" # WORKED!
> x=RedCloth.new("foobar\n* -blah-")
=> "foobar\n* -blah-"
> x.to_html
=> "<p>foobar</p>\n<ul>\n\t<li>-blah-</li>\n</ul>" # DID NOT WORK!在我看来,换行符是引发RedCloth冲突的罪魁祸首。有什么解决方案可以让RedCloth正确识别'-delete-‘吗?我已经尝试过RedCloth 4.0.1、4.0.3和4.0.4。
发布于 2008-10-23 21:47:11
看起来RedCloth需要更多的语法来将delete标记解释为列表项之后的第一个元素……
>> RedCloth.new("foobar\n* [-blah-]").to_html
=> "<p>foobar</p>\n<ul>\n\t<li><del>blah</del></li>\n</ul>"发布于 2008-10-31 15:36:06
这是因为新行上的一个星号表示一个列表项,并且它忽略了删除标记,而没有显式地告诉它呈现它们,正如Michael指出的那样。
https://stackoverflow.com/questions/231512
复制相似问题