southnote-mini-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/app.js +22 -0
  2. package/app.json +53 -0
  3. package/app.wxss +15 -0
  4. package/assets/file/badwords.js +63008 -0
  5. package/assets/file/rules.js +38 -0
  6. package/assets/images/emoji/smile001.png +0 -0
  7. package/assets/images/emoji/smile002.png +0 -0
  8. package/assets/images/emoji/smile003.png +0 -0
  9. package/assets/images/emoji/smile004.png +0 -0
  10. package/assets/images/emoji/smile005.png +0 -0
  11. package/assets/images/emoji/smile006.png +0 -0
  12. package/assets/images/emoji/smile007.png +0 -0
  13. package/assets/images/emoji/smile008.png +0 -0
  14. package/assets/images/emoji/smile009.png +0 -0
  15. package/assets/images/emoji/smile010.png +0 -0
  16. package/assets/images/emoji/smile011.png +0 -0
  17. package/assets/images/emoji/smile012.png +0 -0
  18. package/assets/images/emoji/smile013.png +0 -0
  19. package/assets/images/emoji/smile014.png +0 -0
  20. package/assets/images/emoji/smile015.png +0 -0
  21. package/assets/images/emoji/smile016.png +0 -0
  22. package/assets/images/emoji/smile017.png +0 -0
  23. package/assets/images/emoji/smile018.png +0 -0
  24. package/assets/images/emoji/smile019.png +0 -0
  25. package/assets/images/emoji/smile020.png +0 -0
  26. package/assets/images/emoji/smile021.png +0 -0
  27. package/assets/images/emoji/smile022.png +0 -0
  28. package/assets/images/emoji/smile023.png +0 -0
  29. package/assets/images/emoji/smile024.png +0 -0
  30. package/assets/images/emoji/smile025.png +0 -0
  31. package/assets/images/emoji/smile026.png +0 -0
  32. package/assets/images/emoji/smile027.png +0 -0
  33. package/assets/images/emoji/smile028.png +0 -0
  34. package/assets/images/emoji/smile029.png +0 -0
  35. package/assets/images/emoji/smile030.png +0 -0
  36. package/assets/images/emoji/smile031.png +0 -0
  37. package/assets/images/emoji/smile032.png +0 -0
  38. package/assets/images/emoji/smile033.png +0 -0
  39. package/assets/images/emoji/smile034.png +0 -0
  40. package/assets/images/emoji/smile035.png +0 -0
  41. package/assets/images/emoji/smile036.png +0 -0
  42. package/assets/images/emoji/smile037.png +0 -0
  43. package/assets/images/emoji/smile038.png +0 -0
  44. package/assets/images/emoji/smile039.png +0 -0
  45. package/assets/images/emoji/smile040.png +0 -0
  46. package/assets/images/emoji/smile041.png +0 -0
  47. package/assets/images/emoji/smile042.png +0 -0
  48. package/assets/images/emoji/smile043.png +0 -0
  49. package/assets/images/emoji/smile044.png +0 -0
  50. package/assets/images/emoji/smile045.png +0 -0
  51. package/assets/images/emoji/smile046.png +0 -0
  52. package/assets/images/emoji/smile047.png +0 -0
  53. package/assets/images/emoji/smile048.png +0 -0
  54. package/assets/images/emoji/smile049.png +0 -0
  55. package/assets/images/emoji/smile050.png +0 -0
  56. package/assets/images/emoji/smile051.png +0 -0
  57. package/assets/images/emoji/smile052.png +0 -0
  58. package/assets/images/icons/age1.png +0 -0
  59. package/assets/images/icons/age2.png +0 -0
  60. package/assets/images/icons/age3.png +0 -0
  61. package/assets/images/icons/attachment.png +0 -0
  62. package/assets/images/icons/clear.png +0 -0
  63. package/assets/images/icons/edit_input.png +0 -0
  64. package/assets/images/icons/header_placeholder.png +0 -0
  65. package/assets/images/icons/home_collect.png +0 -0
  66. package/assets/images/icons/home_collected.png +0 -0
  67. package/assets/images/icons/home_comment.png +0 -0
  68. package/assets/images/icons/home_like.png +0 -0
  69. package/assets/images/icons/home_liked.png +0 -0
  70. package/assets/images/icons/home_message.png +0 -0
  71. package/assets/images/icons/home_share.png +0 -0
  72. package/assets/images/icons/icon_more.png +0 -0
  73. package/assets/images/icons/input_game.png +0 -0
  74. package/assets/images/icons/logo.png +0 -0
  75. package/assets/images/icons/lv1.png +0 -0
  76. package/assets/images/icons/lv2.png +0 -0
  77. package/assets/images/icons/lv3.png +0 -0
  78. package/assets/images/icons/lv4.png +0 -0
  79. package/assets/images/icons/search.png +0 -0
  80. package/assets/images/icons/sex1.png +0 -0
  81. package/assets/images/icons/sex2.png +0 -0
  82. package/assets/images/icons/sign_empty.png +0 -0
  83. package/assets/images/icons/sign_login.png +0 -0
  84. package/assets/wheel/wheel_bg.png +0 -0
  85. package/assets/wheel/wheel_bg2.png +0 -0
  86. package/assets/wheel/wheel_fore.png +0 -0
  87. package/assets/wheel/wheel_to.png +0 -0
  88. package/components/bottomSheet/bottomSheet.js +473 -0
  89. package/components/bottomSheet/bottomSheet.json +3 -0
  90. package/components/bottomSheet/bottomSheet.wxml +73 -0
  91. package/components/bottomSheet/bottomSheet.wxss +238 -0
  92. package/components/experience-item/experience-item.js +105 -0
  93. package/components/experience-item/experience-item.json +4 -0
  94. package/components/experience-item/experience-item.wxml +39 -0
  95. package/components/experience-item/experience-item.wxss +110 -0
  96. package/components/grid-item/grid-item.js +8 -0
  97. package/components/grid-item/grid-item.json +4 -0
  98. package/components/grid-item/grid-item.wxml +62 -0
  99. package/components/grid-item/grid-item.wxss +191 -0
  100. package/components/post-item/post-item.js +1085 -0
  101. package/components/post-item/post-item.json +4 -0
  102. package/components/post-item/post-item.wxml +427 -0
  103. package/components/post-item/post-item.wxss +525 -0
  104. package/components/wiki-renderer/wiki-renderer.js +636 -0
  105. package/components/wiki-renderer/wiki-renderer.json +12 -0
  106. package/components/wiki-renderer/wiki-renderer.wxml +150 -0
  107. package/components/wiki-renderer/wiki-renderer.wxss +412 -0
  108. package/components/wiki-tabs/wiki-tabs.js +52 -0
  109. package/components/wiki-tabs/wiki-tabs.json +3 -0
  110. package/components/wiki-tabs/wiki-tabs.wxml +28 -0
  111. package/components/wiki-tabs/wiki-tabs.wxss +43 -0
  112. package/index.js +49 -0
  113. package/package.json +35 -0
  114. package/pages/addGame/addGame.js +454 -0
  115. package/pages/addGame/addGame.json +3 -0
  116. package/pages/addGame/addGame.wxml +71 -0
  117. package/pages/addGame/addGame.wxss +110 -0
  118. package/pages/addSubject/addSubject.js +199 -0
  119. package/pages/addSubject/addSubject.json +4 -0
  120. package/pages/addSubject/addSubject.wxml +78 -0
  121. package/pages/addSubject/addSubject.wxss +85 -0
  122. package/pages/commonLogin/commonLogin.js +269 -0
  123. package/pages/commonLogin/commonLogin.json +4 -0
  124. package/pages/commonLogin/commonLogin.wxml +57 -0
  125. package/pages/commonLogin/commonLogin.wxss +177 -0
  126. package/pages/copyOfficial/copyOfficial.js +25 -0
  127. package/pages/copyOfficial/copyOfficial.json +3 -0
  128. package/pages/copyOfficial/copyOfficial.wxml +22 -0
  129. package/pages/copyOfficial/copyOfficial.wxss +49 -0
  130. package/pages/demo/demo.js +23 -0
  131. package/pages/demo/demo.json +3 -0
  132. package/pages/demo/demo.wxml +8 -0
  133. package/pages/demo/demo.wxss +24 -0
  134. package/pages/game/game.js +1254 -0
  135. package/pages/game/game.json +8 -0
  136. package/pages/game/game.wxml +371 -0
  137. package/pages/game/game.wxss +672 -0
  138. package/pages/home/home.js +665 -0
  139. package/pages/home/home.json +10 -0
  140. package/pages/home/home.wxml +115 -0
  141. package/pages/home/home.wxss +231 -0
  142. package/pages/lottery-winners/lottery-winners.js +60 -0
  143. package/pages/lottery-winners/lottery-winners.json +4 -0
  144. package/pages/lottery-winners/lottery-winners.wxml +53 -0
  145. package/pages/lottery-winners/lottery-winners.wxss +127 -0
  146. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.js +178 -0
  147. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.json +5 -0
  148. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.wxml +93 -0
  149. package/pages/message/messageCommentsAndAt/messageCommentsAndAt.wxss +177 -0
  150. package/pages/message/messageEntire/messageEntire.js +112 -0
  151. package/pages/message/messageEntire/messageEntire.json +4 -0
  152. package/pages/message/messageEntire/messageEntire.wxml +44 -0
  153. package/pages/message/messageEntire/messageEntire.wxss +88 -0
  154. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.js +147 -0
  155. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.json +5 -0
  156. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.wxml +84 -0
  157. package/pages/message/messageLikeAndCollect/messageLikeAndCollect.wxss +166 -0
  158. package/pages/message/messageNewFans/messageNewFans.js +139 -0
  159. package/pages/message/messageNewFans/messageNewFans.json +5 -0
  160. package/pages/message/messageNewFans/messageNewFans.wxml +35 -0
  161. package/pages/message/messageNewFans/messageNewFans.wxss +85 -0
  162. package/pages/officialWebview/officialWebview.js +13 -0
  163. package/pages/officialWebview/officialWebview.json +3 -0
  164. package/pages/officialWebview/officialWebview.wxml +2 -0
  165. package/pages/officialWebview/officialWebview.wxss +1 -0
  166. package/pages/post/post.js +1856 -0
  167. package/pages/post/post.json +6 -0
  168. package/pages/post/post.wxml +694 -0
  169. package/pages/post/post.wxss +1003 -0
  170. package/pages/post-editor/post-editor.js +465 -0
  171. package/pages/post-editor/post-editor.json +4 -0
  172. package/pages/post-editor/post-editor.wxml +63 -0
  173. package/pages/post-editor/post-editor.wxss +195 -0
  174. package/pages/postDialog/postDialog.js +560 -0
  175. package/pages/postDialog/postDialog.json +6 -0
  176. package/pages/postDialog/postDialog.wxml +377 -0
  177. package/pages/postDialog/postDialog.wxss +979 -0
  178. package/pages/report-category/report-category.js +29 -0
  179. package/pages/report-category/report-category.json +4 -0
  180. package/pages/report-category/report-category.wxml +14 -0
  181. package/pages/report-category/report-category.wxss +43 -0
  182. package/pages/report-form/report-form.js +65 -0
  183. package/pages/report-form/report-form.json +3 -0
  184. package/pages/report-form/report-form.wxml +11 -0
  185. package/pages/report-form/report-form.wxss +44 -0
  186. package/pages/sevenDaySignDetail/sevenDaySignDetail.js +273 -0
  187. package/pages/sevenDaySignDetail/sevenDaySignDetail.json +3 -0
  188. package/pages/sevenDaySignDetail/sevenDaySignDetail.wxml +82 -0
  189. package/pages/sevenDaySignDetail/sevenDaySignDetail.wxss +173 -0
  190. package/pages/topic/topic.js +266 -0
  191. package/pages/topic/topic.json +6 -0
  192. package/pages/topic/topic.wxml +77 -0
  193. package/pages/topic/topic.wxss +162 -0
  194. package/pages/user/user.js +939 -0
  195. package/pages/user/user.json +5 -0
  196. package/pages/user/user.wxml +179 -0
  197. package/pages/user/user.wxss +340 -0
  198. package/pages/userDatum/userDatum.js +24 -0
  199. package/pages/userDatum/userDatum.json +4 -0
  200. package/pages/userDatum/userDatum.wxml +36 -0
  201. package/pages/userDatum/userDatum.wxss +41 -0
  202. package/pages/userGameLib/userGameLib.js +105 -0
  203. package/pages/userGameLib/userGameLib.json +4 -0
  204. package/pages/userGameLib/userGameLib.wxml +42 -0
  205. package/pages/userGameLib/userGameLib.wxss +119 -0
  206. package/pages/webview/webview.js +25 -0
  207. package/pages/webview/webview.json +3 -0
  208. package/pages/webview/webview.wxml +22 -0
  209. package/pages/webview/webview.wxss +50 -0
  210. package/pages/wheelActivivty/wheelActivivty.js +492 -0
  211. package/pages/wheelActivivty/wheelActivivty.json +8 -0
  212. package/pages/wheelActivivty/wheelActivivty.wxml +131 -0
  213. package/pages/wheelActivivty/wheelActivivty.wxss +459 -0
  214. package/pages/wiki/wiki.js +138 -0
  215. package/pages/wiki/wiki.json +6 -0
  216. package/pages/wiki/wiki.wxml +20 -0
  217. package/pages/wiki/wiki.wxss +44 -0
  218. package/request/JKRequest.js +177 -0
  219. package/services/home.js +603 -0
  220. package/towxml/config.js +291 -0
  221. package/towxml/decode.js +35 -0
  222. package/towxml/decode.json +11 -0
  223. package/towxml/decode.wxml +137 -0
  224. package/towxml/decode.wxss +0 -0
  225. package/towxml/img/img.js +98 -0
  226. package/towxml/img/img.json +3 -0
  227. package/towxml/img/img.wxml +1 -0
  228. package/towxml/img/img.wxss +0 -0
  229. package/towxml/index.js +19 -0
  230. package/towxml/latex/latex.js +53 -0
  231. package/towxml/latex/latex.json +5 -0
  232. package/towxml/latex/latex.wxml +1 -0
  233. package/towxml/latex/latex.wxss +0 -0
  234. package/towxml/parse/highlight/highlight.js +1 -0
  235. package/towxml/parse/highlight/index.js +8 -0
  236. package/towxml/parse/highlight/languages/bash.js +111 -0
  237. package/towxml/parse/highlight/languages/c-like.js +236 -0
  238. package/towxml/parse/highlight/languages/c.js +22 -0
  239. package/towxml/parse/highlight/languages/css.js +132 -0
  240. package/towxml/parse/highlight/languages/dart.js +134 -0
  241. package/towxml/parse/highlight/languages/go.js +63 -0
  242. package/towxml/parse/highlight/languages/htmlbars.js +80 -0
  243. package/towxml/parse/highlight/languages/java.js +125 -0
  244. package/towxml/parse/highlight/languages/javascript.js +265 -0
  245. package/towxml/parse/highlight/languages/json.js +52 -0
  246. package/towxml/parse/highlight/languages/less.js +148 -0
  247. package/towxml/parse/highlight/languages/nginx.js +101 -0
  248. package/towxml/parse/highlight/languages/php.js +161 -0
  249. package/towxml/parse/highlight/languages/python-repl.js +29 -0
  250. package/towxml/parse/highlight/languages/python.js +131 -0
  251. package/towxml/parse/highlight/languages/scss.js +122 -0
  252. package/towxml/parse/highlight/languages/shell.js +22 -0
  253. package/towxml/parse/highlight/languages/typescript.js +215 -0
  254. package/towxml/parse/highlight/languages/xml.js +139 -0
  255. package/towxml/parse/highlight/style/github.wxss +99 -0
  256. package/towxml/parse/highlight/style/monokai.wxss +70 -0
  257. package/towxml/parse/index.js +118 -0
  258. package/towxml/parse/markdown/index.js +67 -0
  259. package/towxml/parse/markdown/markdown.js +4 -0
  260. package/towxml/parse/markdown/plugins/echarts.js +11 -0
  261. package/towxml/parse/markdown/plugins/emoji.js +2 -0
  262. package/towxml/parse/markdown/plugins/ins.js +1 -0
  263. package/towxml/parse/markdown/plugins/latex.js +158 -0
  264. package/towxml/parse/markdown/plugins/mark.js +1 -0
  265. package/towxml/parse/markdown/plugins/sub.js +1 -0
  266. package/towxml/parse/markdown/plugins/sup.js +1 -0
  267. package/towxml/parse/markdown/plugins/todo.js +147 -0
  268. package/towxml/parse/markdown/plugins/yuml.js +20 -0
  269. package/towxml/parse/parse2/Parser.js +492 -0
  270. package/towxml/parse/parse2/Tokenizer.js +903 -0
  271. package/towxml/parse/parse2/domelementtype/index.js +55 -0
  272. package/towxml/parse/parse2/domhandler/index.js +145 -0
  273. package/towxml/parse/parse2/domhandler/node.js +474 -0
  274. package/towxml/parse/parse2/entities/decode.js +179 -0
  275. package/towxml/parse/parse2/entities/decode_codepoint.js +60 -0
  276. package/towxml/parse/parse2/entities/encode.js +77 -0
  277. package/towxml/parse/parse2/entities/escape.js +112 -0
  278. package/towxml/parse/parse2/entities/generated/decode-data-html.js +9 -0
  279. package/towxml/parse/parse2/entities/generated/decode-data-xml.js +9 -0
  280. package/towxml/parse/parse2/entities/generated/encode-html.js +12 -0
  281. package/towxml/parse/parse2/entities/index.js +137 -0
  282. package/towxml/parse/parse2/index.js +8 -0
  283. package/towxml/style/main.wxss +419 -0
  284. package/towxml/style/theme/dark.wxss +73 -0
  285. package/towxml/style/theme/light.wxss +63 -0
  286. package/towxml/table/table.js +11 -0
  287. package/towxml/table/table.json +6 -0
  288. package/towxml/table/table.wxml +24 -0
  289. package/towxml/table/table.wxss +0 -0
  290. package/towxml/todogroup/todogroup.js +20 -0
  291. package/towxml/todogroup/todogroup.json +6 -0
  292. package/towxml/todogroup/todogroup.wxml +12 -0
  293. package/towxml/todogroup/todogroup.wxss +3 -0
  294. package/towxml/towxml.js +22 -0
  295. package/towxml/towxml.json +6 -0
  296. package/towxml/towxml.wxml +5 -0
  297. package/towxml/towxml.wxss +8 -0
  298. package/towxml/yuml/yuml.js +51 -0
  299. package/towxml/yuml/yuml.json +5 -0
  300. package/towxml/yuml/yuml.wxml +5 -0
  301. package/towxml/yuml/yuml.wxss +0 -0
  302. package/utils/auth.js +17 -0
  303. package/utils/base64.js +67 -0
  304. package/utils/compressImage.js +41 -0
  305. package/utils/exp.js +49 -0
  306. package/utils/formatPost.js +18 -0
  307. package/utils/parseContent.js +191 -0
  308. package/utils/query-select.js +9 -0
  309. package/utils/sensitive.js +82 -0
@@ -0,0 +1,148 @@
1
+ /*
2
+ Language: Less
3
+ Description: It's CSS, with just a little more.
4
+ Author: Max Mikhailov <seven.phases.max@gmail.com>
5
+ Website: http://lesscss.org
6
+ Category: common, css
7
+ */
8
+
9
+ export default function(hljs) {
10
+ var IDENT_RE = '[\\w-]+'; // yes, Less identifiers may begin with a digit
11
+ var INTERP_IDENT_RE = '(' + IDENT_RE + '|@{' + IDENT_RE + '})';
12
+
13
+ /* Generic Modes */
14
+
15
+ var RULES = [], VALUE = []; // forward def. for recursive modes
16
+
17
+ var STRING_MODE = function(c) { return {
18
+ // Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
19
+ className: 'string', begin: '~?' + c + '.*?' + c
20
+ };};
21
+
22
+ var IDENT_MODE = function(name, begin, relevance) { return {
23
+ className: name, begin: begin, relevance: relevance
24
+ };};
25
+
26
+ var PARENS_MODE = {
27
+ // used only to properly balance nested parens inside mixin call, def. arg list
28
+ begin: '\\(', end: '\\)', contains: VALUE, relevance: 0
29
+ };
30
+
31
+ // generic Less highlighter (used almost everywhere except selectors):
32
+ VALUE.push(
33
+ hljs.C_LINE_COMMENT_MODE,
34
+ hljs.C_BLOCK_COMMENT_MODE,
35
+ STRING_MODE("'"),
36
+ STRING_MODE('"'),
37
+ hljs.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
38
+ {
39
+ begin: '(url|data-uri)\\(',
40
+ starts: {className: 'string', end: '[\\)\\n]', excludeEnd: true}
41
+ },
42
+ IDENT_MODE('number', '#[0-9A-Fa-f]+\\b'),
43
+ PARENS_MODE,
44
+ IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
45
+ IDENT_MODE('variable', '@{' + IDENT_RE + '}'),
46
+ IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
47
+ { // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
48
+ className: 'attribute', begin: IDENT_RE + '\\s*:', end: ':', returnBegin: true, excludeEnd: true
49
+ },
50
+ {
51
+ className: 'meta',
52
+ begin: '!important'
53
+ }
54
+ );
55
+
56
+ var VALUE_WITH_RULESETS = VALUE.concat({
57
+ begin: '{', end: '}', contains: RULES
58
+ });
59
+
60
+ var MIXIN_GUARD_MODE = {
61
+ beginKeywords: 'when', endsWithParent: true,
62
+ contains: [{beginKeywords: 'and not'}].concat(VALUE) // using this form to override VALUE’s 'function' match
63
+ };
64
+
65
+ /* Rule-Level Modes */
66
+
67
+ var RULE_MODE = {
68
+ begin: INTERP_IDENT_RE + '\\s*:', returnBegin: true, end: '[;}]',
69
+ relevance: 0,
70
+ contains: [
71
+ {
72
+ className: 'attribute',
73
+ begin: INTERP_IDENT_RE, end: ':', excludeEnd: true,
74
+ starts: {
75
+ endsWithParent: true, illegal: '[<=$]',
76
+ relevance: 0,
77
+ contains: VALUE
78
+ }
79
+ }
80
+ ]
81
+ };
82
+
83
+ var AT_RULE_MODE = {
84
+ className: 'keyword',
85
+ begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
86
+ starts: {end: '[;{}]', returnEnd: true, contains: VALUE, relevance: 0}
87
+ };
88
+
89
+ // variable definitions and calls
90
+ var VAR_RULE_MODE = {
91
+ className: 'variable',
92
+ variants: [
93
+ // using more strict pattern for higher relevance to increase chances of Less detection.
94
+ // this is *the only* Less specific statement used in most of the sources, so...
95
+ // (we’ll still often loose to the css-parser unless there's '//' comment,
96
+ // simply because 1 variable just can't beat 99 properties :)
97
+ {begin: '@' + IDENT_RE + '\\s*:', relevance: 15},
98
+ {begin: '@' + IDENT_RE}
99
+ ],
100
+ starts: {end: '[;}]', returnEnd: true, contains: VALUE_WITH_RULESETS}
101
+ };
102
+
103
+ var SELECTOR_MODE = {
104
+ // first parse unambiguous selectors (i.e. those not starting with tag)
105
+ // then fall into the scary lookahead-discriminator variant.
106
+ // this mode also handles mixin definitions and calls
107
+ variants: [{
108
+ begin: '[\\.#:&\\[>]', end: '[;{}]' // mixin calls end with ';'
109
+ }, {
110
+ begin: INTERP_IDENT_RE, end: '{'
111
+ }],
112
+ returnBegin: true,
113
+ returnEnd: true,
114
+ illegal: '[<=\'$"]',
115
+ relevance: 0,
116
+ contains: [
117
+ hljs.C_LINE_COMMENT_MODE,
118
+ hljs.C_BLOCK_COMMENT_MODE,
119
+ MIXIN_GUARD_MODE,
120
+ IDENT_MODE('keyword', 'all\\b'),
121
+ IDENT_MODE('variable', '@{' + IDENT_RE + '}'), // otherwise it’s identified as tag
122
+ IDENT_MODE('selector-tag', INTERP_IDENT_RE + '%?', 0), // '%' for more consistent coloring of @keyframes "tags"
123
+ IDENT_MODE('selector-id', '#' + INTERP_IDENT_RE),
124
+ IDENT_MODE('selector-class', '\\.' + INTERP_IDENT_RE, 0),
125
+ IDENT_MODE('selector-tag', '&', 0),
126
+ {className: 'selector-attr', begin: '\\[', end: '\\]'},
127
+ {className: 'selector-pseudo', begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},
128
+ {begin: '\\(', end: '\\)', contains: VALUE_WITH_RULESETS}, // argument list of parametric mixins
129
+ {begin: '!important'} // eat !important after mixin call or it will be colored as tag
130
+ ]
131
+ };
132
+
133
+ RULES.push(
134
+ hljs.C_LINE_COMMENT_MODE,
135
+ hljs.C_BLOCK_COMMENT_MODE,
136
+ AT_RULE_MODE,
137
+ VAR_RULE_MODE,
138
+ RULE_MODE,
139
+ SELECTOR_MODE
140
+ );
141
+
142
+ return {
143
+ name: 'Less',
144
+ case_insensitive: true,
145
+ illegal: '[=>\'/<($"]',
146
+ contains: RULES
147
+ };
148
+ }
@@ -0,0 +1,101 @@
1
+ /*
2
+ Language: Nginx config
3
+ Author: Peter Leonov <gojpeg@yandex.ru>
4
+ Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
5
+ Category: common, config
6
+ Website: https://www.nginx.com
7
+ */
8
+
9
+ export default function(hljs) {
10
+ var VAR = {
11
+ className: 'variable',
12
+ variants: [
13
+ {begin: /\$\d+/},
14
+ {begin: /\$\{/, end: /}/},
15
+ {begin: '[\\$\\@]' + hljs.UNDERSCORE_IDENT_RE}
16
+ ]
17
+ };
18
+ var DEFAULT = {
19
+ endsWithParent: true,
20
+ lexemes: '[a-z/_]+',
21
+ keywords: {
22
+ literal:
23
+ 'on off yes no true false none blocked debug info notice warn error crit ' +
24
+ 'select break last permanent redirect kqueue rtsig epoll poll /dev/poll'
25
+ },
26
+ relevance: 0,
27
+ illegal: '=>',
28
+ contains: [
29
+ hljs.HASH_COMMENT_MODE,
30
+ {
31
+ className: 'string',
32
+ contains: [hljs.BACKSLASH_ESCAPE, VAR],
33
+ variants: [
34
+ {begin: /"/, end: /"/},
35
+ {begin: /'/, end: /'/}
36
+ ]
37
+ },
38
+ // this swallows entire URLs to avoid detecting numbers within
39
+ {
40
+ begin: '([a-z]+):/', end: '\\s', endsWithParent: true, excludeEnd: true,
41
+ contains: [VAR]
42
+ },
43
+ {
44
+ className: 'regexp',
45
+ contains: [hljs.BACKSLASH_ESCAPE, VAR],
46
+ variants: [
47
+ {begin: "\\s\\^", end: "\\s|{|;", returnEnd: true},
48
+ // regexp locations (~, ~*)
49
+ {begin: "~\\*?\\s+", end: "\\s|{|;", returnEnd: true},
50
+ // *.example.com
51
+ {begin: "\\*(\\.[a-z\\-]+)+"},
52
+ // sub.example.*
53
+ {begin: "([a-z\\-]+\\.)+\\*"}
54
+ ]
55
+ },
56
+ // IP
57
+ {
58
+ className: 'number',
59
+ begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
60
+ },
61
+ // units
62
+ {
63
+ className: 'number',
64
+ begin: '\\b\\d+[kKmMgGdshdwy]*\\b',
65
+ relevance: 0
66
+ },
67
+ VAR
68
+ ]
69
+ };
70
+
71
+ return {
72
+ name: 'Nginx config',
73
+ aliases: ['nginxconf'],
74
+ contains: [
75
+ hljs.HASH_COMMENT_MODE,
76
+ {
77
+ begin: hljs.UNDERSCORE_IDENT_RE + '\\s+{', returnBegin: true,
78
+ end: '{',
79
+ contains: [
80
+ {
81
+ className: 'section',
82
+ begin: hljs.UNDERSCORE_IDENT_RE
83
+ }
84
+ ],
85
+ relevance: 0
86
+ },
87
+ {
88
+ begin: hljs.UNDERSCORE_IDENT_RE + '\\s', end: ';|{', returnBegin: true,
89
+ contains: [
90
+ {
91
+ className: 'attribute',
92
+ begin: hljs.UNDERSCORE_IDENT_RE,
93
+ starts: DEFAULT
94
+ }
95
+ ],
96
+ relevance: 0
97
+ }
98
+ ],
99
+ illegal: '[^\\s\\}]'
100
+ };
101
+ }
@@ -0,0 +1,161 @@
1
+ /*
2
+ Language: PHP
3
+ Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
4
+ Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Ivan Sagalaev <maniac@softwaremaniacs.org>
5
+ Website: https://www.php.net
6
+ Category: common
7
+ */
8
+
9
+ export default function(hljs) {
10
+ var VARIABLE = {
11
+ begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
12
+ };
13
+ var PREPROCESSOR = {
14
+ className: 'meta',
15
+ variants: [
16
+ { begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
17
+ { begin: /<\?[=]?/ },
18
+ { begin: /\?>/ } // end php tag
19
+ ]
20
+ };
21
+ var STRING = {
22
+ className: 'string',
23
+ contains: [hljs.BACKSLASH_ESCAPE, PREPROCESSOR],
24
+ variants: [
25
+ {
26
+ begin: 'b"', end: '"'
27
+ },
28
+ {
29
+ begin: 'b\'', end: '\''
30
+ },
31
+ hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
32
+ hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})
33
+ ]
34
+ };
35
+ var NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]};
36
+ var KEYWORDS = {
37
+ keyword:
38
+ // Magic constants:
39
+ // <https://www.php.net/manual/en/language.constants.predefined.php>
40
+ '__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ ' +
41
+ // Function that look like language construct or language construct that look like function:
42
+ // List of keywords that may not require parenthesis
43
+ 'die echo exit include include_once print require require_once ' +
44
+ // These are not language construct (function) but operate on the currently-executing function and can access the current symbol table
45
+ // 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' +
46
+ // Other keywords:
47
+ // <https://www.php.net/manual/en/reserved.php>
48
+ // <https://www.php.net/manual/en/language.types.type-juggling.php>
49
+ 'array abstract and as binary bool boolean break callable case catch class clone const continue declare default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval extends final finally float for foreach from global goto if implements instanceof insteadof int integer interface isset iterable list new object or private protected public real return string switch throw trait try unset use var void while xor yield',
50
+ literal: 'false null true',
51
+ built_in:
52
+ // Standard PHP library:
53
+ // <https://www.php.net/manual/en/book.spl.php>
54
+ 'Error|0 ' + // error is too common a name esp since PHP is case in-sensitive
55
+ 'AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException ' +
56
+ // Reserved interfaces:
57
+ // <https://www.php.net/manual/en/reserved.interfaces.php>
58
+ 'ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Throwable Traversable WeakReference ' +
59
+ // Reserved classes:
60
+ // <https://www.php.net/manual/en/reserved.classes.php>
61
+ 'Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass'
62
+ };
63
+ return {
64
+ aliases: ['php', 'php3', 'php4', 'php5', 'php6', 'php7'],
65
+ case_insensitive: true,
66
+ keywords: KEYWORDS,
67
+ contains: [
68
+ hljs.HASH_COMMENT_MODE,
69
+ hljs.COMMENT('//', '$', {contains: [PREPROCESSOR]}),
70
+ hljs.COMMENT(
71
+ '/\\*',
72
+ '\\*/',
73
+ {
74
+ contains: [
75
+ {
76
+ className: 'doctag',
77
+ begin: '@[A-Za-z]+'
78
+ }
79
+ ]
80
+ }
81
+ ),
82
+ hljs.COMMENT(
83
+ '__halt_compiler.+?;',
84
+ false,
85
+ {
86
+ endsWithParent: true,
87
+ keywords: '__halt_compiler',
88
+ lexemes: hljs.UNDERSCORE_IDENT_RE
89
+ }
90
+ ),
91
+ {
92
+ className: 'string',
93
+ begin: /<<<['"]?\w+['"]?$/, end: /^\w+;?$/,
94
+ contains: [
95
+ hljs.BACKSLASH_ESCAPE,
96
+ {
97
+ className: 'subst',
98
+ variants: [
99
+ {begin: /\$\w+/},
100
+ {begin: /\{\$/, end: /\}/}
101
+ ]
102
+ }
103
+ ]
104
+ },
105
+ PREPROCESSOR,
106
+ {
107
+ className: 'keyword', begin: /\$this\b/
108
+ },
109
+ VARIABLE,
110
+ {
111
+ // swallow composed identifiers to avoid parsing them as keywords
112
+ begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
113
+ },
114
+ {
115
+ className: 'function',
116
+ beginKeywords: 'fn function', end: /[;{]/, excludeEnd: true,
117
+ illegal: '[$%\\[]',
118
+ contains: [
119
+ hljs.UNDERSCORE_TITLE_MODE,
120
+ {
121
+ className: 'params',
122
+ begin: '\\(', end: '\\)',
123
+ excludeBegin: true,
124
+ excludeEnd: true,
125
+ keywords: KEYWORDS,
126
+ contains: [
127
+ 'self',
128
+ VARIABLE,
129
+ hljs.C_BLOCK_COMMENT_MODE,
130
+ STRING,
131
+ NUMBER
132
+ ]
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ className: 'class',
138
+ beginKeywords: 'class interface', end: '{', excludeEnd: true,
139
+ illegal: /[:\(\$"]/,
140
+ contains: [
141
+ {beginKeywords: 'extends implements'},
142
+ hljs.UNDERSCORE_TITLE_MODE
143
+ ]
144
+ },
145
+ {
146
+ beginKeywords: 'namespace', end: ';',
147
+ illegal: /[\.']/,
148
+ contains: [hljs.UNDERSCORE_TITLE_MODE]
149
+ },
150
+ {
151
+ beginKeywords: 'use', end: ';',
152
+ contains: [hljs.UNDERSCORE_TITLE_MODE]
153
+ },
154
+ {
155
+ begin: '=>' // No markup, just a relevance booster
156
+ },
157
+ STRING,
158
+ NUMBER
159
+ ]
160
+ };
161
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ Language: Python REPL
3
+ Requires: python.js
4
+ Author: Josh Goebel <hello@joshgoebel.com>
5
+ Category: common
6
+ */
7
+
8
+ export default function(hljs) {
9
+ return {
10
+ aliases: ['pycon'],
11
+ contains: [
12
+ {
13
+ className: 'meta',
14
+ starts: {
15
+ // a space separates the REPL prefix from the actual code
16
+ // this is purely for cleaner HTML output
17
+ end: / |$/,
18
+ starts: {
19
+ end: '$', subLanguage: 'python'
20
+ }
21
+ },
22
+ variants: [
23
+ { begin: /^>>>(?=[ ]|$)/ },
24
+ { begin: /^\.\.\.(?=[ ]|$)/ }
25
+ ]
26
+ },
27
+ ]
28
+ }
29
+ }
@@ -0,0 +1,131 @@
1
+ /*
2
+ Language: Python
3
+ Description: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
4
+ Website: https://www.python.org
5
+ Category: common
6
+ */
7
+
8
+ export default function(hljs) {
9
+ var KEYWORDS = {
10
+ keyword:
11
+ 'and elif is global as in if from raise for except finally print import pass return ' +
12
+ 'exec else break not with class assert yield try while continue del or def lambda ' +
13
+ 'async await nonlocal|10',
14
+ built_in:
15
+ 'Ellipsis NotImplemented',
16
+ literal: 'False None True'
17
+ };
18
+ var PROMPT = {
19
+ className: 'meta', begin: /^(>>>|\.\.\.) /
20
+ };
21
+ var SUBST = {
22
+ className: 'subst',
23
+ begin: /\{/, end: /\}/,
24
+ keywords: KEYWORDS,
25
+ illegal: /#/
26
+ };
27
+ var LITERAL_BRACKET = {
28
+ begin: /\{\{/,
29
+ relevance: 0
30
+ };
31
+ var STRING = {
32
+ className: 'string',
33
+ contains: [hljs.BACKSLASH_ESCAPE],
34
+ variants: [
35
+ {
36
+ begin: /(u|b)?r?'''/, end: /'''/,
37
+ contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
38
+ relevance: 10
39
+ },
40
+ {
41
+ begin: /(u|b)?r?"""/, end: /"""/,
42
+ contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
43
+ relevance: 10
44
+ },
45
+ {
46
+ begin: /(fr|rf|f)'''/, end: /'''/,
47
+ contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
48
+ },
49
+ {
50
+ begin: /(fr|rf|f)"""/, end: /"""/,
51
+ contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
52
+ },
53
+ {
54
+ begin: /(u|r|ur)'/, end: /'/,
55
+ relevance: 10
56
+ },
57
+ {
58
+ begin: /(u|r|ur)"/, end: /"/,
59
+ relevance: 10
60
+ },
61
+ {
62
+ begin: /(b|br)'/, end: /'/
63
+ },
64
+ {
65
+ begin: /(b|br)"/, end: /"/
66
+ },
67
+ {
68
+ begin: /(fr|rf|f)'/, end: /'/,
69
+ contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
70
+ },
71
+ {
72
+ begin: /(fr|rf|f)"/, end: /"/,
73
+ contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
74
+ },
75
+ hljs.APOS_STRING_MODE,
76
+ hljs.QUOTE_STRING_MODE
77
+ ]
78
+ };
79
+ var NUMBER = {
80
+ className: 'number', relevance: 0,
81
+ variants: [
82
+ {begin: hljs.BINARY_NUMBER_RE + '[lLjJ]?'},
83
+ {begin: '\\b(0o[0-7]+)[lLjJ]?'},
84
+ {begin: hljs.C_NUMBER_RE + '[lLjJ]?'}
85
+ ]
86
+ };
87
+ var PARAMS = {
88
+ className: 'params',
89
+ begin: /\(/, end: /\)/,
90
+ contains: ['self', PROMPT, NUMBER, STRING, hljs.HASH_COMMENT_MODE]
91
+ };
92
+ SUBST.contains = [STRING, NUMBER, PROMPT];
93
+ return {
94
+ name: 'Python',
95
+ aliases: ['py', 'gyp', 'ipython'],
96
+ keywords: KEYWORDS,
97
+ illegal: /(<\/|->|\?)|=>/,
98
+ contains: [
99
+ PROMPT,
100
+ NUMBER,
101
+ // eat "if" prior to string so that it won't accidentally be
102
+ // labeled as an f-string as in:
103
+ { beginKeywords: "if", relevance: 0 },
104
+ STRING,
105
+ hljs.HASH_COMMENT_MODE,
106
+ {
107
+ variants: [
108
+ {className: 'function', beginKeywords: 'def'},
109
+ {className: 'class', beginKeywords: 'class'}
110
+ ],
111
+ end: /:/,
112
+ illegal: /[${=;\n,]/,
113
+ contains: [
114
+ hljs.UNDERSCORE_TITLE_MODE,
115
+ PARAMS,
116
+ {
117
+ begin: /->/, endsWithParent: true,
118
+ keywords: 'None'
119
+ }
120
+ ]
121
+ },
122
+ {
123
+ className: 'meta',
124
+ begin: /^[\t ]*@/, end: /$/
125
+ },
126
+ {
127
+ begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3
128
+ }
129
+ ]
130
+ };
131
+ }