CS-Notes/docs/_style/prism-master/components/prism-erb.js

20 lines
524 B
JavaScript
Raw Normal View History

2018-12-19 14:09:39 +08:00
(function (Prism) {
Prism.languages.erb = Prism.languages.extend('ruby', {});
Prism.languages.insertBefore('erb', 'comment', {
'delimiter': {
pattern: /^<%=?|%>$/,
alias: 'punctuation'
}
});
Prism.hooks.add('before-tokenize', function(env) {
var erbPattern = /<%=?[\s\S]+?%>/g;
Prism.languages['markup-templating'].buildPlaceholders(env, 'erb', erbPattern);
});
Prism.hooks.add('after-tokenize', function(env) {
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'erb');
});
}(Prism));