Browse Source

update python syntax highlighting

adam j hartz 8 months ago
parent
commit
bfa77fe786

+ 0
- 34
LICENSE.bundled_software View File

@@ -6,40 +6,6 @@ those pieces of software, separated by the string ######
6 6
 ########
7 7
 
8 8
 
9
-The CAT-SOOP distribution contains a verbatim copy of highlight.js, a
10
-Javascript library for syntax highlighting (https://highlightjs.org/), in the
11
-__STATIC__/scripts/highlight directory.  highlight.js is licensed according to
12
-the following terms:
13
-
14
-Copyright (c) 2006, Ivan Sagalaev
15
-All rights reserved.
16
-Redistribution and use in source and binary forms, with or without
17
-modification, are permitted provided that the following conditions are met:
18
-
19
-    * Redistributions of source code must retain the above copyright
20
-      notice, this list of conditions and the following disclaimer.
21
-    * Redistributions in binary form must reproduce the above copyright
22
-      notice, this list of conditions and the following disclaimer in the
23
-      documentation and/or other materials provided with the distribution.
24
-    * Neither the name of highlight.js nor the names of its contributors
25
-      may be used to endorse or promote products derived from this software
26
-      without specific prior written permission.
27
-
28
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
29
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
32
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
-
39
-
40
-########
41
-
42
-
43 9
 The CAT-SOOP distribution contains a verbatim copy of KaTeX, a Javascript
44 10
 library for fast math rendering in the browser (https://khan.github.io/KaTeX/),
45 11
 in the __STATIC__/scripts/katex directory.  Some fonts included with KaTeX are

+ 35
- 1
LICENSE.included_software View File

@@ -8,7 +8,7 @@ separated by the string ########
8 8
 
9 9
 CAT-SOOP contains a slightly modified version of DataURI.py, a Python module
10 10
 for handling data URI's (https://gist.github.com/zacharyvoase/5538178).
11
-DataURI.py is licensed according to the following terms:
11
+The original DataURI.py is licensed according to the following terms:
12 12
 
13 13
 This is free and unencumbered software released into the public domain.
14 14
 
@@ -39,6 +39,40 @@ For more information, please refer to <http://unlicense.org/>
39 39
 ########
40 40
 
41 41
 
42
+CAT-SOOP contains a slightly-modified version of highlight.js, a Javascript
43
+library for syntax highlighting (https://highlightjs.org/).  In particular,
44
+syntax highlighting of Python code was modified to include more built-in names.
45
+The original highlight.js is licensed according to the following terms:
46
+
47
+Copyright (c) 2006, Ivan Sagalaev
48
+All rights reserved.
49
+Redistribution and use in source and binary forms, with or without
50
+modification, are permitted provided that the following conditions are met:
51
+
52
+    * Redistributions of source code must retain the above copyright
53
+      notice, this list of conditions and the following disclaimer.
54
+    * Redistributions in binary form must reproduce the above copyright
55
+      notice, this list of conditions and the following disclaimer in the
56
+      documentation and/or other materials provided with the distribution.
57
+    * Neither the name of highlight.js nor the names of its contributors
58
+      may be used to endorse or promote products derived from this software
59
+      without specific prior written permission.
60
+
61
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
62
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
63
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
64
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
65
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
66
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
67
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
68
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
70
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71
+
72
+
73
+########
74
+
75
+
42 76
 CAT-SOOP contains a modified version of the literal_eval function from the AST
43 77
 module in the Python 3.5 standard library
44 78
 (https://docs.python.org/3/library/ast.html?highlight=ast#module-ast).  It was

__STATIC__/scripts/highlight/highlight.pack.js → __STATIC__/scripts/highlight/cs_highlight.pack.js View File

@@ -1,4 +1,23 @@
1
-/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */
1
+/*
2
+ * This file (a modified version of highlight.js) is part of CAT-SOOP
3
+ * Copyright (c) 2011-2018 Adam Hartz <hz@mit.edu>
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify it
6
+ * under the terms of the GNU Affero General Public License as published by the
7
+ * Free Software Foundation, either version 3 of the License, or (at your
8
+ * option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful, but WITHOUT
11
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License
13
+ * for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+// The original highlight.js v9.12.0 is available under a BSD 3-Clause License
20
+// (see git.io/hljslicense)
2 21
 (function(factory) {
3 22
 
4 23
   // Find the global object for export to both the browser and web workers.
@@ -812,7 +831,7 @@ hljs.registerLanguage('1c', function(hljs){
812 831
 
813 832
   // общий паттерн для определения идентификаторов
814 833
   var UNDERSCORE_IDENT_RE = '[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]+';
815
-  
834
+
816 835
   // v7 уникальные ключевые слова, отсутствующие в v8 ==> keyword
817 836
   var v7_keywords =
818 837
   'далее ';
@@ -824,7 +843,7 @@ hljs.registerLanguage('1c', function(hljs){
824 843
 
825 844
   // keyword : ключевые слова
826 845
   var KEYWORD = v7_keywords + v8_keywords;
827
-  
846
+
828 847
   // v7 уникальные директивы, отсутствующие в v8 ==> meta-keyword
829 848
   var v7_meta_keywords =
830 849
   'загрузитьизфайла ';
@@ -841,7 +860,7 @@ hljs.registerLanguage('1c', function(hljs){
841 860
   // v7 системные константы ==> built_in
842 861
   var v7_system_constants =
843 862
   'разделительстраниц разделительстрок символтабуляции ';
844
-  
863
+
845 864
   // v7 уникальные методы глобального контекста, отсутствующие в v8 ==> built_in
846 865
   var v7_global_context_methods =
847 866
   'ansitooem oemtoansi ввестивидсубконто ввестиперечисление ввестипериод ввестиплансчетов выбранныйплансчетов ' +
@@ -855,7 +874,7 @@ hljs.registerLanguage('1c', function(hljs){
855 874
   'префиксавтонумерации пропись пустоезначение разм разобратьпозициюдокумента рассчитатьрегистрына ' +
856 875
   'рассчитатьрегистрыпо симв создатьобъект статусвозврата стрколичествострок сформироватьпозициюдокумента ' +
857 876
   'счетпокоду текущеевремя типзначения типзначениястр установитьтана установитьтапо фиксшаблон шаблон ';
858
-  
877
+
859 878
   // v8 методы глобального контекста ==> built_in
860 879
   var v8_global_context_methods =
861 880
   'acos asin atan base64значение base64строка cos exp log log10 pow sin sqrt tan xmlзначение xmlстрока ' +
@@ -950,7 +969,7 @@ hljs.registerLanguage('1c', function(hljs){
950 969
   v7_system_constants +
951 970
   v7_global_context_methods + v8_global_context_methods +
952 971
   v8_global_context_property;
953
-  
972
+
954 973
   // v8 системные наборы значений ==> class
955 974
   var v8_system_sets_of_values =
956 975
   'webцвета windowsцвета windowsшрифты библиотекакартинок рамкистиля символы цветастиля шрифтыстиля ';
@@ -1102,7 +1121,7 @@ hljs.registerLanguage('1c', function(hljs){
1102 1121
   'кодировкаименфайловвzipфайле методсжатияzip методшифрованияzip режимвосстановленияпутейфайловzip режимобработкиподкаталоговzip ' +
1103 1122
   'режимсохраненияпутейzip уровеньсжатияzip ';
1104 1123
 
1105
-  // v8 системные перечисления - 
1124
+  // v8 системные перечисления -
1106 1125
   // Блокировка данных, Фоновые задания, Автоматизированное тестирование,
1107 1126
   // Доставляемые уведомления, Встроенные покупки, Интернет, Работа с двоичными данными ==> class
1108 1127
   var v8_system_enums_other =
@@ -1221,7 +1240,7 @@ hljs.registerLanguage('1c', function(hljs){
1221 1240
 
1222 1241
   // literal : примитивные типы
1223 1242
   var LITERAL = 'null истина ложь неопределено';
1224
-  
1243
+
1225 1244
   // number : числа
1226 1245
   var NUMBERS = hljs.inherit(hljs.NUMBER_MODE);
1227 1246
 
@@ -1242,10 +1261,10 @@ hljs.registerLanguage('1c', function(hljs){
1242 1261
       }
1243 1262
     ]
1244 1263
   };
1245
-  
1264
+
1246 1265
   // comment : комментарии
1247 1266
   var COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE);
1248
-  
1267
+
1249 1268
   // meta : инструкции препроцессора, директивы компиляции
1250 1269
   var META = {
1251 1270
     className: 'meta',
@@ -1256,13 +1275,13 @@ hljs.registerLanguage('1c', function(hljs){
1256 1275
       COMMENTS
1257 1276
     ]
1258 1277
   };
1259
-  
1278
+
1260 1279
   // symbol : метка goto
1261 1280
   var SYMBOL = {
1262 1281
     className: 'symbol',
1263 1282
     begin: '~', end: ';|:', excludeEnd: true
1264
-  };  
1265
-  
1283
+  };
1284
+
1266 1285
   // function : объявление процедур и функций
1267 1286
   var FUNCTION = {
1268 1287
     className: 'function',
@@ -1314,7 +1333,7 @@ hljs.registerLanguage('1c', function(hljs){
1314 1333
       NUMBERS,
1315 1334
       STRINGS,
1316 1335
       DATE
1317
-    ]  
1336
+    ]
1318 1337
   }
1319 1338
 });
1320 1339
 
@@ -2647,7 +2666,7 @@ hljs.registerLanguage('autohotkey', function(hljs) {
2647 2666
         //I don't really know if this is totally relevant
2648 2667
       },
2649 2668
       {
2650
-        className: 'meta', 
2669
+        className: 'meta',
2651 2670
         begin: '^\\s*#\w+', end:'$',
2652 2671
         relevance: 0
2653 2672
       },
@@ -4321,7 +4340,7 @@ hljs.registerLanguage('csp', function(hljs) {
4321 4340
     keywords: {
4322 4341
       keyword: 'base-uri child-src connect-src default-src font-src form-action' +
4323 4342
         ' frame-ancestors frame-src img-src media-src object-src plugin-types' +
4324
-        ' report-uri sandbox script-src style-src', 
4343
+        ' report-uri sandbox script-src style-src',
4325 4344
     },
4326 4345
     contains: [
4327 4346
     {
@@ -5996,7 +6015,7 @@ hljs.registerLanguage('excel', function(hljs) {
5996 6015
     },
5997 6016
     contains: [
5998 6017
       {
5999
-        /* matches a beginning equal sign found in Excel formula examples */ 
6018
+        /* matches a beginning equal sign found in Excel formula examples */
6000 6019
         begin: /^=/,
6001 6020
         end: /[^=]/, returnEnd: true, illegal: /=/, /* only allow single equal sign at front of line */
6002 6021
         relevance: 10
@@ -12046,7 +12065,7 @@ hljs.registerLanguage('powershell', function(hljs) {
12046 12065
   var PS_HELPTAGS = {
12047 12066
     className: 'doctag',
12048 12067
     variants: [
12049
-      /* no paramater help tags */ 
12068
+      /* no paramater help tags */
12050 12069
       { begin: /\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/ },
12051 12070
       /* one parameter help tags */
12052 12071
       { begin: /\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/ }
@@ -12468,7 +12487,30 @@ hljs.registerLanguage('python', function(hljs) {
12468 12487
       'exec else break not with class assert yield try while continue del or def lambda ' +
12469 12488
       'async await nonlocal|10 None True False',
12470 12489
     built_in:
12471
-      'Ellipsis NotImplemented'
12490
+      'ArithmeticError AssertionError AttributeError BaseException ' +
12491
+      'BlockingIOError BrokenPipeError BufferError BytesWarning ' +
12492
+      'ChildProcessError ConnectionAbortedError ConnectionError ' +
12493
+      'ConnectionRefusedError ConnectionResetError DeprecationWarning ' +
12494
+      'EOFError Ellipsis EnvironmentError Exception False FileExistsError ' +
12495
+      'FileNotFoundError FloatingPointError FutureWarning GeneratorExit ' +
12496
+      'IOError ImportError ImportWarning IndentationError IndexError ' +
12497
+      'InterruptedError IsADirectoryError KeyError KeyboardInterrupt ' +
12498
+      'LookupError MemoryError ModuleNotFoundError NameError None ' +
12499
+      'NotADirectoryError NotImplemented NotImplementedError OSError ' +
12500
+      'OverflowError PendingDeprecationWarning PermissionError ' +
12501
+      'ProcessLookupError RecursionError ReferenceError ResourceWarning ' +
12502
+      'RuntimeError RuntimeWarning StopAsyncIteration StopIteration ' +
12503
+      'SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError ' +
12504
+      'True TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError ' +
12505
+      'UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ' +
12506
+      'ValueError Warning ZeroDivisionError abs all any ascii bin bool ' +
12507
+      'bytearray bytes callable chr classmethod compile complex copyright ' +
12508
+      'credits delattr dict dir divmod enumerate eval exec exit filter float ' +
12509
+      'format frozenset getattr globals hasattr hash help hex id input int ' +
12510
+      'isinstance issubclass iter len license list locals map max memoryview ' +
12511
+      'min next object oct open ord pow print property quit range repr ' +
12512
+      'reversed round set setattr slice sorted staticmethod str sum super ' +
12513
+      'tuple type vars zip'
12472 12514
   };
12473 12515
   var PROMPT = {
12474 12516
     className: 'meta',  begin: /^(>>>|\.\.\.) /
@@ -12958,7 +13000,7 @@ function(hljs) {
12958 13000
   // ToDo: var PARAMETERS_PRINT = 'append as-value brief detail count-only file follow follow-only from interval terse value-list without-paging where info';
12959 13001
   // ToDo: var OPERATORS = '&& and ! not || or in ~ ^ & << >> + - * /';
12960 13002
   // ToDo: var TYPES = 'num number bool boolean str string ip ip6-prefix id time array';
12961
-  // ToDo: The following tokens serve as delimiters in the grammar: ()  []  {}  :   ;   $   / 
13003
+  // ToDo: The following tokens serve as delimiters in the grammar: ()  []  {}  :   ;   $   /
12962 13004
 
12963 13005
   var VAR_PREFIX = 'global local set for foreach';
12964 13006
 
@@ -12969,7 +13011,7 @@ function(hljs) {
12969 13011
       {begin: /\$\{(.*?)}/}
12970 13012
     ]
12971 13013
   };
12972
-  
13014
+
12973 13015
   var QUOTE_STRING = {
12974 13016
     className: 'string',
12975 13017
     begin: /"/, end: /"/,
@@ -12983,12 +13025,12 @@ function(hljs) {
12983 13025
       }
12984 13026
     ]
12985 13027
   };
12986
-  
13028
+
12987 13029
   var APOS_STRING = {
12988 13030
     className: 'string',
12989 13031
     begin: /'/, end: /'/
12990 13032
   };
12991
-  
13033
+
12992 13034
   var IPADDR = '((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b';
12993 13035
   var IPADDR_wBITMASK =  IPADDR+'/(3[0-2]|[1-2][0-9]|\\d)';
12994 13036
   //////////////////////////////////////////////////////////////////////
@@ -13012,7 +13054,7 @@ function(hljs) {
13012 13054
           { begin: /^\[\</, end: /\>\]$/, },        // F# class declaration?
13013 13055
           { begin: /<\//, end: />/, },              // HTML tags
13014 13056
           { begin: /^facet /, end: /\}/, },         // roboconf - лютый костыль )))
13015
-          { begin: '^1\\.\\.(\\d+)$', end: /$/, },  // tap  
13057
+          { begin: '^1\\.\\.(\\d+)$', end: /$/, },  // tap
13016 13058
         ],
13017 13059
         illegal: /./,
13018 13060
       },
@@ -13021,7 +13063,7 @@ function(hljs) {
13021 13063
       APOS_STRING,
13022 13064
       VAR,
13023 13065
       { // attribute=value
13024
-        begin: /[\w-]+\=([^\s\{\}\[\]\(\)]+)/, 
13066
+        begin: /[\w-]+\=([^\s\{\}\[\]\(\)]+)/,
13025 13067
         relevance: 0,
13026 13068
         returnBegin: true,
13027 13069
         contains: [
@@ -13030,7 +13072,7 @@ function(hljs) {
13030 13072
             begin: /[^=]+/
13031 13073
           },
13032 13074
           {
13033
-            begin: /=/, 
13075
+            begin: /=/,
13034 13076
             endsWithParent:  true,
13035 13077
             relevance: 0,
13036 13078
             contains: [
@@ -13057,7 +13099,7 @@ function(hljs) {
13057 13099
               }, //*/
13058 13100
               {
13059 13101
                 // Не форматировать не классифицированные значения. Необходимо для исключения подсветки значений как built_in.
13060
-                // className: 'number',  
13102
+                // className: 'number',
13061 13103
                 begin: /("[^"]*"|[^\s\{\}\[\]]+)/,
13062 13104
               }, //*/
13063 13105
             ]
@@ -13070,7 +13112,7 @@ function(hljs) {
13070 13112
         begin: /\*[0-9a-fA-F]+/,
13071 13113
       }, //*/
13072 13114
 
13073
-      { 
13115
+      {
13074 13116
         begin: '\\b(' + COMMON_COMMANDS.split(' ').join('|') + ')([\\s\[\(]|\])',
13075 13117
         returnBegin: true,
13076 13118
         contains: [
@@ -13078,10 +13120,10 @@ function(hljs) {
13078 13120
             className: 'builtin-name', //'function',
13079 13121
             begin: /\w+/,
13080 13122
           },
13081
-        ],  
13123
+        ],
13082 13124
       },
13083
-      
13084
-      { 
13125
+
13126
+      {
13085 13127
         className: 'built_in',
13086 13128
         variants: [
13087 13129
           {begin: '(\\.\\./|/|\\s)((' + OBJECTS.split(' ').join('|') + ');?\\s)+',relevance: 10,},

__STATIC__/scripts/highlight/cs_highlight.pack.min.js
File diff suppressed because it is too large
View File


+ 2
- 2
__STATIC__/templates/main.template View File

@@ -99,8 +99,8 @@
99 99
       <pre class="catsooplogo" style="font-size:50%;">{cs_base_logo_text}</pre>
100 100
       Powered by <a target='_blank' href='https://catsoop.mit.edu'>CAT-SOOP</a> {cs_version}.<br/>
101 101
       CAT-SOOP is <a href="http://www.fsf.org/about/what-is-free-software" target="_blank">free/libre software</a>, available under the terms<br/>of the <a href="BASE/_util/license" target="_blank">GNU Affero General Public License, version 3</a>.<br/>
102
-      <a href="BASE/_util/source.zip{cs_source_qstring}" download>Download Source Code</a><br/>
103
-      <a href="BASE/_util/jslicense.html" rel="jslicense">Javascript License Information</a>
102
+      <a href="BASE/_util/source.zip{cs_source_qstring}" download target="_blank">Download Source Code</a><br/>
103
+      <a href="BASE/_util/jslicense.html" rel="jslicense" target="_blank">Javascript License Information</a>
104 104
     </footer>
105 105
   </body>
106 106
 </html>

+ 3
- 3
__UTIL__/jslicense.html/content.xml View File

@@ -40,9 +40,9 @@ that are loaded by CAT-SOOP, including licensing information.
40 40
                   <td><a href="BASE/scripts/katex/katex.js">katex.js</a></td>
41 41
               </tr>
42 42
               <tr>
43
-                  <td><a href="BASE/scripts/highlight/highlight.pack.min.js">highlight.pack.min.js</a></td>
44
-                  <td><a href="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause</a></td>
45
-                  <td><a href="BASE/scripts/highlight/highlight.pack.js">highlight.pack.js</a></td>
43
+                  <td><a href="BASE/scripts/highlight/cs_highlight.pack.min.js">cs_highlight.pack.min.js</a></td>
44
+                  <td><a href="http://www.gnu.org/licenses/agpl-3.0.html">AGPL-3.0</a></td>
45
+                  <td><a href="BASE/scripts/highlight/cs_highlight.pack.js">cs_highlight.pack.js</a></td>
46 46
               </tr>
47 47
               <tr>
48 48
                   <td><a href="BASE/scripts/mathjax/MathJax.js">MathJax.js</a></td>

Loading…
Cancel
Save