diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/highlight.js/lib/languages/yaml.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) | |
download | wallet-core-7a3df06eb573d36142bd1a8e03c5ce8752d300b3.tar.xz |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/highlight.js/lib/languages/yaml.js')
-rw-r--r-- | node_modules/highlight.js/lib/languages/yaml.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/node_modules/highlight.js/lib/languages/yaml.js b/node_modules/highlight.js/lib/languages/yaml.js new file mode 100644 index 000000000..585f12527 --- /dev/null +++ b/node_modules/highlight.js/lib/languages/yaml.js @@ -0,0 +1,87 @@ +module.exports = function(hljs) { + var LITERALS = 'true false yes no null'; + + var keyPrefix = '^[ \\-]*'; + var keyName = '[a-zA-Z_][\\w\\-]*'; + var KEY = { + className: 'attr', + variants: [ + { begin: keyPrefix + keyName + ":"}, + { begin: keyPrefix + '"' + keyName + '"' + ":"}, + { begin: keyPrefix + "'" + keyName + "'" + ":"} + ] + }; + + var TEMPLATE_VARIABLES = { + className: 'template-variable', + variants: [ + { begin: '\{\{', end: '\}\}' }, // jinja templates Ansible + { begin: '%\{', end: '\}' } // Ruby i18n + ] + }; + var STRING = { + className: 'string', + relevance: 0, + variants: [ + {begin: /'/, end: /'/}, + {begin: /"/, end: /"/}, + {begin: /\S+/} + ], + contains: [ + hljs.BACKSLASH_ESCAPE, + TEMPLATE_VARIABLES + ] + }; + + return { + case_insensitive: true, + aliases: ['yml', 'YAML', 'yaml'], + contains: [ + KEY, + { + className: 'meta', + begin: '^---\s*$', + relevance: 10 + }, + { // multi line string + className: 'string', + begin: '[\\|>] *$', + returnEnd: true, + contains: STRING.contains, + // very simple termination: next hash key + end: KEY.variants[0].begin + }, + { // Ruby/Rails erb + begin: '<%[%=-]?', end: '[%-]?%>', + subLanguage: 'ruby', + excludeBegin: true, + excludeEnd: true, + relevance: 0 + }, + { // data type + className: 'type', + begin: '!!' + hljs.UNDERSCORE_IDENT_RE, + }, + { // fragment id &ref + className: 'meta', + begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$', + }, + { // fragment reference *ref + className: 'meta', + begin: '\\*' + hljs.UNDERSCORE_IDENT_RE + '$' + }, + { // array listing + className: 'bullet', + begin: '^ *-', + relevance: 0 + }, + hljs.HASH_COMMENT_MODE, + { + beginKeywords: LITERALS, + keywords: {literal: LITERALS} + }, + hljs.C_NUMBER_MODE, + STRING + ] + }; +};
\ No newline at end of file |