我正在为基于 Jekyll 的网站编写 Redcarpet 的扩展。我想{x|y}
在降价中用作一个标签,它评估为 HTML<ruby>
标签(及其关联)。我按照Jekyll 的指南、Redcarpet 的指南以及如何做到这一点的指南编写了这门课:
class Jekyll::Converters::Markdown::HotelDown < Redcarpet::Render::HTML
def preprocess(doc)
s = "<ruby><rb>\\1</rb><rp>(</rp><rt>\\2</rt><rp>)</rp></ruby>"
doc.gsub!(/\[([\s\S]+)\|([\s\S]+)\]/, s)
doc
end
end
但是,当我运行时,我似乎遇到了几个错误bundle exec jekyll serve
:
Configuration file: C:/Users/Alex/OneDrive/codes/hotelc.me/hotelc.me/_config.yml
plugin_manager.rb:58:in `require': HotelDown.rb:4: syntax error, unexpected tIDENTIFIER, expecting ')' (SyntaxError)
doc.gs-ub!(/\[([\-s\S]+)\|([-\s\S]+)\]/-, s)
^
HotelDown.rb:4: syntax error, unexpected ')', expecting '='
doc.gs-ub!(/\[([\-s\S]+)\|([-\s\S]+)\]/-, s)
^
我的语法似乎有问题(额外的空格、缺少括号或类似的东西)。有什么我错过的吗?