reveal-ck 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +13 -0
  3. data/bin/reveal-ck +23 -8
  4. data/lib/reveal-ck.rb +6 -0
  5. data/lib/reveal-ck/build_task.rb +14 -0
  6. data/lib/reveal-ck/builder.rb +21 -0
  7. data/lib/reveal-ck/config.rb +43 -0
  8. data/lib/reveal-ck/file_slicer.rb +19 -17
  9. data/lib/reveal-ck/file_splicer.rb +30 -28
  10. data/lib/reveal-ck/file_string_replacer.rb +17 -0
  11. data/lib/reveal-ck/haml_processor.rb +17 -15
  12. data/lib/reveal-ck/presentation_builder.rb +69 -0
  13. data/lib/reveal-ck/slide_builder.rb +66 -0
  14. data/lib/reveal-ck/version.rb +1 -1
  15. data/rakelib/cucumber.rake +14 -1
  16. data/reveal.js/Gruntfile.js +132 -0
  17. data/reveal.js/LICENSE +1 -1
  18. data/reveal.js/README.md +362 -50
  19. data/reveal.js/css/print/paper.css +14 -14
  20. data/reveal.js/css/print/pdf.css +60 -30
  21. data/reveal.js/css/reveal.css +444 -149
  22. data/reveal.js/css/reveal.min.css +2 -2
  23. data/reveal.js/css/theme/README.md +8 -10
  24. data/reveal.js/css/theme/beige.css +24 -45
  25. data/reveal.js/css/theme/default.css +24 -45
  26. data/reveal.js/css/theme/moon.css +142 -0
  27. data/reveal.js/css/theme/night.css +24 -44
  28. data/reveal.js/css/theme/serif.css +27 -45
  29. data/reveal.js/css/theme/simple.css +25 -45
  30. data/reveal.js/css/theme/sky.css +26 -43
  31. data/reveal.js/css/theme/solarized.css +142 -0
  32. data/reveal.js/css/theme/source/beige.scss +2 -2
  33. data/reveal.js/css/theme/source/default.scss +2 -2
  34. data/reveal.js/css/theme/source/moon.scss +68 -0
  35. data/reveal.js/css/theme/source/night.scss +4 -4
  36. data/reveal.js/css/theme/source/serif.scss +8 -6
  37. data/reveal.js/css/theme/source/simple.scss +5 -5
  38. data/reveal.js/css/theme/source/sky.scss +9 -4
  39. data/reveal.js/css/theme/source/solarized.scss +74 -0
  40. data/reveal.js/css/theme/template/settings.scss +2 -2
  41. data/reveal.js/examples/assets/image1.png +0 -0
  42. data/reveal.js/examples/assets/image2.png +0 -0
  43. data/reveal.js/examples/barebones.html +42 -0
  44. data/reveal.js/examples/embedded-media.html +49 -0
  45. data/reveal.js/examples/slide-backgrounds.html +101 -0
  46. data/reveal.js/index.html +63 -56
  47. data/reveal.js/js/reveal.js +997 -216
  48. data/reveal.js/js/reveal.min.js +3 -3
  49. data/reveal.js/package.json +43 -29
  50. data/reveal.js/plugin/highlight/highlight.js +28 -6
  51. data/reveal.js/plugin/markdown/example.html +97 -0
  52. data/reveal.js/plugin/markdown/example.md +29 -0
  53. data/reveal.js/plugin/markdown/markdown.js +164 -11
  54. data/reveal.js/plugin/markdown/marked.js +37 -0
  55. data/reveal.js/plugin/multiplex/client.js +13 -0
  56. data/reveal.js/plugin/multiplex/index.js +56 -0
  57. data/reveal.js/plugin/multiplex/master.js +50 -0
  58. data/reveal.js/plugin/notes-server/index.js +1 -0
  59. data/reveal.js/plugin/notes-server/notes.html +8 -5
  60. data/reveal.js/plugin/notes/notes.html +133 -44
  61. data/reveal.js/plugin/notes/notes.js +3 -1
  62. data/reveal.js/plugin/print-pdf/print-pdf.js +8 -3
  63. data/reveal.js/plugin/remotes/remotes.js +13 -4
  64. data/reveal.js/plugin/search/search.js +196 -0
  65. data/reveal.js/plugin/zoom-js/zoom.js +26 -21
  66. data/spec/data/config/config.toml +6 -0
  67. data/spec/data/string_replacer/after_replace +4 -0
  68. data/spec/data/string_replacer/before_replace +4 -0
  69. data/spec/lib/reveal-ck/config_spec.rb +50 -0
  70. data/spec/lib/reveal-ck/file_slicer_spec.rb +29 -27
  71. data/spec/lib/reveal-ck/file_splicer_spec.rb +28 -26
  72. data/spec/lib/reveal-ck/file_string_replacer_spec.rb +32 -0
  73. data/spec/lib/reveal-ck/haml_processor_spec.rb +28 -26
  74. metadata +82 -27
  75. data/rakelib/presentation.rake +0 -41
  76. data/rakelib/reveal.rake +0 -15
  77. data/reveal.js/css/shaders/tile-flip.fs +0 -64
  78. data/reveal.js/css/shaders/tile-flip.vs +0 -141
  79. data/reveal.js/grunt.js +0 -84
  80. data/reveal.js/plugin/markdown/showdown.js +0 -62
@@ -1,41 +0,0 @@
1
- require 'rake/clean'
2
-
3
- # FileLists
4
- DIR_IMAGES_FILES = FileList["images/**/*"]
5
-
6
- revealjs = File.expand_path(File.join(File.dirname(__FILE__), '..', 'reveal.js'))
7
- REVEAL_FILES = FileList["#{revealjs}/**/*"]
8
-
9
- #
10
- # task: slides
11
- task 'slides' do
12
- mkdir_p 'slides', verbose: false
13
- end
14
- CLEAN.include 'slides'
15
-
16
- #
17
- # task: slides.html
18
- desc 'Build slides.html'
19
- file 'slides/slides.html' => [ 'slides.haml', 'slides' ] do
20
- processor = HamlProcessor.open 'slides.haml'
21
- File.open('slides/slides.html', 'w') { |f| f << processor.html }
22
- end
23
- CLEAN.include 'slides/slides.html'
24
-
25
- #
26
- # task: presentation
27
- desc 'Build presentation'
28
- task :presentation => [ 'slides/slides.html'] do
29
- cp_r REVEAL_FILES, 'slides', verbose: false
30
- mkdir_p 'slides/images', verbose: false
31
- cp_r DIR_IMAGES_FILES, 'slides/images', verbose: false
32
- line_nums = {
33
- default_slides: {
34
- first: 37,
35
- last: 338
36
- }
37
- }
38
- default_slides = line_nums[:default_slides][:first]..line_nums[:default_slides][:last]
39
- FileSlicer.remove! 'slides/index.html', default_slides
40
- FileSplicer.insert! 'slides/slides.html', into: 'slides/index.html', after: '<div class="slides">'
41
- end
@@ -1,15 +0,0 @@
1
- require 'rake/clean'
2
-
3
- file 'reveal.js/index.html' do
4
- `git submodule init`
5
- `git submodule update`
6
- end
7
-
8
- CLOBBER.include 'reveal.js'
9
- task :clobber do
10
- # Spirit of clobber is to bring repository back to pristine state
11
- # after cloning. If that's the case, then we want to rm -r reveal.js
12
- # && mkdir reveal.js. By observation, redefining the task :clobber
13
- # and adding this mkdir achieves that
14
- mkdir 'reveal.js'
15
- end
@@ -1,64 +0,0 @@
1
- /*
2
- * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3
- * Copyright (c) 2012 Branislav Ulicny
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- precision mediump float;
19
-
20
- // Uniform values from CSS
21
-
22
- uniform float amount;
23
- uniform float tileOutline;
24
-
25
- // Built-in uniforms
26
-
27
- uniform vec2 u_meshSize;
28
- uniform vec2 u_textureSize;
29
-
30
- // Varyings passed in from vertex shader
31
-
32
- varying float v_depth;
33
- varying vec2 v_uv;
34
-
35
- // Main
36
-
37
- void main()
38
- {
39
- // FIXME: Must swap x and y as a workaround for:
40
- // https://bugs.webkit.org/show_bug.cgi?id=96285
41
- vec2 u_meshSize = u_meshSize.yx;
42
-
43
- vec4 c = vec4(1.0);
44
-
45
- // Fade out.
46
- c.a = 1.0 - v_depth;
47
-
48
- // Show grid outline.
49
- if (tileOutline >= 0.5) {
50
- float cell_width = u_textureSize.x / u_meshSize.y;
51
- float cell_height = u_textureSize.y / u_meshSize.x;
52
- float dd = 1.0;
53
-
54
- if (mod(v_uv.x * u_textureSize.x + dd, cell_width) < 2.0
55
- || mod(v_uv.y * u_textureSize.y + dd, cell_height) < 2.0) {
56
- if (amount > 0.0)
57
- c.rgb = vec3(1.0 - sqrt(amount));
58
- }
59
- }
60
- css_ColorMatrix = mat4(c.r, 0.0, 0.0, 0.0,
61
- 0.0, c.g, 0.0, 0.0,
62
- 0.0, 0.0, c.b, 0.0,
63
- 0.0, 0.0, 0.0, c.a);
64
- }
@@ -1,141 +0,0 @@
1
- /*
2
- * Copyright (c)2012 Adobe Systems Incorporated. All rights reserved.
3
- * Copyright (c)2012 Branislav Ulicny
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
-
18
- precision mediump float;
19
-
20
- // Built-in attributes
21
-
22
- attribute vec4 a_position;
23
- attribute vec2 a_texCoord;
24
- attribute vec3 a_triangleCoord;
25
-
26
- // Built-in uniforms
27
-
28
- uniform mat4 u_projectionMatrix;
29
- uniform vec2 u_meshSize;
30
- uniform vec2 u_textureSize;
31
-
32
- // Uniform passed in from CSS
33
-
34
- uniform mat4 transform;
35
- uniform float amount;
36
- uniform float randomness;
37
- uniform vec3 flipAxis;
38
-
39
- // Varyings
40
-
41
- varying float v_depth;
42
- varying vec2 v_uv;
43
-
44
- // Constants
45
-
46
- const float PI2 = 1.5707963267948966;
47
-
48
- // Create perspective matrix
49
-
50
- mat4 perspectiveMatrix(float p)
51
- {
52
- float perspective = - 1.0 / p;
53
- return mat4(
54
- 1.0, 0.0, 0.0, 0.0,
55
- 0.0, 1.0, 0.0, 0.0,
56
- 0.0, 0.0, 1.0, perspective,
57
- 0.0, 0.0, 0.0, 1.0
58
- );
59
- }
60
-
61
- // Rotate vector
62
-
63
- vec3 rotateVectorByQuaternion(vec3 v, vec4 q)
64
- {
65
- vec3 dest = vec3(0.0);
66
-
67
- float x = v.x, y = v.y, z = v.z;
68
- float qx = q.x, qy = q.y, qz = q.z, qw = q.w;
69
-
70
- // Calculate quaternion * vector.
71
-
72
- float ix = qw * x + qy * z - qz * y,
73
- iy = qw * y + qz * x - qx * z,
74
- iz = qw * z + qx * y - qy * x,
75
- iw = -qx * x - qy * y - qz * z;
76
-
77
- // Calculate result * inverse quaternion.
78
-
79
- dest.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
80
- dest.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
81
- dest.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
82
-
83
- return dest;
84
- }
85
-
86
- // Convert rotation.
87
-
88
- vec4 axisAngleToQuaternion(vec3 axis, float angle)
89
- {
90
- vec4 dest = vec4(0.0);
91
-
92
- float halfAngle = angle / 2.0;
93
- float s = sin(halfAngle);
94
-
95
- dest.x = axis.x * s;
96
- dest.y = axis.y * s;
97
- dest.z = axis.z * s;
98
- dest.w = cos(halfAngle);
99
-
100
- return dest;
101
- }
102
-
103
- // Random function based on the tile coordinate.
104
- // This will return the same value for all the vertices in the same tile (i.e. two triangles).
105
-
106
- float random(vec2 scale)
107
- {
108
- // Use the fragment position as a different seed per-pixel.
109
- return fract(sin(dot(vec2(a_triangleCoord.x, a_triangleCoord.y), scale)) * 4000.0);
110
- }
111
-
112
- // Main
113
-
114
- void main()
115
- {
116
- // FIXME: We must swap x and y as a workaround for:
117
- // https://bugs.webkit.org/show_bug.cgi?id=96285
118
- vec2 u_meshSize = u_meshSize.yx;
119
-
120
- vec4 pos = a_position;
121
- float aspect = u_textureSize.x / u_textureSize.y;
122
-
123
- float cx = a_triangleCoord.x / u_meshSize.y - 0.5 + 0.5 / u_meshSize.y;
124
- float cy = a_triangleCoord.y / u_meshSize.x - 0.5 + 0.5 / u_meshSize.x;
125
-
126
- vec3 centroid = vec3(cx, cy, 0.0);
127
- float r = random(vec2(10.0, 80.0));
128
- float rr = mix(0.0, PI2, amount * (1.0 + randomness * r));
129
-
130
- vec4 rotation = vec4(flipAxis, rr);
131
- vec4 qRotation = axisAngleToQuaternion(normalize(rotation.xyz), rotation.w);
132
-
133
- vec3 newPosition = rotateVectorByQuaternion((pos.xyz - centroid)* vec3(aspect, 1., 1.0), qRotation) * vec3(1.0 / aspect, 1.0, 1.0) + centroid;
134
- pos.xyz = newPosition;
135
-
136
- gl_Position = u_projectionMatrix * transform * pos;
137
-
138
- // Pass varyings to the fragment shader.
139
- v_depth = abs(rr)/ PI2;
140
- v_uv = a_texCoord;
141
- }
@@ -1,84 +0,0 @@
1
- /* global module:false */
2
- module.exports = function(grunt) {
3
-
4
- // Project configuration
5
- grunt.initConfig({
6
- pkg: '<json:package.json>',
7
-
8
- inputJS: 'js/reveal.js',
9
- inputCSS: 'css/reveal.css',
10
-
11
- outputJS: 'js/reveal.min.js',
12
- outputCSS: 'css/reveal.min.css',
13
-
14
- meta: {
15
- version: '2.2',
16
- banner:
17
- '/*!\n' +
18
- ' * reveal.js <%= meta.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
19
- ' * http://lab.hakim.se/reveal-js\n' +
20
- ' * MIT licensed\n' +
21
- ' *\n' +
22
- ' * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se\n' +
23
- ' */'
24
- },
25
-
26
- lint: {
27
- files: [ 'grunt.js', '<%= inputJS %>' ]
28
- },
29
-
30
- // Tests will be added soon
31
- qunit: {
32
- files: [ 'test/**/*.html' ]
33
- },
34
-
35
- min: {
36
- dist: {
37
- src: [ '<banner:meta.banner>', '<%= inputJS %>' ],
38
- dest: '<%= outputJS %>'
39
- }
40
- },
41
-
42
- mincss: {
43
- compress: {
44
- files: {
45
- '<%= outputCSS %>': [ '<%= inputCSS %>' ]
46
- }
47
- }
48
- },
49
-
50
- jshint: {
51
- options: {
52
- curly: false,
53
- eqeqeq: true,
54
- immed: true,
55
- latedef: true,
56
- newcap: true,
57
- noarg: true,
58
- sub: true,
59
- undef: true,
60
- eqnull: true,
61
- browser: true,
62
- expr: true
63
- },
64
- globals: {
65
- head: false,
66
- module: false,
67
- console: false
68
- }
69
- },
70
-
71
- watch: {
72
- files: [ 'grunt.js', '<%= inputJS %>', '<%= inputCSS %>' ],
73
- tasks: 'default'
74
- }
75
-
76
- });
77
-
78
- // Dependencies
79
- grunt.loadNpmTasks( 'grunt-contrib-mincss' );
80
-
81
- // Default task
82
- grunt.registerTask( 'default', [ 'lint', 'mincss', 'min' ] );
83
-
84
- };
@@ -1,62 +0,0 @@
1
- //
2
- // showdown.js -- A javascript port of Markdown.
3
- //
4
- // Copyright (c) 2007 John Fraser.
5
- //
6
- // Original Markdown Copyright (c) 2004-2005 John Gruber
7
- // <http://daringfireball.net/projects/markdown/>
8
- //
9
- // Redistributable under a BSD-style open source license.
10
- // See license.txt for more information.
11
- //
12
- // The full source distribution is at:
13
- //
14
- // A A L
15
- // T C A
16
- // T K B
17
- //
18
- // <http://www.attacklab.net/>
19
- //
20
- //
21
- // Wherever possible, Showdown is a straight, line-by-line port
22
- // of the Perl version of Markdown.
23
- //
24
- // This is not a normal parser design; it's basically just a
25
- // series of string substitutions. It's hard to read and
26
- // maintain this way, but keeping Showdown close to the original
27
- // design makes it easier to port new features.
28
- //
29
- // More importantly, Showdown behaves like markdown.pl in most
30
- // edge cases. So web applications can do client-side preview
31
- // in Javascript, and then build identical HTML on the server.
32
- //
33
- // This port needs the new RegExp functionality of ECMA 262,
34
- // 3rd Edition (i.e. Javascript 1.5). Most modern web browsers
35
- // should do fine. Even with the new regular expression features,
36
- // We do a lot of work to emulate Perl's regex functionality.
37
- // The tricky changes in this file mostly have the "attacklab:"
38
- // label. Major or self-explanatory changes don't.
39
- //
40
- // Smart diff tools like Araxis Merge will be able to match up
41
- // this file with markdown.pl in a useful way. A little tweaking
42
- // helps: in a copy of markdown.pl, replace "#" with "//" and
43
- // replace "$text" with "text". Be sure to ignore whitespace
44
- // and line endings.
45
- //
46
- //
47
- // Showdown usage:
48
- //
49
- // var text = "Markdown *rocks*.";
50
- //
51
- // var converter = new Showdown.converter();
52
- // var html = converter.makeHtml(text);
53
- //
54
- // alert(html);
55
- //
56
- // Note: move the sample code to the bottom of this
57
- // file before uncommenting it.
58
- //
59
- //
60
- // Showdown namespace
61
- //
62
- var Showdown={};Showdown.converter=function(){var a,b,c,d=0;this.makeHtml=function(d){return a=new Array,b=new Array,c=new Array,d=d.replace(/~/g,"~T"),d=d.replace(/\$/g,"~D"),d=d.replace(/\r\n/g,"\n"),d=d.replace(/\r/g,"\n"),d="\n\n"+d+"\n\n",d=F(d),d=d.replace(/^[ \t]+$/mg,""),d=f(d),d=e(d),d=h(d),d=D(d),d=d.replace(/~D/g,"$$"),d=d.replace(/~T/g,"~"),d};var e=function(c){var c=c.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(c,d,e,f,g){return d=d.toLowerCase(),a[d]=z(e),f?f+g:(g&&(b[d]=g.replace(/"/g,"&quot;")),"")});return c},f=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,g),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,g),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/\n\n/g,"\n"),a},g=function(a,b){var d=b;return d=d.replace(/\n\n/g,"\n"),d=d.replace(/^\n/,""),d=d.replace(/\n+$/g,""),d="\n\n~K"+(c.push(d)-1)+"K\n\n",d},h=function(a){a=o(a);var b=t("<hr />");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=q(a),a=s(a),a=r(a),a=x(a),a=f(a),a=y(a),a},i=function(a){return a=u(a),a=j(a),a=A(a),a=m(a),a=k(a),a=B(a),a=z(a),a=w(a),a=a.replace(/ +\n/g," <br />\n"),a},j=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=G(b,"\\`*_"),b}),a},k=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,l),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,l),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,l),a},l=function(c,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]!=undefined)n=a[m],b[m]!=undefined&&(o=b[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=G(n,"*_");var p='<a href="'+n+'"';return o!=""&&(o=o.replace(/"/g,"&quot;"),o=G(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>",p},m=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,n),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,n),a},n=function(c,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]==undefined)return k;n=a[m],b[m]!=undefined&&(o=b[m])}l=l.replace(/"/g,"&quot;"),n=G(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"&quot;"),o=G(o,"*_"),p+=' title="'+o+'"',p+=" />",p},o=function(a){function b(a){return a.replace(/[^\w]/g,"").toLowerCase()}return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,c){return t('<h1 id="'+b(c)+'">'+i(c)+"</h1>")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return t('<h2 id="'+b(c)+'">'+i(c)+"</h2>")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return t("<h"+e+' id="'+b(d)+'">'+i(d)+"</h"+e+">")}),a},p,q=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return d?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=p(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=p(f);return h=e+"<"+g+">\n"+h+"</"+g+">\n",h})),a=a.replace(/~0/,""),a};p=function(a){return d++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,j=c;return g||f.search(/\n{2,}/)>-1?f=h(E(f)):(f=q(E(f)),f=f.replace(/\n$/,""),f=i(f)),"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),d--,a};var r=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=v(E(d)),d=F(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>",t(d)+e}),a=a.replace(/~0/,""),a},s=function(a){return a+="~0",a=a.replace(/\n```(.*)\n([^`]+)\n```/g,function(a,b,c){var d=b,e=c;return e=v(e),e=F(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="<pre><code class="+d+">"+e+"\n</code></pre>",t(e)}),a=a.replace(/~0/,""),a},t=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.push(a)-1)+"K\n\n"},u=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=v(f),b+"<code>"+f+"</code>"}),a},v=function(a){return a=a.replace(/&/g,"&amp;"),a=a.replace(/</g,"&lt;"),a=a.replace(/>/g,"&gt;"),a=G(a,"*_{}[]\\",!1),a},w=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),a},x=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=h(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /mg,"~0"),c=c.replace(/~0/g,""),c}),t("<blockquote>\n"+c+"\n</blockquote>")}),a},y=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),d=new Array,e=b.length;for(var f=0;f<e;f++){var g=b[f];g.search(/~K(\d+)K/g)>=0?d.push(g):g.search(/\S/)>=0&&(g=i(g),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",d.push(g))}e=d.length;for(var f=0;f<e;f++)while(d[f].search(/~K(\d+)K/)>=0){var h=c[RegExp.$1];h=h.replace(/\$/g,"$$$$"),d[f]=d[f].replace(/~K\d+K/,h)}return d.join("\n\n")},z=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),a=a.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),a},A=function(a){return a=a.replace(/\\(\\)/g,H),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,H),a},B=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return C(D(b))}),a},C=function(a){function b(a){var b="0123456789ABCDEF",c=a.charCodeAt(0);return b.charAt(c>>4)+b.charAt(c&15)}var c=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+b(a)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=c[Math.floor(Math.random()*2)](a);else if(a!=":"){var b=Math.random();a=b>.9?c[2](a):b>.45?c[1](a):c[0](a)}return a}),a='<a href="'+a+'">'+a+"</a>",a=a.replace(/">.+:/g,'">'),a},D=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},E=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},F=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f<e;f++)d+=" ";return d}),a=a.replace(/~A/g," "),a=a.replace(/~B/g,""),a},G=function(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,H),a},H=function(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}},typeof exports!="undefined"&&(exports=Showdown);