rack-codehighlighter 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +0 -0
- data/README.markdown +240 -0
- data/Rakefile +31 -0
- data/TODO +38 -0
- data/VERSION.yml +4 -0
- data/examples/app.rb +15 -0
- data/examples/check.rb +16 -0
- data/examples/config.ru +19 -0
- data/examples/public/javascripts/lang-css.js +2 -0
- data/examples/public/javascripts/lang-hs.js +2 -0
- data/examples/public/javascripts/lang-lisp.js +3 -0
- data/examples/public/javascripts/lang-lua.js +2 -0
- data/examples/public/javascripts/lang-ml.js +2 -0
- data/examples/public/javascripts/lang-proto.js +1 -0
- data/examples/public/javascripts/lang-sql.js +2 -0
- data/examples/public/javascripts/lang-vb.js +2 -0
- data/examples/public/javascripts/lang-wiki.js +1 -0
- data/examples/public/javascripts/prettify.js +31 -0
- data/examples/public/stylesheets/application.css +29 -0
- data/examples/public/stylesheets/censor.css +4 -0
- data/examples/public/stylesheets/coderay.css +126 -0
- data/examples/public/stylesheets/prettify.css +44 -0
- data/examples/public/stylesheets/syntax.css +79 -0
- data/examples/public/stylesheets/uv.css +1022 -0
- data/examples/public/stylesheets/uv/amy.css +147 -0
- data/examples/public/stylesheets/uv/blackboard.css +88 -0
- data/examples/public/stylesheets/uv/cobalt.css +149 -0
- data/examples/public/stylesheets/uv/dawn.css +121 -0
- data/examples/public/stylesheets/uv/espresso_libre.css +109 -0
- data/examples/public/stylesheets/uv/sunburst.css +180 -0
- data/examples/public/stylesheets/uv/twilight.css +137 -0
- data/examples/public/stylesheets/uv/zenburnesque.css +91 -0
- data/examples/views/index.erb +81 -0
- data/examples/views/layout.erb +38 -0
- data/lib/rack/codehighlighter.rb +152 -0
- metadata +120 -0
data/LICENSE
ADDED
File without changes
|
data/README.markdown
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
# Rack::Codehighlighter middleware
|
2
|
+
|
3
|
+
The *Rack::Codehighlighter* is a middleware which allows for easy
|
4
|
+
connecting a code highlighter of somebody's choice to an HTML page
|
5
|
+
containing pieces of programming code. Parameters to
|
6
|
+
*Rack::Codehighlighter* are: the name of a highlighter and a
|
7
|
+
specification of how to find the pieces of code in the page.
|
8
|
+
|
9
|
+
It supports the most popular Ruby code highlighters of today:
|
10
|
+
|
11
|
+
* ultraviolet
|
12
|
+
* coderay
|
13
|
+
* syntax
|
14
|
+
|
15
|
+
To ease testing it implements *censor* highlighter.
|
16
|
+
|
17
|
+
|
18
|
+
## How it works?
|
19
|
+
|
20
|
+
*Rack::Codehighlighter* looks for code blocks to be highlighted in the HTML
|
21
|
+
produced by your application. For each block found it calls requested
|
22
|
+
highlighter.
|
23
|
+
|
24
|
+
|
25
|
+
## Installing and Usage
|
26
|
+
|
27
|
+
Install the gem with:
|
28
|
+
|
29
|
+
sudo gem install rack-codehighlighter -s http://gemcutter.org
|
30
|
+
|
31
|
+
In order for the highlighting to show up, you’ll need to include a
|
32
|
+
highlighting stylesheet. For example stylesheets you can look at
|
33
|
+
stylesheets in the *examples/public/stylesheets* directory.
|
34
|
+
|
35
|
+
### Rails
|
36
|
+
|
37
|
+
In order to use, include the following code in a Rails application
|
38
|
+
*config/environment.rb* file:
|
39
|
+
|
40
|
+
require 'coderay' # get one of supported highlighters
|
41
|
+
require 'rack/codehighlighter'
|
42
|
+
|
43
|
+
Rails::Initializer.run do |config|
|
44
|
+
config.gem 'coderay'
|
45
|
+
config.gem 'rack-codehighlighter'
|
46
|
+
|
47
|
+
config.middleware.use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
|
48
|
+
end
|
49
|
+
|
50
|
+
### Any Rack application
|
51
|
+
|
52
|
+
The *rack-codehighlighter* gem can be used with any Rack application,
|
53
|
+
for example with a **Sinatra** application. If your application
|
54
|
+
includes a rackup file or uses *Rack::Builder* to construct the
|
55
|
+
application pipeline, simply require and use as follows:
|
56
|
+
|
57
|
+
gem 'coderay' # get one of supported highlighters
|
58
|
+
require 'coderay'
|
59
|
+
|
60
|
+
gem 'rack-codehighlighter'
|
61
|
+
require 'rack/codehighlighter'
|
62
|
+
|
63
|
+
use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
|
64
|
+
run app
|
65
|
+
|
66
|
+
|
67
|
+
## *Rack::Codehighlighter* by an example
|
68
|
+
|
69
|
+
To colorize code in *pre* elements with well known *coderay*
|
70
|
+
highlighter use the following:
|
71
|
+
|
72
|
+
use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/
|
73
|
+
|
74
|
+
The first parenthesized expression from the pattern `/\A:::(\w+)\s*\n/`
|
75
|
+
will be used to match the language name. For example, from the *pre*
|
76
|
+
element below:
|
77
|
+
|
78
|
+
<pre>:::ruby
|
79
|
+
puts "hello world"
|
80
|
+
</pre>
|
81
|
+
|
82
|
+
the *ruby* name is extracted.
|
83
|
+
|
84
|
+
To find the appropriate name to use for programming language,
|
85
|
+
look at the lists below.
|
86
|
+
|
87
|
+
Next, the matched element is removed and the second line is passed to
|
88
|
+
*coderay* highlighter for processing.
|
89
|
+
|
90
|
+
The highlighted code returned by the *coderay* highlighter is
|
91
|
+
wrapped with *pre* element with attributes appropriate for the
|
92
|
+
codehighlighter used.
|
93
|
+
|
94
|
+
|
95
|
+
### More examples
|
96
|
+
|
97
|
+
In examples displayed below, the default value of each option is used.
|
98
|
+
|
99
|
+
Coderay:
|
100
|
+
|
101
|
+
use Rack::Codehighlighter, :coderay,
|
102
|
+
:element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => false
|
103
|
+
|
104
|
+
Ultraviolet:
|
105
|
+
|
106
|
+
use Rack::Codehighlighter, :ultraviolet, :theme => "dawn", :lines => false,
|
107
|
+
:element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => false
|
108
|
+
|
109
|
+
Syntax:
|
110
|
+
|
111
|
+
use Rack::Codehighlighter, :syntax,
|
112
|
+
:element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => false
|
113
|
+
|
114
|
+
Censor:
|
115
|
+
|
116
|
+
use Rack::Codehighlighter, :censor, :reason => "[[-- ugly code removed --]]",
|
117
|
+
:element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => false
|
118
|
+
|
119
|
+
|
120
|
+
Markdown, Maruku and RDiscount processors, the code is wrapped with `pre>code`.
|
121
|
+
To remove this extra one level of nesting the `:markdown` option should be used:
|
122
|
+
|
123
|
+
use Rack::Codehighlighter, :coderay, :markdown => true,
|
124
|
+
:element => "pre>code", :pattern => /\A:::(\w+)\s*\n/, :logging => false
|
125
|
+
|
126
|
+
Check the `examples` directory for working examples.
|
127
|
+
|
128
|
+
|
129
|
+
## Try it!
|
130
|
+
|
131
|
+
A simple Copy & Paste example.
|
132
|
+
|
133
|
+
# example.rb
|
134
|
+
|
135
|
+
require 'rubygems'
|
136
|
+
gem 'sinatra'
|
137
|
+
require 'sinatra'
|
138
|
+
gem 'rack-codehighlighter'
|
139
|
+
require 'rack/codehighlighter'
|
140
|
+
|
141
|
+
use Rack::Codehighlighter, :censor, :reason => '[[--difficult code removed--]]'
|
142
|
+
|
143
|
+
get "/" do
|
144
|
+
erb :hello
|
145
|
+
end
|
146
|
+
|
147
|
+
__END__
|
148
|
+
@@ hello
|
149
|
+
<h3>Fibonacci numbers in Ruby</h3>
|
150
|
+
<pre>:::ruby
|
151
|
+
def fib(n)
|
152
|
+
if n < 2
|
153
|
+
1
|
154
|
+
else
|
155
|
+
fib(n-2) + fib(n-1)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
</pre>
|
159
|
+
|
160
|
+
Run the example with:
|
161
|
+
|
162
|
+
ruby example.rb
|
163
|
+
|
164
|
+
and check results at *http://localhost:4567*.
|
165
|
+
|
166
|
+
|
167
|
+
## Supported highlighters
|
168
|
+
|
169
|
+
These currently include: *Syntax* (fast), *Coderay* (very fast),
|
170
|
+
*Ultraviolet* (slow, but highlights almost any language).
|
171
|
+
|
172
|
+
### [Syntax](http://syntax.rubyforge.org/)
|
173
|
+
|
174
|
+
Languages supported by *Syntax*:
|
175
|
+
|
176
|
+
* xml
|
177
|
+
* ruby
|
178
|
+
|
179
|
+
### [Coderay](http://coderay.rubychan.de/)
|
180
|
+
|
181
|
+
Languages supported by *Coderay*:
|
182
|
+
|
183
|
+
* C, CSS
|
184
|
+
* Delphi, diff
|
185
|
+
* HTML, RHTML (Rails), Nitro-XHTML
|
186
|
+
* Java, JavaScript, JSON
|
187
|
+
* Ruby
|
188
|
+
* YAML
|
189
|
+
|
190
|
+
### [Ultraviolet](http://ultraviolet.rubyforge.org/)
|
191
|
+
|
192
|
+
The *ultraviolet* gem needs oniguruma regexp library.
|
193
|
+
|
194
|
+
On Fedora install the library with:
|
195
|
+
|
196
|
+
sudo yum install oniguruma oniguruma-devel
|
197
|
+
|
198
|
+
For installation instruction of the *oniguruma* library from sources,
|
199
|
+
see [Carbonica](http://carboni.ca/projects/harsh/)
|
200
|
+
|
201
|
+
Now, install the gem:
|
202
|
+
|
203
|
+
sudo gem install ultraviolet
|
204
|
+
|
205
|
+
See also [Ultraviolet themes gallery](http://ultraviolet.rubyforge.org/themes.xhtml)
|
206
|
+
|
207
|
+
Ultraviolet supports almost any language:
|
208
|
+
|
209
|
+
* actionscript, active4d, active4d\_html, active4d\_ini, active4d\_library,
|
210
|
+
ada, antlr, apache, applescript, asp, asp\_vb.net
|
211
|
+
* bibtex, blog\_html, blog\_markdown, blog\_text, blog\_textile, build,
|
212
|
+
bulletin\_board
|
213
|
+
* c, c++, cake, camlp4, cm, coldusion, context\_free, cs, css, css\_experimental,
|
214
|
+
csv
|
215
|
+
* d, diff, dokuwiki, dot, doxygen, dylan
|
216
|
+
* eiffel, erlang, f-script, fortran, fxscript
|
217
|
+
* greasemonkey, gri, groovy, gtd, gtdalt
|
218
|
+
* haml, haskell, html, html-asp, html\_django, html\_for\_asp.net, html\_mason,
|
219
|
+
html\_rails, html\_tcl
|
220
|
+
* icalendar, inform, ini, installer\_distribution\_script, io
|
221
|
+
* java, javaproperties, javascript, javascript\_+\_prototype,
|
222
|
+
javascript\_+\_prototype\_bracketed, jquery\_javascript, json
|
223
|
+
* languagedefinition, latex, latex\_beamer, latex\_log, latex\_memoir, lexflex,
|
224
|
+
lighttpd, lilypond, lisp, literate\_haskell, logo, logtalk, lua
|
225
|
+
* m, macports\_portfile, mail, makefile, man, markdown, mediawiki, mel,
|
226
|
+
mips, mod\_perl, modula-3, moinmoin, mootools, movable\_type, multimarkdown
|
227
|
+
* objective-c, objective-c++, ocaml, ocamllex, ocamlyacc, opengl
|
228
|
+
* pascal, perl, php, plain\_text, pmwiki, postscript, processing,
|
229
|
+
prolog, property\_list, python, python\_django
|
230
|
+
* qmake\_project, qt\_c++, quake3\_config
|
231
|
+
* r, r\_console, ragel, rd\_r\_documentation, regexp,
|
232
|
+
regular\_expressions\_oniguruma, regular\_expressions\_python, release\_notes
|
233
|
+
remind, restructuredtext, rez, ruby, ruby\_experimental, ruby\_on\_rails
|
234
|
+
* s5, scheme, scilab, setext, shell-unix-generic, slate, smarty,
|
235
|
+
sql, sql\_rails, ssh-config, standard\_ml, strings\_file, subversion\_commit\_message,
|
236
|
+
sweave, swig
|
237
|
+
* tcl, template\_toolkit, tex, tex\_math, textile, tsv, twiki, txt2tags
|
238
|
+
* vectorscript
|
239
|
+
* xhtml\_1.0, xml, xml\_strict, xsl
|
240
|
+
* yaml, yui\_javascript
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "rake"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gemspec|
|
6
|
+
gemspec.name = "rack-codehighlighter"
|
7
|
+
gemspec.summary = "Rack Middleware for Code Highlighting."
|
8
|
+
gemspec.email = "matwb@univ.gda.pl"
|
9
|
+
gemspec.homepage = "http://github.com/wbzyl/rack-codehighlighter"
|
10
|
+
gemspec.authors = ["Wlodek Bzyl"]
|
11
|
+
gemspec.description = gemspec.summary
|
12
|
+
|
13
|
+
gemspec.files = %w[LICENSE TODO Rakefile VERSION.yml] + FileList['lib/**/*.rb', "examples/**/*"]
|
14
|
+
|
15
|
+
gemspec.add_runtime_dependency 'rack', '>=1.0.0'
|
16
|
+
gemspec.add_runtime_dependency 'hpricot', '>=0.8.1'
|
17
|
+
|
18
|
+
gemspec.add_development_dependency 'rack-test', '>=0.3.0'
|
19
|
+
end
|
20
|
+
Jeweler::GemcutterTasks.new
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler not available."
|
23
|
+
puts "Install it with:"
|
24
|
+
puts " sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
25
|
+
end
|
26
|
+
|
27
|
+
#Rake::TestTask.new(:test) do |t|
|
28
|
+
# t.libs << 'lib' << 'test'
|
29
|
+
# t.pattern = 'test/**/*_test.rb'
|
30
|
+
# t.verbose = false
|
31
|
+
#end
|
data/TODO
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
[15.06.2009]
|
2
|
+
|
3
|
+
Compare: http://freelancing-god.github.com/ts/en/
|
4
|
+
Description of thinking-sphinx gem.
|
5
|
+
|
6
|
+
[13.10.2009]
|
7
|
+
|
8
|
+
Currently, almost everything what I write is rendered by Ruby on Rails
|
9
|
+
and Sinatra applications. To improve the readability of the text, I
|
10
|
+
want the code fragments to be colored. So extending Rails and Sinatra
|
11
|
+
frameworks with syntax highlighting is a must.
|
12
|
+
|
13
|
+
The problem is to how syntax highlighting features are hooked into
|
14
|
+
these frameworks.
|
15
|
+
|
16
|
+
Look at the current practice. To this end, analyze the top three tools
|
17
|
+
listed on *The Ruby Toolbox* in category
|
18
|
+
[Syntax Highlighting](http://ruby-toolbox.com/categories/syntax_highlighting.html).
|
19
|
+
|
20
|
+
[tm_syntax_highlighting](http://github.com/arya/tm_syntax_highlighting/) (plugin):
|
21
|
+
|
22
|
+
code(some_ruby_code, :theme => "twilight", :lang => "ruby", :line_numbers => true)
|
23
|
+
|
24
|
+
[harsh](http://carboni.ca/projects/harsh/) (plugin):
|
25
|
+
|
26
|
+
<% harsh :theme => :dawn do %> | <% harsh %Q{ some_ruby_code }, :theme => :dawn %>
|
27
|
+
some_ruby_code |
|
28
|
+
<% end %> |
|
29
|
+
|
30
|
+
[Redcloth with CodeRay](http://github.com/augustl/redcloth-with-coderay) (gem):
|
31
|
+
|
32
|
+
<source:ruby> some_ruby_code </source>
|
33
|
+
|
34
|
+
In each piece of code inserted into html we must change:
|
35
|
+
`<` to `<`. This is annoying thing.
|
36
|
+
|
37
|
+
Analyze packages mentioned at the *The Ruby Toolbox* page:
|
38
|
+
[Syntax Highlighting](http://ruby-toolbox.com/categories/syntax_highlighting.html)
|
data/VERSION.yml
ADDED
data/examples/app.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
path = File.expand_path("../lib")
|
2
|
+
$:.unshift(path) unless $:.include?(path)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'sinatra'
|
6
|
+
|
7
|
+
require 'rack/codehighlighter'
|
8
|
+
|
9
|
+
require 'coderay' # Coderay
|
10
|
+
require 'syntax/convertors/html' # Syntax
|
11
|
+
require 'uv' # Ultraviolet
|
12
|
+
|
13
|
+
get "/" do
|
14
|
+
erb :index
|
15
|
+
end
|
data/examples/check.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'coderay'
|
4
|
+
require 'uv'
|
5
|
+
require 'syntax/convertors/html'
|
6
|
+
|
7
|
+
str = "def hitch; end"
|
8
|
+
|
9
|
+
puts "---- Syntax ----"
|
10
|
+
puts Syntax::Convertors::HTML.for_syntax('ruby').convert(str)
|
11
|
+
|
12
|
+
puts "---- Coderay ----"
|
13
|
+
puts CodeRay.encoder(:html).encode(str, 'ruby')
|
14
|
+
|
15
|
+
puts "---- Ultraviolet ----"
|
16
|
+
puts Uv.parse(str, 'xhtml', 'ruby_experimental', false, 'dawn')
|
data/examples/config.ru
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'app'
|
2
|
+
|
3
|
+
use Rack::ShowExceptions
|
4
|
+
use Rack::Lint
|
5
|
+
|
6
|
+
# use default options
|
7
|
+
|
8
|
+
#use Rack::Codehighlighter, :prettify, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
|
9
|
+
|
10
|
+
#use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
|
11
|
+
|
12
|
+
#use Rack::Codehighlighter, :syntax, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
|
13
|
+
|
14
|
+
use Rack::Codehighlighter, :ultraviolet, :theme => 'dawn',
|
15
|
+
:element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
|
16
|
+
|
17
|
+
#use Rack::Codehighlighter, :censor, :reason => '[[-- ugly code removed --]]'
|
18
|
+
|
19
|
+
run Sinatra::Application
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["str",/^\([^\)\"\']*\)/,/\burl/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["kwd",/^-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*(?=\s*:)/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],["com",/^(?:<!--|--\>)/],
|
2
|
+
["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:(?:--+(?:[^\r\n\x0C_:\"\'\(\),;\[\]`\{\}][^\r\n\x0C_]*)?(?=[\x0C\r\n]|$))|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/,
|
2
|
+
null],["pln",/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],["pun",/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),["hs"]);
|
@@ -0,0 +1,3 @@
|
|
1
|
+
(function(){var a=null;
|
2
|
+
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(/,a,"("],["clo",/^\)/,a,")"],["com",/^;[^\r\n]*/,a,";"],["pln",/^[\t\n\r \xA0]+/,a,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|cons|defun|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],["lit",/^[+\-]?(?:\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[eEdD][+\-]?\d+)?)/],["lit",
|
3
|
+
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["cl","el","lisp","scm"])})()
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],["str",/^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_]\w*/i],
|
2
|
+
["pun",/^[^\w\t\n\r \xA0]+/]]),["lua"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
|
2
|
+
["lit",/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^(?:[a-z_]\w*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],["pun",/^[^\t\n\r \xA0\"\'\w]+/]]),["fs","ml"]);
|
@@ -0,0 +1 @@
|
|
1
|
+
PR.registerLangHandler(PR.sourceDecorator({keywords:"bool bytes default double enum extend extensions false fixed32 fixed64 float group import int32 int64 max message option optional package repeated required returns rpc service sfixed32 sfixed64 sint32 sint64 string syntax to true uint32 uint64",cStyleComments:true}),["proto"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
|
2
|
+
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0]+/]]),["sql"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D][cC]|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/,null,'"\u201c\u201d'],["com",/^[\'\u2018\u2019][^\r\n\u2028\u2029]*/,null,"'\u2018\u2019"]],[["kwd",/^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i,
|
2
|
+
null],["com",/^REM[^\r\n\u2028\u2029]*/i],["lit",/^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*\])/i],["pun",/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],["pun",/^(?:\[|\])/]]),["vb","vbs"]);
|
@@ -0,0 +1 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0a-gi-z0-9]+/,null,"\t\n\r \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[=*~\^\[\]]+/,null,"=*~^[]"]],[["kwd",/^#[a-z]+\b/,/(?:^|[\r\n])$/],["lit",/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],["lang-",/^\{\{\{([\s\S]+?)\}\}\}/],["lang-",/^`([^\r\n`]+)`/],["str",/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],["pln",/^[\s\S][^#=*~^A-Zh\{`\[]+/]]),["wiki"]);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(function(){
|
2
|
+
var j=null,n=true;window.PR_SHOULD_USE_CONTINUATION=n;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var K=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);window._pr_isIE6=function(){return K};return K};
|
3
|
+
var ba="a",ca="z",da="A",ea="Z",fa="!",ga="!=",ha="!==",ia="#",ja="%",ka="%=",x="&",la="&&",ma="&&=",na="&=",oa="(",pa="*",qa="*=",ra="+=",sa=",",ta="-=",ua="->",va="/",Da="/=",Ea=":",Fa="::",Ga=";",z="<",Ha="<<",Ia="<<=",Ja="<=",Ka="=",La="==",Ma="===",B=">",Na=">=",Oa=">>",Pa=">>=",Qa=">>>",Ra=">>>=",Sa="?",Ta="@",Ua="[",Va="^",Wa="^=",Xa="^^",Ya="^^=",Za="{",$a="|",ab="|=",bb="||",cb="||=",db="~",eb="break",fb="case",gb="continue",hb="delete",ib="do",jb="else",kb="finally",lb="instanceof",mb="return",
|
4
|
+
nb="throw",ob="try",pb="typeof",qb="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)",rb="|\\b",sb="\\$1",tb="|^)\\s*$",ub="&",vb="<",wb=">",xb=""",yb="&#",zb="x",Ab="'",C='"',Bb=" ",Cb="XMP",Db="</",Eb='="',D="PRE",Fb='<!DOCTYPE foo PUBLIC "foo bar">\n<foo />',H="",Gb="\t",Hb="\n",Ib="nocode",Jb=' $1="$2$3$4"',I="pln",L="lang-",M="src",N="default-markup",O="default-code",P="com",Kb="dec",S="pun",Lb="lang-js",Mb="lang-css",T="tag",U="atv",Nb="<>/=",V="atn",Ob=" \t\r\n",
|
5
|
+
W="str",Pb="'\"",Qb="'\"`",Rb="\"'",Sb=" \r\n",X="lit",Tb="123456789",Ub=".",Vb="kwd",Wb="typ",Xb="break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
|
6
|
+
Y="</span>",Yb='<span class="',Zb='">',$b="$1 ",ac="<br />",bc="console",cc="cannot override language handler %s",dc="htm",ec="html",fc="mxml",gc="xhtml",hc="xml",ic="xsl",jc="break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",
|
7
|
+
kc="c",lc="cc",mc="cpp",nc="cxx",oc="cyc",pc="m",qc="break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
|
8
|
+
rc="cs",sc="break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",tc="java",uc="break continue do else for if return while case done elif esac eval fi function in local set then until ",
|
9
|
+
vc="bsh",wc="csh",xc="sh",yc="break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",zc="cv",Ac="py",Bc="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",Cc="perl",Dc="pl",Ec="pm",Fc="break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",
|
10
|
+
Gc="rb",Hc="break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try debugger eval export function get null set undefined var with Infinity NaN ",Ic="js",Jc="pre",Kc="code",Lc="xmp",Mc="prettyprint",Nc="class",Oc="br",Pc="\r\n";
|
11
|
+
(function(){function K(b){b=b.split(/ /g);var a={};for(var d=b.length;--d>=0;){var c=b[d];if(c)a[c]=j}return a}function Qc(b){return b>=ba&&b<=ca||b>=da&&b<=ea}function Q(b,a,d,c){b.unshift(d,c||0);try{a.splice.apply(a,b)}finally{b.splice(0,2)}}var Rc=(function(){var b=[fa,ga,ha,ia,ja,ka,x,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,Da,Ea,Fa,Ga,z,Ha,Ia,Ja,Ka,La,Ma,B,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb],a=qb;for(var d=0;d<b.length;++d){var c=b[d];a+=Qc(c.charAt(0))?
|
12
|
+
rb+c:$a+c.replace(/([^=<>:&])/g,sb)}a+=tb;return new RegExp(a)})(),wa=/&/g,xa=/</g,ya=/>/g,Sc=/\"/g;function Tc(b){return b.replace(wa,ub).replace(xa,vb).replace(ya,wb).replace(Sc,xb)}function Z(b){return b.replace(wa,ub).replace(xa,vb).replace(ya,wb)}var Uc=/</g,Vc=/>/g,Wc=/'/g,Xc=/"/g,Yc=/&/g,Zc=/ /g;function $c(b){var a=b.indexOf(x);if(a<0)return b;for(--a;(a=b.indexOf(yb,a+1))>=0;){var d=b.indexOf(Ga,a);if(d>=0){var c=b.substring(a+3,d),g=10;if(c&&c.charAt(0)===zb){c=
|
13
|
+
c.substring(1);g=16}var e=parseInt(c,g);isNaN(e)||(b=b.substring(0,a)+String.fromCharCode(e)+b.substring(d+1))}}return b.replace(Uc,z).replace(Vc,B).replace(Wc,Ab).replace(Xc,C).replace(Yc,x).replace(Zc,Bb)}function za(b){return Cb===b.tagName}function R(b,a){switch(b.nodeType){case 1:var d=b.tagName.toLowerCase();a.push(z,d);for(var c=0;c<b.attributes.length;++c){var g=b.attributes[c];if(!!g.specified){a.push(Bb);R(g,a)}}a.push(B);for(var e=b.firstChild;e;e=e.nextSibling)R(e,a);if(b.firstChild||
|
14
|
+
!/^(?:br|link|img)$/.test(d))a.push(Db,d,B);break;case 2:a.push(b.name.toLowerCase(),Eb,Tc(b.value),C);break;case 3:case 4:a.push(Z(b.nodeValue));break}}var $=j;function ad(b){if(j===$){var a=document.createElement(D);a.appendChild(document.createTextNode(Fb));$=!/</.test(a.innerHTML)}if($){var d=b.innerHTML;if(za(b))d=Z(d);return d}var c=[];for(var g=b.firstChild;g;g=g.nextSibling)R(g,c);return c.join(H)}function bd(b){var a=0;return function(d){var c=j,g=0;for(var e=0,k=d.length;e<k;++e){var f=
|
15
|
+
d.charAt(e);switch(f){case Gb:c||(c=[]);c.push(d.substring(g,e));var h=b-a%b;a+=h;for(;h>=0;h-=" ".length)c.push(" ".substring(0,h));g=e+1;break;case Hb:a=0;break;default:++a}}if(!c)return d;c.push(d.substring(g));return c.join(H)}}var cd=/(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g,dd=/^<!--/,ed=/^<\[CDATA\[/,fd=/^<br\b/i,Aa=/^<(\/?)([a-zA-Z]+)/;function gd(b){var a=b.match(cd),d=[],c=0,g=[];if(a)for(var e=0,k=a.length;e<k;++e){var f=
|
16
|
+
a[e];if(f.length>1&&f.charAt(0)===z){if(!dd.test(f))if(ed.test(f)){d.push(f.substring(9,f.length-3));c+=f.length-12}else if(fd.test(f)){d.push(Hb);++c}else if(f.indexOf(Ib)>=0&&hd(f)){var h=f.match(Aa)[2],q=1,i;a:for(i=e+1;i<k;++i){var o=a[i].match(Aa);if(o&&o[2]===h)if(o[1]===va){if(--q===0)break a}else++q}if(i<k){g.push(c,a.slice(e,i+1).join(H));e=i}else g.push(c,f)}else g.push(c,f)}else{var r=$c(f);d.push(r);c+=r.length}}return{source:d.join(H),tags:g}}function hd(b){return!!b.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,
|
17
|
+
Jb).match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)}function aa(b,a,d,c){if(!!a){var g=d.call({},a);if(b)for(var e=g.length;(e-=2)>=0;)g[e]+=b;c.push.apply(c,g)}}function J(b,a){var d={};(function(){var k=b.concat(a);for(var f=k.length;--f>=0;){var h=k[f],q=h[3];if(q)for(var i=q.length;--i>=0;)d[q.charAt(i)]=h}})();var c=a.length,g=/\S/,e=function(k,f){f=f||0;var h=[f,I],q=H,i=0,o=k;while(o.length){var r,l=j,m,p=d[o.charAt(0)];if(p){m=o.match(p[1]);l=m[0];r=p[0]}else{for(var s=0;s<c;++s){p=a[s];
|
18
|
+
var u=p[2];if(!(u&&!u.test(q))){if(m=o.match(p[1])){l=m[0];r=p[0];break}}}if(!l){r=I;l=o.substring(0,1)}}var t=L===r.substring(0,5);if(t&&!(m&&m[1])){t=false;r=M}if(t){var A=m[1],v=l.indexOf(A),E=v+A.length,F=r.substring(5);G.hasOwnProperty(F)||(F=/^\s*</.test(A)?N:O);aa(f+i,l.substring(0,v),e,h);aa(f+i+v,l.substring(v,E),G[F],h);aa(f+i+E,l.substring(E),e,h)}else h.push(f+i,r);i+=l.length;o=o.substring(l.length);if(r!==P&&g.test(l))q=l}return h};return e}var id=J([],[[I,/^[^<?]+/,j],[Kb,/^<!\w[^>]*(?:>|$)/,
|
19
|
+
j],[P,/^<!--[\s\S]*?(?:--\>|$)/,j],[L,/^<\?([\s\S]+?)(?:\?>|$)/,j],[L,/^<%([\s\S]+?)(?:%>|$)/,j],[S,/^(?:<[%?]|[%?]>)/,j],[L,/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i,j],[Lb,/^<script\b[^>]*>([\s\S]+?)<\/script\b[^>]*>/i,j],[Mb,/^<style\b[^>]*>([\s\S]+?)<\/style\b[^>]*>/i,j],[T,/^<\/?\w[^<>]*>/,j]]),jd=/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/;function kd(b){var a=id(b);for(var d=0;d<a.length;d+=2)if(a[d+1]===M){var c,g;c=a[d];g=d+2<a.length?a[d+2]:b.length;var e=b.substring(c,g),k=e.match(jd);if(k)a.splice(d,
|
20
|
+
2,c,T,c+k[1].length,M,c+k[1].length+(k[2]||H).length,T)}return a}var ld=J([[U,/^\'[^\']*(?:\'|$)/,j,Ab],[U,/^\"[^\"]*(?:\"|$)/,j,C],[S,/^[<>\/=]+/,j,Nb]],[[T,/^[\w:\-]+/,/^</],[U,/^[\w\-]+/,/^=/],[V,/^[\w:\-]+/,j],[I,/^\s+/,j,Ob]]);function md(b,a){for(var d=0;d<a.length;d+=2){var c=a[d+1];if(c===T){var g,e;g=a[d];e=d+2<a.length?a[d+2]:b.length;var k=b.substring(g,e),f=ld(k,g);Q(f,a,d,2);d+=f.length-2}}return a}function y(b){var a=[],d=[];if(b.tripleQuotedStrings)a.push([W,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
|
21
|
+
j,Pb]);else b.multiLineStrings?a.push([W,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,j,Qb]):a.push([W,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,j,Rb]);d.push([I,/^(?:[^\'\"\`\/\#]+)/,j,Sb]);b.hashComments&&a.push([P,/^#[^\r\n]*/,j,ia]);if(b.cStyleComments){d.push([P,/^\/\/[^\r\n]*/,j]);d.push([P,/^\/\*[\s\S]*?(?:\*\/|$)/,j])}b.regexLiterals&&d.push([W,/^\/(?=[^\/*])(?:[^\/\x5B\x5C]|\x5C[\s\S]|\x5B(?:[^\x5C\x5D]|\x5C[\s\S])*(?:\x5D|$))+(?:\/|$)/,
|
22
|
+
Rc]);var c=K(b.keywords),g=J(a,d),e=J([],[[I,/^\s+/,j,Sb],[I,/^[a-z_$@][a-z_$@0-9]*/i,j],[X,/^0x[a-f0-9]+[a-z]/i,j],[X,/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i,j,Tb],[S,/^[^\s\w\.$@]+/,j]]);function k(f,h){for(var q=0;q<h.length;q+=2){var i=h[q+1];if(i===I){var o,r,l,m;o=h[q];r=q+2<h.length?h[q+2]:f.length;l=f.substring(o,r);m=e(l,o);for(var p=0,s=m.length;p<s;p+=2){var u=m[p+1];if(u===I){var t=m[p],A=p+2<s?m[p+2]:l.length,v=f.substring(t,A);if(v===Ub)m[p+1]=S;else if(v in c)m[p+
|
23
|
+
1]=Vb;else if(/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(v))m[p+1]=v.charAt(0)===Ta?X:Wb}}Q(m,h,q,2);q+=m.length-2}}return h}return function(f){var h=g(f);return h=k(f,h)}}var Ba=y({keywords:Xb,hashComments:n,cStyleComments:n,multiLineStrings:n,regexLiterals:n});function nd(b,a){var d=false;for(var c=0;c<a.length;c+=2){var g=a[c+1],e,k;if(g===V){e=a[c];k=c+2<a.length?a[c+2]:b.length;d=/^on|^style$/i.test(b.substring(e,k))}else if(g===U){if(d){e=a[c];k=c+2<a.length?a[c+2]:b.length;var f=b.substring(e,
|
24
|
+
k),h=f.length,q=h>=2&&/^[\"\']/.test(f)&&f.charAt(0)===f.charAt(h-1),i,o,r;if(q){o=e+1;r=k-1;i=f}else{o=e+1;r=k-1;i=f.substring(1,f.length-1)}var l=Ba(i);for(var m=0,p=l.length;m<p;m+=2)l[m]+=o;if(q){l.push(r,U);Q(l,a,c+2,0)}else Q(l,a,c,2)}d=false}}return a}function od(b){var a=kd(b);a=md(b,a);return a=nd(b,a)}function pd(b,a,d){var c=[],g=0,e=j,k=j,f=0,h=0,q=bd(window.PR_TAB_WIDTH),i=/([\r\n ]) /g,o=/(^| ) /gm,r=/\r\n?|\n/g,l=/[ \r\n]$/,m=n;function p(u){if(u>g){if(e&&e!==k){c.push(Y);e=j}if(!e&&
|
25
|
+
k){e=k;c.push(Yb,e,Zb)}var t=Z(q(b.substring(g,u))).replace(m?o:i,$b);m=l.test(t);c.push(t.replace(r,ac));g=u}}while(n){var s;if(s=f<a.length?h<d.length?a[f]<=d[h]:n:false){p(a[f]);if(e){c.push(Y);e=j}c.push(a[f+1]);f+=2}else if(h<d.length){p(d[h]);k=d[h+1];h+=2}else break}p(b.length);e&&c.push(Y);return c.join(H)}var G={};function w(b,a){for(var d=a.length;--d>=0;){var c=a[d];if(G.hasOwnProperty(c))bc in window&&console.log(cc,c);else G[c]=b}}w(Ba,[O]);w(od,[N,dc,ec,fc,gc,hc,ic]);w(y({keywords:jc,
|
26
|
+
hashComments:n,cStyleComments:n}),[kc,lc,mc,nc,oc,pc]);w(y({keywords:qc,hashComments:n,cStyleComments:n}),[rc]);w(y({keywords:sc,cStyleComments:n}),[tc]);w(y({keywords:uc,hashComments:n,multiLineStrings:n}),[vc,wc,xc]);w(y({keywords:yc,hashComments:n,multiLineStrings:n,tripleQuotedStrings:n}),[zc,Ac]);w(y({keywords:Bc,hashComments:n,multiLineStrings:n,regexLiterals:n}),[Cc,Dc,Ec]);w(y({keywords:Fc,hashComments:n,multiLineStrings:n,regexLiterals:n}),[Gc]);w(y({keywords:Hc,cStyleComments:n,regexLiterals:n}),
|
27
|
+
[Ic]);function Ca(b,a){try{var d=gd(b),c=d.source,g=d.tags;G.hasOwnProperty(a)||(a=/^\s*</.test(c)?N:O);var e=G[a].call({},c);return pd(c,g,e)}catch(k){if(bc in window){console.log(k);console.a()}return b}}function qd(b){var a=window._pr_isIE6(),d=[document.getElementsByTagName(Jc),document.getElementsByTagName(Kc),document.getElementsByTagName(Lc)],c=[];for(var g=0;g<d.length;++g)for(var e=0,k=d[g].length;e<k;++e)c.push(d[g][e]);var f=0;function h(){var q=window.PR_SHOULD_USE_CONTINUATION?(new Date).getTime()+
|
28
|
+
250:Infinity;for(;f<c.length&&(new Date).getTime()<q;f++){var i=c[f];if(i.className&&i.className.indexOf(Mc)>=0){var o=i.className.match(/\blang-(\w+)\b/);if(o)o=o[1];var r=false;for(var l=i.parentNode;l;l=l.parentNode)if((l.tagName===Jc||l.tagName===Kc||l.tagName===Lc)&&l.className&&l.className.indexOf(Mc)>=0){r=n;break}if(!r){var m=ad(i);m=m.replace(/(?:\r\n?|\n)$/,H);var p=Ca(m,o);if(za(i)){var s=document.createElement(D);for(var u=0;u<i.attributes.length;++u){var t=i.attributes[u];if(t.specified){var A=
|
29
|
+
t.name.toLowerCase();if(A===Nc)s.className=t.value;else s.setAttribute(t.name,t.value)}}s.innerHTML=p;i.parentNode.replaceChild(s,i);i=s}else i.innerHTML=p;if(a&&i.tagName===D){var v=i.getElementsByTagName(Oc);for(var E=v.length;--E>=0;){var F=v[E];F.parentNode.replaceChild(document.createTextNode(Pc),F)}}}}}if(f<c.length)setTimeout(h,250);else b&&b()}h()}window.PR_normalizedHtml=R;window.prettyPrintOne=Ca;window.prettyPrint=qd;window.PR={createSimpleLexer:J,registerLangHandler:w,sourceDecorator:y,
|
30
|
+
PR_ATTRIB_NAME:V,PR_ATTRIB_VALUE:U,PR_COMMENT:P,PR_DECLARATION:Kb,PR_KEYWORD:Vb,PR_LITERAL:X,PR_NOCODE:Ib,PR_PLAIN:I,PR_PUNCTUATION:S,PR_SOURCE:M,PR_STRING:W,PR_TAG:T,PR_TYPE:Wb}})();
|
31
|
+
})()
|