rokko 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +9 -5
- data/Rakefile +1 -1
- data/bin/rokko +1 -1
- data/lib/rokko.rb +40 -24
- data/lib/rokko/assets/github.min.css +1 -0
- data/lib/rokko/assets/highlight.min.js +1 -0
- data/lib/rokko/index_layout.rb +6 -6
- data/lib/rokko/layout.rb +25 -24
- data/lib/rokko/task.rb +11 -11
- data/lib/rokko/version.rb +1 -1
- data/rokko.gemspec +1 -1
- data/test/test_assets.rb +6 -6
- metadata +4 -4
- data/lib/rokko/assets/highlight.css +0 -63
- data/lib/rokko/assets/highlight.pack.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08c07ed302f1581bb460ab61c29148ddfb6afae1
|
4
|
+
data.tar.gz: 6d251213af141b93692ce0ff29f1b9483126b24a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ae375c7543109bd5ad6b8b76c152b19963bb9fe16903e36aa6b9c9c4bc832a9be08dc59cbde38820931dbee0eefe5dd1f768f53c290219e2acadbe2f008adfc
|
7
|
+
data.tar.gz: 5ab773a20f6bd202881025bd5d60146d7002b9d75a0e51ae282eaeece44247c98ab548c63b3ff050b53a4aa3b76d171f78c67373636f40434db2b4ad8021281d
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -31,7 +31,9 @@ gem 'rokko'
|
|
31
31
|
|
32
32
|
`rokko` command can be used to generate documentation for a set of Ruby source files:
|
33
33
|
|
34
|
-
|
34
|
+
```bash
|
35
|
+
rokko -o docs lib/*.rb
|
36
|
+
```
|
35
37
|
|
36
38
|
It is also possible to use Rokko as a Rake task:
|
37
39
|
|
@@ -40,12 +42,14 @@ require 'rokko/task'
|
|
40
42
|
|
41
43
|
Rokko::Task.new(:rokko, 'docs', # task name, output directory
|
42
44
|
['lib/**/*.rb', 'README.md'],
|
43
|
-
|
45
|
+
index: true, local: true)
|
44
46
|
```
|
45
47
|
|
46
48
|
And run:
|
47
49
|
|
48
|
-
|
50
|
+
```bash
|
51
|
+
rake rokko
|
52
|
+
```
|
49
53
|
|
50
54
|
## Options and configuration
|
51
55
|
|
@@ -66,7 +70,7 @@ Rokko::Task.new(:task_name, output_dir, filelist, opts)
|
|
66
70
|
Available options:
|
67
71
|
|
68
72
|
* `:local` — generate offline-ready documentation.
|
69
|
-
*
|
70
|
-
*
|
73
|
+
* `index: true` — generate index.html with links (TOC) to all generated HTML files.
|
74
|
+
* `index: <file>` — use `<file>` as index.html.
|
71
75
|
* `:stylesheet` — CSS stylesheet to use instead of default one.
|
72
76
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
|
|
4
4
|
require 'bundler'
|
5
5
|
Bundler::GemHelper.install_tasks
|
6
6
|
|
7
|
-
Rokko::Task.new(:rokko, 'docs', ['lib/**/*.rb', 'README.md'],
|
7
|
+
Rokko::Task.new(:rokko, 'docs', ['lib/**/*.rb', 'README.md'], index: true, local: true)
|
8
8
|
|
9
9
|
Rake::TestTask.new do |t|
|
10
10
|
t.test_files = ['test/tests.rb']
|
data/bin/rokko
CHANGED
@@ -78,7 +78,7 @@ end
|
|
78
78
|
|
79
79
|
# Generate and use specified file as index.
|
80
80
|
if options[:index] && source_index = sources.find{|s| s == options[:index]}
|
81
|
-
rokko = Rokko::Rokko.new(source_index, sources, options.merge(:
|
81
|
+
rokko = Rokko::Rokko.new(source_index, sources, options.merge(preserve_urls: true))
|
82
82
|
dest = File.join(output_dir, 'index.html')
|
83
83
|
puts "rokko: #{source_index} -> index.html"
|
84
84
|
File.open(dest, 'wb') {|fd| fd.write(rokko.to_html)}
|
data/lib/rokko.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# ## Rokko -- fat-free [Rocco](http://rtomayko.github.com/rocco/)
|
2
2
|
# Rokko is an else one Ruby port of [Docco](http://jashkenas.github.com/docco/),
|
3
3
|
# the quick-and-dirty, hundred-line-long, literate-programming-style documentation generator.
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Rokko reads Ruby source files and produces annotated source documentation in HTML format.
|
6
6
|
# Comments are formatted with Markdown and presented alongside syntax highlighted code so as
|
7
7
|
# to give an annotation effect.
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# ### Why Rokko?
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# * Rokko supports only Ruby source files (consider using [Rocco](http://rtomayko.github.com/rocco/)
|
12
12
|
# if you need more languages).
|
13
13
|
# * Rokko uses awesome [highlight.js](http://softwaremaniacs.org/soft/highlight/en/) library
|
@@ -15,16 +15,16 @@
|
|
15
15
|
# * Rokko can generate offline-ready documentation (all assets are bundled).
|
16
16
|
# * Rokko can generate an index file with links to everything (like Table of Contents).
|
17
17
|
|
18
|
-
# We'll definitely need
|
18
|
+
# We'll definitely need Redcarpet (Markdown library)
|
19
19
|
# and Mustache (templating engine)
|
20
|
-
require '
|
20
|
+
require 'redcarpet'
|
21
21
|
require 'mustache'
|
22
22
|
require File.expand_path('../rokko/version', __FILE__)
|
23
23
|
|
24
24
|
# ### Public interface
|
25
25
|
# `Rokko.new` takes a filename, an optional list of source filenames
|
26
26
|
# for other documentation sources, an options hash, and an optional block.
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# When `block` is given, it must return a string with file contents.
|
29
29
|
# With no `block`, the file is read to retrieve data.
|
30
30
|
module Rokko
|
@@ -38,21 +38,34 @@ module Rokko
|
|
38
38
|
@@comment_pattern = /^\s*#(?!\{)\s?/
|
39
39
|
@@block_comment_start = /^\s*=begin\s*$/
|
40
40
|
@@block_comment_end = /^\s*=end\s*$/
|
41
|
-
|
41
|
+
|
42
42
|
def initialize(filename, sources = [], options = {}, &block)
|
43
43
|
@file = filename
|
44
44
|
@sources = sources
|
45
45
|
@options = options
|
46
|
-
|
46
|
+
|
47
47
|
@data = if block_given?
|
48
48
|
yield
|
49
49
|
else
|
50
50
|
File.read(filename)
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
@sections = prettify(split(parse(@data)))
|
54
54
|
end
|
55
55
|
|
56
|
+
# Markdown renderer shared between `Rokko` and `IndexLayout` classes.
|
57
|
+
#
|
58
|
+
# `fenced_code_blocks: true` enables parsing of code blocks
|
59
|
+
# delimeted with 3 or more `~` or backticks:
|
60
|
+
#
|
61
|
+
# ```ruby
|
62
|
+
# puts 'ruby code'
|
63
|
+
# ```
|
64
|
+
#
|
65
|
+
def self.renderer
|
66
|
+
Redcarpet::Markdown.new(Redcarpet::Render::HTML, fenced_code_blocks: true)
|
67
|
+
end
|
68
|
+
|
56
69
|
# Parse the raw file data into a list of two-tuples. Each tuple has the form
|
57
70
|
# `[docs, code]` where both elements are arrays containing the raw lines
|
58
71
|
# parsed from the input file, comment characters stripped.
|
@@ -60,11 +73,11 @@ module Rokko
|
|
60
73
|
sections = []
|
61
74
|
docs, code = [], []
|
62
75
|
lines = data.split("\n")
|
63
|
-
|
76
|
+
|
64
77
|
# Skip shebang and encoding information
|
65
78
|
lines.shift if lines[0] =~ /^\#\!/
|
66
79
|
lines.shift if lines[0] =~ /coding[:=]\s*[-\w.]+/
|
67
|
-
|
80
|
+
|
68
81
|
in_comment_block = false
|
69
82
|
lines.each do |line|
|
70
83
|
# If we're currently in a comment block, check whether the line matches
|
@@ -77,7 +90,7 @@ module Rokko
|
|
77
90
|
end
|
78
91
|
# Otherwise, check whether the line matches the beginning of a block, or
|
79
92
|
# a single-line comment all on it's lonesome. In either case, if there's
|
80
|
-
# code, start a new section
|
93
|
+
# code, start a new section
|
81
94
|
else
|
82
95
|
if line.match(@@block_comment_start)
|
83
96
|
in_comment_block = true
|
@@ -96,11 +109,11 @@ module Rokko
|
|
96
109
|
end
|
97
110
|
end
|
98
111
|
end
|
99
|
-
|
112
|
+
|
100
113
|
sections << [docs, code] if docs.any? || code.any?
|
101
114
|
normalize_leading_spaces(sections)
|
102
115
|
end
|
103
|
-
|
116
|
+
|
104
117
|
# Normalizes documentation whitespace by checking for leading whitespace,
|
105
118
|
# removing it, and then removing the same amount of whitespace from each
|
106
119
|
# succeeding line
|
@@ -109,13 +122,14 @@ module Rokko
|
|
109
122
|
if section.any? && section[0].any?
|
110
123
|
leading_space = section[0][0].match("^\s+")
|
111
124
|
if leading_space
|
112
|
-
section[0] = section[0].map{|line| line.sub(/^#{leading_space.to_s}/, '')}
|
125
|
+
section[0] = section[0].map { |line| line.sub(/^#{leading_space.to_s}/, '') }
|
113
126
|
end
|
114
127
|
end
|
128
|
+
|
115
129
|
section
|
116
130
|
end
|
117
131
|
end
|
118
|
-
|
132
|
+
|
119
133
|
# Take the list of paired *sections* two-tuples and split into two
|
120
134
|
# separate lists: one holding the comments with leaders removed and
|
121
135
|
# one with the code blocks
|
@@ -128,26 +142,28 @@ module Rokko
|
|
128
142
|
tabs ? line.sub(/^\t+/, ' ' * tabs.captures[0].length) : line
|
129
143
|
end.join("\n")
|
130
144
|
end
|
145
|
+
|
131
146
|
[docs_blocks, code_blocks]
|
132
147
|
end
|
133
|
-
|
148
|
+
|
134
149
|
# Take the result of `split` and apply Markdown formatting to comments
|
135
150
|
def prettify(blocks)
|
136
151
|
docs_blocks, code_blocks = blocks
|
137
|
-
|
152
|
+
|
138
153
|
# Combine all docs blocks into a single big markdown document with section
|
139
154
|
# dividers and run through the Markdown processor. Then split it back out
|
140
155
|
# into separate sections
|
141
|
-
|
142
|
-
|
143
|
-
|
156
|
+
rendered_html = self.class.renderer.render(docs_blocks.join("\n\n##### DIVIDER\n\n"))
|
157
|
+
rendered_html = ' ' if rendered_html == '' # ''.split() won't return anything useful
|
158
|
+
docs_html = rendered_html.split(/\n*<h5>DIVIDER<\/h5>\n*/m)
|
159
|
+
|
144
160
|
docs_html.zip(code_blocks)
|
145
161
|
end
|
146
|
-
|
147
|
-
|
162
|
+
|
163
|
+
|
148
164
|
def to_html
|
149
165
|
require File.expand_path('../rokko/layout', __FILE__)
|
150
|
-
|
166
|
+
|
151
167
|
::Rokko::Layout.new(self).render
|
152
168
|
end
|
153
169
|
|
@@ -0,0 +1 @@
|
|
1
|
+
pre code{display:block;padding:.5em;color:#333;background:#f8f8ff}pre .comment,pre .template_comment,pre .diff .header,pre .javadoc{color:#998;font-style:italic}pre .keyword,pre .css .rule .keyword,pre .winutils,pre .javascript .title,pre .nginx .title,pre .subst,pre .request,pre .status{color:#333;font-weight:bold}pre .number,pre .hexcolor,pre .ruby .constant{color:#099}pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula{color:#d14}pre .title,pre .id,pre .coffeescript .params,pre .scss .preprocessor{color:#900;font-weight:bold}pre .javascript .title,pre .lisp .title,pre .clojure .title,pre .subst{font-weight:normal}pre .class .title,pre .haskell .type,pre .vhdl .literal,pre .tex .command{color:#458;font-weight:bold}pre .tag,pre .tag .title,pre .rules .property,pre .django .tag .keyword{color:#000080;font-weight:normal}pre .attribute,pre .variable,pre .lisp .body{color:#008080}pre .regexp{color:#009926}pre .class{color:#458;font-weight:bold}pre .symbol,pre .ruby .symbol .string,pre .lisp .keyword,pre .tex .special,pre .prompt{color:#990073}pre .built_in,pre .lisp .title,pre .clojure .built_in{color:#0086b3}pre .preprocessor,pre .pragma,pre .pi,pre .doctype,pre .shebang,pre .cdata{color:#999;font-weight:bold}pre .deletion{background:#fdd}pre .addition{background:#dfd}pre .diff .change{background:#0086b3}pre .chunk{color:#aaa}
|
@@ -0,0 +1 @@
|
|
1
|
+
var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName.toUpperCase()=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName.toUpperCase()=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+(q.parentNode?q.parentNode.className:"")).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName.toUpperCase()=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(p,r,v){var q=0;var y="";var s=[];function u(){if(!p.length||!r.length){return p.length?p:r}if(p[0].offset!=r[0].offset){return(p[0].offset<r[0].offset)?p:r}return r[0].event=="start"?p:r}function t(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}y+="<"+A.nodeName.toLowerCase()+Array.prototype.map.call(A.attributes,z).join("")+">"}function x(z){y+="</"+z.nodeName.toLowerCase()+">"}function o(z){(z.event=="start"?t:x)(z.node)}while(p.length||r.length){var w=u();y+=l(v.substr(q,w[0].offset-q));q=w[0].offset;if(w==p){s.reverse().forEach(x);do{o(w.splice(0,1)[0]);w=u()}while(w==p&&w.length&&w[0].offset==q);s.reverse().forEach(t)}else{if(w[0].event=="start"){s.push(w[0].node)}else{s.pop()}o(w.splice(0,1)[0])}}return y+l(v.substr(q))}function f(r){function o(s){return(s&&s.source)||s}function p(t,s){return RegExp(o(t),"m"+(r.cI?"i":"")+(s?"g":""))}function q(z,x){if(z.compiled){return}z.compiled=true;var u=[];if(z.k){var s={};function A(B,t){if(r.cI){t=t.toLowerCase()}t.split(" ").forEach(function(C){var D=C.split("|");s[D[0]]=[B,D[1]?Number(D[1]):1];u.push(D[0])})}z.lR=p(z.l||"\\b"+hljs.IR+"\\b(?!\\.)",true);if(typeof z.k=="string"){A("keyword",z.k)}else{for(var y in z.k){if(!z.k.hasOwnProperty(y)){continue}A(y,z.k[y])}}z.k=s}if(x){if(z.bWK){z.b="\\b("+u.join("|")+")\\b(?!\\.)\\s*"}z.bR=p(z.b?z.b:"\\B|\\b");if(!z.e&&!z.eW){z.e="\\B|\\b"}if(z.e){z.eR=p(z.e)}z.tE=o(z.e)||"";if(z.eW&&x.tE){z.tE+=(z.e?"|":"")+x.tE}}if(z.i){z.iR=p(z.i)}if(z.r===undefined){z.r=1}if(!z.c){z.c=[]}for(var w=0;w<z.c.length;w++){if(z.c[w]=="self"){z.c[w]=z}q(z.c[w],z)}if(z.starts){q(z.starts,x)}var v=[];for(var w=0;w<z.c.length;w++){v.push(o(z.c[w].b))}if(z.tE){v.push(o(z.tE))}if(z.i){v.push(o(z.i))}z.t=v.length?p(v.join("|"),true):{exec:function(t){return null}}}q(r)}function d(E,G,C,M){function o(r,P){for(var O=0;O<P.c.length;O++){var N=P.c[O].bR.exec(r);if(N&&N.index==0){return P.c[O]}}}function s(N,r){if(N.e&&N.eR.test(r)){return N}if(N.eW){return s(N.parent,r)}}function t(r,N){return !C&&N.i&&N.iR.test(r)}function y(O,r){var N=H.cI?r[0].toLowerCase():r[0];return O.k.hasOwnProperty(N)&&O.k[N]}function I(){var N=l(w);if(!B.k){return N}var r="";var Q=0;B.lR.lastIndex=0;var O=B.lR.exec(N);while(O){r+=N.substr(Q,O.index-Q);var P=y(B,O);if(P){v+=P[1];r+='<span class="'+P[0]+'">'+O[0]+"</span>"}else{r+=O[0]}Q=B.lR.lastIndex;O=B.lR.exec(N)}return r+N.substr(Q)}function z(){if(B.sL&&!e[B.sL]){return l(w)}var N=B.subLanguageMode=="continuous"?B.top:undefined;var r=B.sL?d(B.sL,w,true,N):g(w);if(B.r>0){v+=r.keyword_count;A+=r.r}B.top=r.top;return'<span class="'+r.language+'">'+r.value+"</span>"}function L(){return B.sL!==undefined?z():I()}function K(O,r){var N=O.cN?'<span class="'+O.cN+'">':"";if(O.rB){x+=N;w=""}else{if(O.eB){x+=l(r)+N;w=""}else{x+=N;w=r}}B=Object.create(O,{parent:{value:B}})}function D(N,r){w+=N;if(r===undefined){x+=L();return 0}var P=o(r,B);if(P){x+=L();K(P,r);return P.rB?0:r.length}var Q=s(B,r);if(Q){var O=B;if(!(O.rE||O.eE)){w+=r}x+=L();do{if(B.cN){x+="</span>"}A+=B.r;B=B.parent}while(B!=Q.parent);if(O.eE){x+=l(r)}w="";if(Q.starts){K(Q.starts,"")}return O.rE?0:r.length}if(t(r,B)){throw new Error('Illegal lexem "'+r+'" for mode "'+(B.cN||"<unnamed>")+'"')}w+=r;return r.length||1}var H=e[E];if(!H){throw new Error('Unknown language: "'+E+'"')}f(H);var B=M||H;var x="";for(var F=B;F!=H;F=F.parent){if(F.cN){x='<span class="'+F.cN+'">'+x}}var w="";var A=0;var v=0;try{var u,q,p=0;while(true){B.t.lastIndex=p;u=B.t.exec(G);if(!u){break}q=D(G.substr(p,u.index-p),u[0]);p=u.index+q}D(G.substr(p));for(var F=B;F.parent;F=F.parent){if(F.cN){x+="</span>"}}return{r:A,keyword_count:v,value:x,language:E,top:B}}catch(J){if(J.message.indexOf("Illegal")!=-1){return{r:0,keyword_count:0,value:l(G)}}else{throw J}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s,false);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v,true):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElementNS("http://www.w3.org/1999/xhtml","pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.bash=function(a){var c={cN:"variable",b:/\$[\w\d#@][\w\d_]*/};var b={cN:"variable",b:/\$\{(.*?)\}/};var e={cN:"string",b:/"/,e:/"/,c:[a.BE,c,b,{cN:"variable",b:/\$\(/,e:/\)/,c:a.BE}],r:0};var d={cN:"string",b:/'/,e:/'/,r:0};return{l:/-?[a-z]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[{cN:"title",b:/\w[\w\d_]*/}],r:0},a.HCM,a.NM,e,d,c,b]}}(hljs);hljs.LANGUAGES.cs=function(a){return{k:"abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await ascending descending from get group into join let orderby partial select set value var where yield",c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},a.CLCM,a.CBLCLM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},a.ASM,a.QSM,a.CNM]}}(hljs);hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10},{cN:"string",b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r{",e:"}[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r\\(",e:"\\)[a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r!",e:"![a-z]*",i:"\\n",c:[e.BE,d]},{cN:"regexp",b:"%r\\[",e:"\\][a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);hljs.LANGUAGES.diff=function(a){return{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}(hljs);hljs.LANGUAGES.javascript=function(a){return{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,sL:"xml"}],r:0},{cN:"function",bWK:true,e:/{/,k:"function",c:[{cN:"title",b:/[A-Za-z$_][0-9A-Za-z$_]*/},{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/}]}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,r:0,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",r:0,c:[{cN:"title",b:"[^ /><]+"},b]}]}}(hljs);hljs.LANGUAGES.markdown=function(a){return{c:[{cN:"header",b:"^#{1,3}",e:"$"},{cN:"header",b:"^.+?\\n[=-]{2,}$"},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",b:"\\*.+?\\*"},{cN:"emphasis",b:"_.+?_",r:0},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",b:"`.+?`"},{cN:"code",b:"^ ",e:"$",r:0},{cN:"horizontal_rule",b:"^-{3,}",e:"$"},{b:"\\[.+?\\]\\(.+?\\)",rB:true,c:[{cN:"link_label",b:"\\[.+\\]"},{cN:"link_url",b:"\\(",e:"\\)",eB:true,eE:true}]}]}}(hljs);hljs.LANGUAGES.css=function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.NM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}}(hljs);hljs.LANGUAGES.http=function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}}(hljs);hljs.LANGUAGES.java=function(a){return{k:"false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws",c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}],r:10},a.CLCM,a.CBLCLM,a.ASM,a.QSM,{cN:"class",bWK:true,e:"{",k:"class interface",eE:true,i:":",c:[{bWK:true,k:"extends implements",r:10},{cN:"title",b:a.UIR}]},a.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}}(hljs);hljs.LANGUAGES.php=function(a){var e={cN:"variable",b:"\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var b=[a.inherit(a.ASM,{i:null}),a.inherit(a.QSM,{i:null}),{cN:"string",b:'b"',e:'"',c:[a.BE]},{cN:"string",b:"b'",e:"'",c:[a.BE]}];var c=[a.BNM,a.CNM];var d={cN:"title",b:a.UIR};return{cI:true,l:a.UIR,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return implements parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try this switch continue endfor endif declare unset true false namespace trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[a.CLCM,a.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"}]},{cN:"comment",b:"__halt_compiler.+?;",eW:true,k:"__halt_compiler",l:a.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[a.BE]},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"},e,{cN:"function",bWK:true,e:"{",k:"function",i:"\\$|\\[|%",c:[d,{cN:"params",b:"\\(",e:"\\)",c:["self",e,a.CBLCLM].concat(b).concat(c)}]},{cN:"class",bWK:true,e:"{",k:"class",i:"[:\\(\\$]",c:[{bWK:true,eW:true,k:"extends",c:[d]},d]},{b:"=>"}].concat(b).concat(c)}}(hljs);hljs.LANGUAGES.python=function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var c=[{cN:"string",b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{cN:"string",b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{cN:"string",b:/(u|r|ur)'/,e:/'/,c:[a.BE],r:10},{cN:"string",b:/(u|r|ur)"/,e:/"/,c:[a.BE],r:10},{cN:"string",b:/(b|br)'/,e:/'/,c:[a.BE]},{cN:"string",b:/(b|br)"/,e:/"/,c:[a.BE]}].concat([a.ASM,a.QSM]);var e={cN:"title",b:a.UIR};var d={cN:"params",b:/\(/,e:/\)/,c:["self",a.CNM,f].concat(c)};var b={bWK:true,e:/:/,i:/[${=;\n]/,c:[e,d],r:10};return{k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:c.concat([f,a.HCM,a.inherit(b,{cN:"function",k:"def"}),a.inherit(b,{cN:"class",k:"class"}),a.CNM,{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}])}}(hljs);hljs.LANGUAGES.sql=function(a){return{cI:true,c:[{cN:"operator",b:"(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)",e:";",eW:true,k:{keyword:"all partial global month current_timestamp using go revoke smallint indicator end-exec disconnect zone with character assertion to add current_user usage input local alter match collate real then rollback get read timestamp session_user not integer bit unique day minute desc insert execute like ilike|2 level decimal drop continue isolation found where constraints domain right national some module transaction relative second connect escape close system_user for deferred section cast current sqlstate allocate intersect deallocate numeric public preserve full goto initially asc no key output collation group by union session both last language constraint column of space foreign deferrable prior connection unknown action commit view or first into float year primary cascaded except restrict set references names table outer open select size are rows from prepare distinct leading create only next inner authorization schema corresponding option declare precision immediate else timezone_minute external varying translation true case exception join hour default double scroll value cursor descriptor values dec fetch procedure delete and false int is describe char as at in varchar null trailing any absolute current_time end grant privileges when cross check write current_date pad begin temporary exec time update catalog user sql date on identity timezone_hour natural whenever interval work order cascade diagnostics nchar having left call do handler load replace truncate start lock show pragma exists number trigger if before after each row",aggregate:"count sum min max avg"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM]},a.CBLCLM,{cN:"comment",b:"--",e:"$"}]}}(hljs);hljs.LANGUAGES.ini=function(a){return{cI:true,i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}}(hljs);hljs.LANGUAGES.perl=function(e){var a="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var d={cN:"subst",b:"[$@]\\{",e:"\\}",k:a,r:10};var b={cN:"variable",b:"\\$\\d"};var i={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[e.BE,d,b,i];var h={b:"->",c:[{b:e.IR},{b:"{",e:"}"}]};var g={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var c=[b,i,e.HCM,g,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},h,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"("+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,g,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bWK:true,e:"(\\s*\\(.*?\\))?[;{]",k:"sub",r:5},{cN:"operator",b:"-\\w\\b",r:0}];d.c=c;h.c[1].c=c;return{k:a,c:c}}(hljs);hljs.LANGUAGES.objectivec=function(a){var b={keyword:"int float while private char catch export sizeof typedef const struct for union unsigned long volatile static protected bool mutable if public do return goto void enum else break extern asm case short default double throw register explicit signed typename try this switch continue wchar_t inline readonly assign property self synchronized end synthesize id optional required nonatomic super unichar finally dynamic IBOutlet IBAction selector strong weak readonly",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection UIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.CNM,a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#import",e:"$",c:[{cN:"title",b:'"',e:'"'},{cN:"title",b:"<",e:">"}]},{cN:"preprocessor",b:"#",e:"$"},{cN:"class",bWK:true,e:"({|$)",k:"interface class protocol implementation",c:[{cN:"id",b:a.UIR}]},{cN:"variable",b:"\\."+a.UIR,r:0}]}}(hljs);hljs.LANGUAGES.coffeescript=function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module exports global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f={cN:"title",b:a};var e={cN:"subst",b:"#\\{",e:"}",k:b,};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",b:"'''",e:"'''",c:[c.BE]},{cN:"string",b:"'",e:"'",c:[c.BE],r:0},{cN:"string",b:'"""',e:'"""',c:[c.BE,e]},{cN:"string",b:'"',e:'"',c:[c.BE,e],r:0},{cN:"regexp",b:"///",e:"///",c:[c.HCM]},{cN:"regexp",b:"//[gim]*",r:0},{cN:"regexp",b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{k:b,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\(",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bWK:true,k:"class",e:"$",i:"[:\\[\\]]",c:[{bWK:true,k:"extends",eW:true,i:":",c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true}])}}(hljs);hljs.LANGUAGES.nginx=function(b){var c=[{cN:"variable",b:"\\$\\d+"},{cN:"variable",b:"\\${",e:"}"},{cN:"variable",b:"[\\$\\@]"+b.UIR}];var a={eW:true,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[b.HCM,{cN:"string",b:'"',e:'"',c:[b.BE].concat(c),r:0},{cN:"string",b:"'",e:"'",c:[b.BE].concat(c),r:0},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:true,eE:true},{cN:"regexp",b:"\\s\\^",e:"\\s|{|;",rE:true,c:[b.BE].concat(c)},{cN:"regexp",b:"~\\*?\\s+",e:"\\s|{|;",rE:true,c:[b.BE].concat(c)},{cN:"regexp",b:"\\*(\\.[a-z\\-]+)+",c:[b.BE].concat(c)},{cN:"regexp",b:"([a-z\\-]+\\.)+\\*",c:[b.BE].concat(c)},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0}].concat(c)};return{c:[b.HCM,{b:b.UIR+"\\s",e:";|{",rB:true,c:[{cN:"title",b:b.UIR,starts:a}],r:0}],i:"[^\\s\\}]"}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs);hljs.LANGUAGES.apache=function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{cI:true,c:[a.HCM,{cN:"tag",b:"</?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,a.QSM]}}],i:/\S/}}(hljs);hljs.LANGUAGES.cpp=function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr"};return{k:b,i:"</",c:[a.CLCM,a.CBLCLM,a.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},a.CNM,{cN:"preprocessor",b:"#",e:"$",c:[{b:"<",e:">",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10,c:["self"]}]}}(hljs);hljs.LANGUAGES.makefile=function(a){var b={cN:"variable",b:/\$\(/,e:/\)/,c:a.BE};return{c:[a.HCM,{b:/^\w+\s*\W*=/,rB:true,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:true,starts:{e:/$/,r:0,c:[b],}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,c:[a.QSM,b]}]}}(hljs);
|
data/lib/rokko/index_layout.rb
CHANGED
@@ -14,7 +14,7 @@ class Rokko::IndexLayout < Rokko::Layout
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def readme
|
17
|
-
|
17
|
+
Rokko::Rokko.renderer.render(@readme)
|
18
18
|
end
|
19
19
|
|
20
20
|
def readme?
|
@@ -24,19 +24,19 @@ class Rokko::IndexLayout < Rokko::Layout
|
|
24
24
|
def sources
|
25
25
|
@sources.sort.map do |source|
|
26
26
|
{
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
27
|
+
path: source,
|
28
|
+
basename: File.basename(source),
|
29
|
+
url: source.sub(Regexp.new("#{File.extname(source)}$"), ".html")
|
30
30
|
}
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
# Groupped sources by dirname
|
35
35
|
def dirs
|
36
|
-
sources.inject(Hash.new{|hsh, key| hsh[key] = []}) do |c, source|
|
36
|
+
sources.inject(Hash.new{ |hsh, key| hsh[key] = [] }) do |c, source|
|
37
37
|
c[File.dirname(source[:path])].push(source)
|
38
38
|
c
|
39
|
-
end.sort.collect {|k, v| {:
|
39
|
+
end.sort.collect { |k, v| { dir: k, files: v } }
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
data/lib/rokko/layout.rb
CHANGED
@@ -3,71 +3,72 @@ require 'pathname'
|
|
3
3
|
module Rokko
|
4
4
|
class Layout < Mustache
|
5
5
|
self.template_file = File.join(File.dirname(__FILE__), 'layout.mustache')
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(doc)
|
8
8
|
@doc = doc
|
9
9
|
@options = @doc.options
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def title
|
13
13
|
File.basename(@doc.file)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def styles
|
17
17
|
if @options[:local]
|
18
18
|
docco = File.read(File.join(File.dirname(__FILE__), 'assets', 'docco.css'))
|
19
|
-
highlight = File.read(File.join(File.dirname(__FILE__), 'assets', '
|
19
|
+
highlight = File.read(File.join(File.dirname(__FILE__), 'assets', 'github.min.css'))
|
20
20
|
|
21
|
-
|
21
|
+
%(<style type="text/css" media="screen, projection">#{docco}\n#{highlight}</style>)
|
22
22
|
else
|
23
|
-
stylesheet_link = @options[:stylesheet] || "http://vast.github.
|
24
|
-
|
25
|
-
<link rel
|
23
|
+
stylesheet_link = @options[:stylesheet] || "http://vast.github.io/rokko/assets/v#{::Rokko::VERSION}/docco.css"
|
24
|
+
%(<link rel="stylesheet" href="#{stylesheet_link}" />
|
25
|
+
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.5/styles/github.min.css" />)
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def highlight_js
|
30
30
|
js = if @options[:local]
|
31
|
-
"<script>#{File.read(File.join(File.dirname(__FILE__), 'assets', 'highlight.
|
31
|
+
"<script>#{File.read(File.join(File.dirname(__FILE__), 'assets', 'highlight.min.js'))}</script>"
|
32
32
|
else
|
33
|
-
|
33
|
+
%(<script src="http://yandex.st/highlightjs/7.5/highlight.min.js"></script>)
|
34
34
|
end
|
35
|
-
|
36
|
-
js
|
35
|
+
|
36
|
+
[js, '<script>hljs.initHighlightingOnLoad();</script>'].join("\n")
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def sections
|
40
40
|
num = 0
|
41
41
|
@doc.sections.map do |docs,code|
|
42
42
|
{
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
43
|
+
docs: docs,
|
44
|
+
code: code,
|
45
|
+
num: (num += 1)
|
46
46
|
}
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def sources?
|
51
51
|
@doc.sources.length > 1
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def sources
|
55
55
|
sources = @doc.sources.sort.map do |source|
|
56
56
|
{
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
57
|
+
path: source,
|
58
|
+
basename: File.basename(source),
|
59
|
+
url: relative_url(source)
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
63
63
|
if @doc.options[:index] || @doc.options[:generate_index]
|
64
|
-
sources.unshift({:
|
64
|
+
sources.unshift({ path: 'index.html', basename: 'index', url: relative_url('index.html') })
|
65
65
|
end
|
66
66
|
|
67
67
|
sources
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
private
|
71
|
+
|
71
72
|
def relative_url(source)
|
72
73
|
if(@doc.options[:preserve_urls])
|
73
74
|
source.sub(Regexp.new("#{File.extname(source)}$"), ".html")
|
data/lib/rokko/task.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# ### Rokko Rake task
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Usage:
|
4
4
|
#
|
5
5
|
# require 'rokko/task'
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Rokko::Task.new(:rokko, 'docs', # task name, output dir
|
8
8
|
# ['lib/**/*.rb', 'README.md'],
|
9
|
-
#
|
9
|
+
# index: true, local: true)
|
10
10
|
#
|
11
11
|
# And run with:
|
12
12
|
# rake rokko
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# Available options:
|
15
15
|
#
|
16
16
|
# * `:local` -- generate offline-ready documentation.
|
17
|
-
# *
|
18
|
-
# *
|
17
|
+
# * `index: true` -- generate index.html with links (TOC) to all generated HTML files.
|
18
|
+
# * `index: <file>` -- use `<file>` as index.html.
|
19
19
|
# * `:stylesheet` -- CSS stylesheet to use instead of default one.
|
20
20
|
|
21
21
|
# `Rokko::Task.new` takes a task name, the destination directory,
|
@@ -26,7 +26,7 @@ module Rokko
|
|
26
26
|
class Task
|
27
27
|
include Rake::DSL if defined?(Rake::DSL)
|
28
28
|
|
29
|
-
def initialize(task_name='rokko', dest='docs/', sources='lib/**/*.rb', options={})
|
29
|
+
def initialize(task_name = 'rokko', dest = 'docs/', sources = 'lib/**/*.rb', options = {})
|
30
30
|
@name = task_name
|
31
31
|
@dest = dest
|
32
32
|
@sources = FileList[sources]
|
@@ -44,7 +44,7 @@ module Rokko
|
|
44
44
|
task @name do
|
45
45
|
# Find README file for `index.html` and delete it from `sources`
|
46
46
|
if @options[:generate_index]
|
47
|
-
readme_source = @sources.detect {|f| File.basename(f) =~ /README(\.(md|text|markdown|mdown|mkd|mkdn)$)?/i}
|
47
|
+
readme_source = @sources.detect { |f| File.basename(f) =~ /README(\.(md|text|markdown|mdown|mkd|mkdn)$)?/i }
|
48
48
|
readme = readme_source ? File.read(@sources.delete(readme_source)) : ''
|
49
49
|
end
|
50
50
|
|
@@ -62,15 +62,15 @@ module Rokko
|
|
62
62
|
require 'rokko/index_layout'
|
63
63
|
out_dest = File.join(@dest, 'index.html')
|
64
64
|
puts "rokko: #{out_dest}"
|
65
|
-
File.open(out_dest, 'wb') {|fd| fd.write(IndexLayout.new(@sources, readme, @options).render)}
|
65
|
+
File.open(out_dest, 'wb') { |fd| fd.write(IndexLayout.new(@sources, readme, @options).render) }
|
66
66
|
end
|
67
67
|
|
68
68
|
# Run specified file through rokko and use it as index
|
69
69
|
if @options[:index] && source_index = @sources.find{|s| s == @options[:index]}
|
70
|
-
rokko = Rokko.new(source_index, @sources, @options.merge(:
|
70
|
+
rokko = Rokko.new(source_index, @sources, @options.merge(preserve_urls: true))
|
71
71
|
out_dest = File.join(@dest, 'index.html')
|
72
72
|
puts "rokko: #{source_index} -> index.html"
|
73
|
-
File.open(out_dest, 'wb') {|fd| fd.write(rokko.to_html)}
|
73
|
+
File.open(out_dest, 'wb') { |fd| fd.write(rokko.to_html) }
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
data/lib/rokko/version.rb
CHANGED
data/rokko.gemspec
CHANGED
data/test/test_assets.rb
CHANGED
@@ -6,8 +6,8 @@ class TestRokkoAssets < Test::Unit::TestCase
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_default_stylesheet_links
|
9
|
-
assert @html.include?(
|
10
|
-
assert @html.include?(
|
9
|
+
assert @html.include?(%(<link rel="stylesheet" href="http://vast.github.io/rokko/assets/v#{::Rokko::VERSION}/docco.css" />))
|
10
|
+
assert @html.include?(%(<link rel="stylesheet" href="http://yandex.st/highlightjs/7.5/styles/github.min.css" />))
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_highlightjs_initialization
|
@@ -15,15 +15,15 @@ class TestRokkoAssets < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_default_scripts
|
18
|
-
assert @html.include?(
|
18
|
+
assert @html.include?(%(<script src="http://yandex.st/highlightjs/7.5/highlight.min.js"></script>))
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_assets_embedding
|
22
22
|
contents = rokkoize(ROKKO_FIXTURE, :local => true).to_html
|
23
23
|
|
24
24
|
assert contents.include?(asset_contents('docco.css'))
|
25
|
-
assert contents.include?(asset_contents('
|
26
|
-
assert contents.include?(asset_contents('highlight.
|
25
|
+
assert contents.include?(asset_contents('github.min.css'))
|
26
|
+
assert contents.include?(asset_contents('highlight.min.js'))
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_custom_stylesheet
|
@@ -36,4 +36,4 @@ class TestRokkoAssets < Test::Unit::TestCase
|
|
36
36
|
def asset_contents(filename)
|
37
37
|
File.read(File.expand_path("../../lib/rokko/assets/#{filename}",__FILE__))
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rokko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Polovnyov
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: redcarpet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
@@ -68,8 +68,8 @@ files:
|
|
68
68
|
- bin/rokko
|
69
69
|
- lib/rokko.rb
|
70
70
|
- lib/rokko/assets/docco.css
|
71
|
-
- lib/rokko/assets/
|
72
|
-
- lib/rokko/assets/highlight.
|
71
|
+
- lib/rokko/assets/github.min.css
|
72
|
+
- lib/rokko/assets/highlight.min.js
|
73
73
|
- lib/rokko/index_layout.mustache
|
74
74
|
- lib/rokko/index_layout.rb
|
75
75
|
- lib/rokko/layout.mustache
|
@@ -1,63 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
4
|
-
|
5
|
-
*/
|
6
|
-
|
7
|
-
pre .comment {
|
8
|
-
color: #998;
|
9
|
-
font-style: italic
|
10
|
-
}
|
11
|
-
|
12
|
-
pre .keyword,
|
13
|
-
pre .subst {
|
14
|
-
color: #333;
|
15
|
-
font-weight: bold
|
16
|
-
}
|
17
|
-
|
18
|
-
pre .number,
|
19
|
-
pre .ruby .constant {
|
20
|
-
color: #099;
|
21
|
-
}
|
22
|
-
|
23
|
-
pre .string {
|
24
|
-
color: #d14
|
25
|
-
}
|
26
|
-
|
27
|
-
pre .title {
|
28
|
-
color: #900;
|
29
|
-
font-weight: bold
|
30
|
-
}
|
31
|
-
|
32
|
-
pre .subst {
|
33
|
-
font-weight: normal
|
34
|
-
}
|
35
|
-
|
36
|
-
pre .class .title {
|
37
|
-
color: #458;
|
38
|
-
font-weight: bold
|
39
|
-
}
|
40
|
-
|
41
|
-
pre .attribute,
|
42
|
-
pre .variable {
|
43
|
-
color: #008080
|
44
|
-
}
|
45
|
-
|
46
|
-
pre .regexp {
|
47
|
-
color: #009926
|
48
|
-
}
|
49
|
-
|
50
|
-
pre .class {
|
51
|
-
color: #458;
|
52
|
-
font-weight: bold
|
53
|
-
}
|
54
|
-
|
55
|
-
pre .symbol,
|
56
|
-
pre .ruby .symbol .string {
|
57
|
-
color: #990073
|
58
|
-
}
|
59
|
-
|
60
|
-
pre .shebang {
|
61
|
-
color: #999;
|
62
|
-
font-weight: bold
|
63
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/</gm,"<")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(C,D){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=E.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function F(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():F()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function G(K,r){w+=K;if(r===undefined){x+=J();return}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE}if(t(r,A)){throw"Illegal"}}var E=e[C];f(E);var A=E;var w="";var B=0;var v=0;var x="";try{var u,q=0;while(true){A.t.lastIndex=q;u=A.t.exec(D);if(!u){break}var p=G(D.substr(q,u.index-q),u[0]);q=u.index+(p?0:u[0].length)}G(D.substr(q),undefined);return{r:B,keyword_count:v,value:x,language:C}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(D)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var k=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var i=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:i,r:0},{cN:"string",b:'"',e:'"',c:i,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:i},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:i},{cN:"string",b:"%[qw]?{",e:"}",c:i},{cN:"string",b:"%[qw]?<",e:">",c:i,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:i,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:i,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:i,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:i,r:10}];var h={cN:"function",bWK:true,e:" |$|;",k:"def",c:[{cN:"title",b:j,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(k)};var f=k.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(k)},h,{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([{b:j}]),r:0},{cN:"symbol",b:a+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:k.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE,d]}]),r:0}]));d.c=f;h.c[1].c=f;return{l:a,k:g,c:f}}(hljs);
|