将 digest_custom_html 作为 HTML 处理(之前:覆盖 digest.html.erb)

该插件已部署,我可能很快就会忘记它,所以如果有人想按预期使用这些 digest_custom_html 字段,您可以将类似这样的代码添加到您的 app.yml 中以修补源。我太懒了,无法创建一个替换所有这些的正则表达式,而是只做了我正在使用的那个。请根据您的用例进行修改。

我在插件中创建了一个模板,然后可以将其包含在 app.yml 中。这比处理整个 yaml 块要容易一点。

hooks:
  after_code:
    - replace:
        filename: "/var/www/discourse/app/views/user_notifications/digest.html.erb"
        from: 'digest_custom_html("above_footer") '
        to: 'digest_custom_html("above_footer").html_safe '
1 个赞