1 | (function (Prism) {
|
2 |
|
3 | var codeLinePattern = /(^(?:[\t ]*(?:\*\s*)*))[^*\s].*$/m;
|
4 |
|
5 | var memberReference = /#\s*\w+(?:\s*\([^()]*\))?/.source;
|
6 | var reference = /(?:\b[a-zA-Z]\w+\s*\.\s*)*\b[A-Z]\w*(?:\s*<mem>)?|<mem>/.source.replace(/<mem>/g, function () { return memberReference; });
|
7 |
|
8 | Prism.languages.javadoc = Prism.languages.extend('javadoclike', {});
|
9 | Prism.languages.insertBefore('javadoc', 'keyword', {
|
10 | 'reference': {
|
11 | pattern: RegExp(/(@(?:exception|throws|see|link|linkplain|value)\s+(?:\*\s*)?)/.source + '(?:' + reference + ')'),
|
12 | lookbehind: true,
|
13 | inside: {
|
14 | 'function': {
|
15 | pattern: /(#\s*)\w+(?=\s*\()/,
|
16 | lookbehind: true
|
17 | },
|
18 | 'field': {
|
19 | pattern: /(#\s*)\w+/,
|
20 | lookbehind: true
|
21 | },
|
22 | 'namespace': {
|
23 | pattern: /\b(?:[a-z]\w*\s*\.\s*)+/,
|
24 | inside: {
|
25 | 'punctuation': /\./
|
26 | }
|
27 | },
|
28 | 'class-name': /\b[A-Z]\w*/,
|
29 | 'keyword': Prism.languages.java.keyword,
|
30 | 'punctuation': /[#()[\],.]/
|
31 | }
|
32 | },
|
33 | 'class-name': {
|
34 |
|
35 | pattern: /(@param\s+)<[A-Z]\w*>/,
|
36 | lookbehind: true,
|
37 | inside: {
|
38 | 'punctuation': /[.<>]/
|
39 | }
|
40 | },
|
41 | 'code-section': [
|
42 | {
|
43 | pattern: /(\{@code\s+(?!\s))(?:[^\s{}]|\s+(?![\s}])|\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\})+(?=\s*\})/,
|
44 | lookbehind: true,
|
45 | inside: {
|
46 | 'code': {
|
47 |
|
48 | pattern: codeLinePattern,
|
49 | lookbehind: true,
|
50 | inside: Prism.languages.java,
|
51 | alias: 'language-java'
|
52 | }
|
53 | }
|
54 | },
|
55 | {
|
56 | pattern: /(<(code|pre|tt)>(?!<code>)\s*)\S(?:\S|\s+\S)*?(?=\s*<\/\2>)/,
|
57 | lookbehind: true,
|
58 | inside: {
|
59 | 'line': {
|
60 | pattern: codeLinePattern,
|
61 | lookbehind: true,
|
62 | inside: {
|
63 |
|
64 | 'tag': Prism.languages.markup.tag,
|
65 | 'entity': Prism.languages.markup.entity,
|
66 | 'code': {
|
67 |
|
68 | pattern: /.+/,
|
69 | inside: Prism.languages.java,
|
70 | alias: 'language-java'
|
71 | }
|
72 | }
|
73 | }
|
74 | }
|
75 | }
|
76 | ],
|
77 | 'tag': Prism.languages.markup.tag,
|
78 | 'entity': Prism.languages.markup.entity,
|
79 | });
|
80 |
|
81 | Prism.languages.javadoclike.addSupport('java', Prism.languages.javadoc);
|
82 | }(Prism));
|