提交 2735b9cf 编写于 作者: J Juanito Fatas

Fix guide anchor generation logic.

This could use in any translation because it's not limited to `[^a-z0-9]`.

Verify after this change, all guides still have same anchors.

[Robin Dupret & Juanito Fatas]
上级 33c05363
......@@ -47,7 +47,12 @@ def dom_id(nodes)
end
def dom_id_text(text)
text.downcase.gsub(/\?/, '-questionmark').gsub(/!/, '-bang').gsub(/[^a-z0-9]+/, ' ').strip.gsub(/\s+/, '-')
escaped_chars = Regexp.escape('\\/`*_{}[]()#+-.!:,;|&<>^~=\'"')
text.downcase.gsub(/\?/, '-questionmark')
.gsub(/!/, '-bang')
.gsub(/[#{escaped_chars}]+/, ' ').strip
.gsub(/\s+/, '-')
end
def engine
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册