Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: lib/src/prism/components/prism-crystal.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-core.min.js ('k') | lib/src/prism/components/prism-crystal.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-crystal.js
diff --git a/lib/src/prism/components/prism-crystal.js b/lib/src/prism/components/prism-crystal.js
new file mode 100644
index 0000000000000000000000000000000000000000..66f24fb3024ab7f3cad9d54ac8d6ba0532da1fad
--- /dev/null
+++ b/lib/src/prism/components/prism-crystal.js
@@ -0,0 +1,53 @@
+(function(Prism) {
+ Prism.languages.crystal = Prism.languages.extend('ruby', {
+ keyword: [
+ /\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|ifdef|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|self|sizeof|struct|super|then|type|typeof|union|unless|until|when|while|with|yield|__DIR__|__FILE__|__LINE__)\b/,
+ {
+ pattern: /(\.\s*)(?:is_a|responds_to)\?/,
+ lookbehind: true
+ }
+ ],
+
+ number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[0-9a-fA-F_]*[0-9a-fA-F]|(?:[0-9](?:[0-9_]*[0-9])?)(?:\.[0-9_]*[0-9])?(?:[eE][+-]?[0-9_]*[0-9])?)(?:_(?:[uif](?:8|16|32|64))?)?\b/,
+ });
+
+ var rest = Prism.util.clone(Prism.languages.crystal);
+
+ Prism.languages.insertBefore('crystal', 'string', {
+ attribute: {
+ pattern: /@\[.+?\]/,
+ alias: 'attr-name',
+ inside: {
+ delimiter: {
+ pattern: /^@\[|\]$/,
+ alias: 'tag'
+ },
+ rest: rest
+ }
+ },
+
+ expansion: [
+ {
+ pattern: /\{\{.+?\}\}/,
+ inside: {
+ delimiter: {
+ pattern: /^\{\{|\}\}$/,
+ alias: 'tag'
+ },
+ rest: rest
+ }
+ },
+ {
+ pattern: /\{%.+?%\}/,
+ inside: {
+ delimiter: {
+ pattern: /^\{%|%\}$/,
+ alias: 'tag'
+ },
+ rest: rest
+ }
+ }
+ ]
+ });
+
+}(Prism));
« no previous file with comments | « lib/src/prism/components/prism-core.min.js ('k') | lib/src/prism/components/prism-crystal.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698