From 740a64123899404278ce9ea98da6b8dce91d3329 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Wed, 21 Aug 2019 14:19:25 +0200 Subject: [PATCH] julia: enable syntax highlighting --- assets/javascripts/vendor/prism.js | 16 +++++++++++++++- lib/docs/filters/julia/clean_html.rb | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/vendor/prism.js b/assets/javascripts/vendor/prism.js index c2cbaadd..9e886921 100644 --- a/assets/javascripts/vendor/prism.js +++ b/assets/javascripts/vendor/prism.js @@ -1,5 +1,5 @@ /* PrismJS 1.17.1 -https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+java+php+json+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */ +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+d+dart+markup-templating+elixir+erlang+go+java+php+json+julia+kotlin+crystal+lua+django+matlab+typescript+nginx+nim+perl+sql+scss+python+jsx+rust+yaml */ var _self = (typeof window !== 'undefined') ? window // if in browser : ( @@ -1894,6 +1894,20 @@ Prism.languages.json = { } }; +Prism.languages.julia= { + 'comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true + }, + 'string': /("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2/, + 'keyword' : /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/, + 'boolean' : /\b(?:true|false)\b/, + 'number' : /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:[efp][+-]?\d+)?j?/i, + 'operator': /[-+*^%÷&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥]/, + 'punctuation' : /[{}[\];(),.:]/, + 'constant': /\b(?:(?:NaN|Inf)(?:16|32|64)?)\b/ +}; + (function (Prism) { Prism.languages.kotlin = Prism.languages.extend('clike', { 'keyword': { diff --git a/lib/docs/filters/julia/clean_html.rb b/lib/docs/filters/julia/clean_html.rb index 9c1096dc..00ebfb6d 100644 --- a/lib/docs/filters/julia/clean_html.rb +++ b/lib/docs/filters/julia/clean_html.rb @@ -21,6 +21,7 @@ module Docs css('pre').each do |node| node.content = node.content + node['data-language'] = 'julia' end doc