1 // Copyright (C) 2009 Google Inc.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
18 * Registers a language handler for Wiki pages.
20 * Based on WikiSyntax at http://code.google.com/p/support/wiki/WikiSyntax
22 * @author mikesamuel@gmail.com
25 PR
['registerLangHandler'](
26 PR
['createSimpleLexer'](
29 [PR
['PR_PLAIN'], /^[\t \xA0a-gi-z0-9]+/, null,
30 '\t \xA0abcdefgijklmnopqrstuvwxyz0123456789'],
32 [PR
['PR_PUNCTUATION'], /^[=*~\^\[\]]+/, null, '=*~^[]']
35 // Meta-info like #summary, #labels, etc.
36 ['lang-wiki.meta', /(?:^^|\r\n?|\n)(#[a-z]+)\b/],
38 [PR
['PR_LITERAL'], /^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/
40 // A preformatted block in an unknown language
41 ['lang-', /^\{\{\{([\s\S]+?)\}\}\}/],
42 // A block of source code in an unknown language
43 ['lang-', /^`([^\r\n`]+)`/],
46 /^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],
47 [PR
['PR_PLAIN'], /^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]
51 PR
['registerLangHandler'](
52 PR
['createSimpleLexer']([[PR
['PR_KEYWORD'], /^#[a-z]+/i, null, '#']], []),