History

Finish Nim scraper

Thibaut Courouble committed 9 years ago

Commit a4ba32e1 parent 09eea6617 files · +151 −135Browse files

Showing the changes to assets/javascripts (3 of 17 files). Show all

Unified · Split

3 files
  1. assets/javascripts/news.json +3 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. assets/javascripts/vendor/prism.js +40 −3
assets/javascripts/news.json+3−0
@@ -1,5 +1,8 @@
11 [
22 [
3+ "2017-09-03",
4+ "New documentation: <a href=\"/nim/\">Nim</a>"
5+ ], [
36 "2017-07-23",
47 "New documentation: <a href=\"/godot/\">Godot</a>"
58 ], [
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -423,6 +423,11 @@ credits = [ · 422 unmodified lines
423423 '2009-2016 Xiaozhe Wang (chaoslawful)<br>&copy; 2009-2017 Yichun "agentzh" Zhang (章亦春), OpenResty Inc.',
424424 'BSD',
425425 'https://github.com/openresty/lua-nginx-module#copyright-and-license'
426+ ], [
427+ 'Nim',
428+ '2006-2017 Andreas Rumpf',
429+ 'MIT',
430+ 'https://github.com/nim-lang/Nim#license'
426431 ], [
427432 'Node.js',
428433 'Joyent, Inc. and other Node contributors<br>Node.js is a trademark of Joyent, Inc.',
assets/javascripts/vendor/prism.js+40−3
@@ -1,4 +1,4 @@
1−/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+perl+php+python+crystal+rust+scss+sql+typescript */
1+/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+c+cpp+coffeescript+ruby+elixir+erlang+go+java+json+kotlin+lua+nginx+nim+perl+php+python+crystal+rust+scss+sql+typescript */
22 var _self = (typeof window !== 'undefined')
33 ? window // if in browser
44 : (
@@ -568,6 +568,9 @@ Prism.languages.markup = { · 563 unmodified lines
568568 'entity': /&#?[\da-z]{1,8};/i
569569 };
570570
571+Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
572+ Prism.languages.markup['entity'];
573+
571574 // Plugin to make entity title show the real entity, idea by Roman Komarov
572575 Prism.hooks.add('wrap', function(env) {
573576
@@ -664,7 +667,7 @@ Prism.languages.clike = { · 90 unmodified lines
664667
665668 Prism.languages.javascript = Prism.languages.extend('clike', {
666669 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
667− 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
670+ 'number': /\b-?(0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
668671 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
669672 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,
670673 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
@@ -672,7 +675,7 @@ Prism.languages.javascript = Prism.languages.extend('clike', { · 1 unmodified line
672675
673676 Prism.languages.insertBefore('javascript', 'keyword', {
674677 'regex': {
675− pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
678+ pattern: /(^|[^/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
676679 lookbehind: true,
677680 greedy: true
678681 }
@@ -710,6 +713,7 @@ if (Prism.languages.markup) { · 31 unmodified lines
710713 }
711714
712715 Prism.languages.js = Prism.languages.javascript;
716+
713717 Prism.languages.c = Prism.languages.extend('clike', {
714718 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
715719 'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/,
@@ -1245,6 +1249,39 @@ Prism.languages.nginx = Prism.languages.extend('clike', { · 529 unmodified lines
12451249 Prism.languages.insertBefore('nginx', 'keyword', {
12461250 'variable': /\$[a-z_]+/i
12471251 });
1252+Prism.languages.nim = {
1253+ 'comment': /#.*/,
1254+ // Double-quoted strings can be prefixed by an identifier (Generalized raw string literals)
1255+ // Character literals are handled specifically to prevent issues with numeric type suffixes
1256+ 'string': {
1257+ pattern: /(?:(?:\b(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")|'(?:\\(?:\d+|x[\da-fA-F]{2}|.)|[^'])')/,
1258+ greedy: true
1259+ },
1260+ // The negative look ahead prevents wrong highlighting of the .. operator
1261+ 'number': /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/,
1262+ 'keyword': /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/,
1263+ 'function': {
1264+ pattern: /(?:(?!\d)(?:\w|\\x[8-9a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/,
1265+ inside: {
1266+ 'operator': /\*$/
1267+ }
1268+ },
1269+ // We don't want to highlight operators inside backticks
1270+ 'ignore': {
1271+ pattern: /`[^`\r\n]+`/,
1272+ inside: {
1273+ 'punctuation': /`/
1274+ }
1275+ },
1276+ 'operator': {
1277+ // Look behind and look ahead prevent wrong highlighting of punctuations [. .] {. .} (. .)
1278+ // but allow the slice operator .. to take precedence over them
1279+ // One can define his own operators in Nim so all combination of operators might be an operator.
1280+ pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|of|or|in|is|isnot|mod|not|notin|shl|shr|xor)\b)/m,
1281+ lookbehind: true
1282+ },
1283+ 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/
1284+};
12481285 Prism.languages.perl = {
12491286 'comment': [
12501287 {