vimdeck 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'artii'
4
+ gem 'asciiart'
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ artii (2.0.3)
5
+ asciiart (0.0.5)
6
+ rainbow
7
+ rmagick
8
+ rainbow (1.1.4)
9
+ rmagick (2.13.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ artii
16
+ asciiart
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # vimdown
2
+
3
+ VIM as a presentation tool
4
+
5
+
6
+ ## Usage
7
+
8
+ 1. Write your slides in a markdown file
9
+
10
+ 2. Run `bin/vimdown` and it will generate a file for each slide and open them in VIM
11
+
12
+ ## VIM Script
13
+
14
+ Vimdown will also provide a script file that will set up keybindings for you.
15
+
16
+ PageUp/Left go backwards
17
+ PageDown/Right go forward
18
+
19
+ ##Screenshots:
20
+
21
+ Vimdown converts h1s and h2s into ascii art
22
+ ![](img/demo1.png)
23
+
24
+ Lists are displayed as they are written
25
+ ![](img/demo2.png)
26
+
27
+ Vimdown will also augment its vimscript to provide syntax highlighting
28
+ ![](img/demo3.png)
29
+
30
+ Images are even converted to ascii art!
31
+ ![](img/demo4.png)
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/bin/vimdeck CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- exec File.dirname(__FILE__) + "/../lib/vimdeck.rb"
3
+ require 'vimdeck'
4
+
5
+ Vimdeck.slideshow(ARGV[0])
data/img/demo1.png ADDED
Binary file
data/img/demo2.png ADDED
Binary file
data/img/demo3.png ADDED
Binary file
data/img/demo4.png ADDED
Binary file
data/img/vim.png ADDED
Binary file
@@ -0,0 +1,12 @@
1
+ noremap <PageUp> :bp<CR>
2
+ noremap <Left> :bp<CR>
3
+ noremap <PageDown> :bn<CR>
4
+ noremap <Right> :bn<CR>
5
+
6
+ <% @buffers.each do |buffer| %>
7
+ b <%= buffer[:num] %>
8
+ <% if buffer[:code] %>
9
+ <%= buffer[:code][:start] %>,<%= buffer[:code][:end] %>SyntaxInclude <%= buffer[:code][:language] %>
10
+ <% end %>
11
+ <% end %>
12
+ b 1
data/lib/test ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require './vimdeck2'
4
+
5
+ Vimdeck.slideshow($1)
data/lib/vimdeck.rb ADDED
@@ -0,0 +1,115 @@
1
+ require 'artii'
2
+ require 'asciiart'
3
+ require 'erb'
4
+
5
+ module Vimdeck
6
+ @slide_delimiter = "\n\n\n"
7
+
8
+ def self.artii(text, type)
9
+ if type == "large"
10
+ font = Artii::Base.new :font => 'slant'
11
+ else
12
+ font = Artii::Base.new :font => 'smslant'
13
+ end
14
+
15
+ font.asciify(text)
16
+ end
17
+
18
+ def self.ascii_art(img)
19
+ AsciiArt.new(img)
20
+ end
21
+
22
+ def self.script_template
23
+ @template.result(binding)
24
+ end
25
+
26
+ def self.create_slides(file)
27
+ slides = File.read(file).split(@slide_delimiter)
28
+ new_slides = []
29
+
30
+ @template = ERB.new(File.read(File.dirname(__FILE__) + "/templates/script.vim.erb"))
31
+ @buffers = []
32
+
33
+ slides.each_with_index do |slide, i|
34
+ new_slide = ''
35
+ headers = []
36
+
37
+ slide.each_line do |line|
38
+ match = line.match( /##\s*(.*)/ )
39
+ if match && match[1]
40
+ headers << artii(match[1], "small")
41
+ else
42
+ match = line.match( /#\s*(.*)/ )
43
+ if match && match[1]
44
+ headers << artii(match[1], "large")
45
+ end
46
+ end
47
+ end
48
+
49
+ rest = slide.gsub( /#+\s*(.*)\n/, '' )
50
+ images = rest.scan( /\!\[\]\([^\(\)]*\)/ )
51
+ text = rest.split( /\!\[\]\([^\(\)]*\)/ )
52
+
53
+ if images.length > 0
54
+ rest = ''
55
+ images.each_with_index do |img,j|
56
+ rest += text[j] if text[j]
57
+
58
+ a = AsciiArt.new(img.match(/\(([^\(\)]*)\)/)[1])
59
+ rest += a.to_ascii_art width: 30
60
+ end
61
+ end
62
+
63
+ buffer = {:num => i + 1}
64
+ code_height = 0
65
+ code = nil
66
+ if rest
67
+ code = rest.match( /```([^\n]*)\n.*\n```/m )
68
+ if code
69
+ buffer[:code] = { :language => code[1] }
70
+ code_height = code[0].split("\n").length - 2
71
+ code = code[0].gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
72
+ rest = rest.gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
73
+ end
74
+ end
75
+
76
+ headers.each do |h|
77
+ new_slide += h + "\n"
78
+ end
79
+ new_slide += rest if rest
80
+ new_slide += "\n" * 80
81
+
82
+ if code_height > 0
83
+ start = new_slide.index(code)
84
+ start = new_slide[0..start].split("\n").length
85
+ buffer[:code][:end] = code_height + start - 1
86
+ buffer[:code][:start] = start
87
+ end
88
+
89
+ spaces = " "
90
+ new_slide = new_slide.gsub( /\n/, "\n#{spaces}" )
91
+ new_slide = spaces + new_slide
92
+ new_slide = new_slide.gsub( / *\n/, "\n" ).gsub( / *$/, '' )
93
+
94
+
95
+ File.open("presentation/slide#{i}.md", "w") do |file|
96
+ file.write new_slide
97
+ end
98
+
99
+ @buffers << buffer
100
+ end
101
+
102
+ File.open("presentation/script.vim", "w") do |file|
103
+ file.write script_template
104
+ end
105
+ end
106
+
107
+ def self.open_vim
108
+ exec 'vim presentation/*.md -S presentation/script.vim'
109
+ end
110
+
111
+ def self.slideshow(file)
112
+ create_slides(file)
113
+ open_vim
114
+ end
115
+ end
@@ -0,0 +1,27 @@
1
+ noremap <PageUp> :bp<CR>
2
+ noremap <Left> :bp<CR>
3
+ noremap <PageDown> :bn<CR>
4
+ noremap <Right> :bn<CR>
5
+
6
+
7
+ b 1
8
+
9
+
10
+ b 2
11
+
12
+
13
+ b 3
14
+
15
+
16
+ b 4
17
+
18
+
19
+ b 5
20
+
21
+ 10,14SyntaxInclude javascript
22
+
23
+
24
+ b 6
25
+
26
+
27
+ b 1
@@ -0,0 +1,87 @@
1
+ _ ________ _______ ______________ __
2
+ | | / / _/ |/ / __ \/ ____/ ____/ //_/
3
+ | | / // // /|_/ / / / / __/ / / / ,<
4
+ | |/ // // / / / /_/ / /___/ /___/ /| |
5
+ |___/___/_/ /_/_____/_____/\____/_/ |_|
6
+
7
+
8
+ Presentations with nothing but vim
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
@@ -0,0 +1,104 @@
1
+ _ ________ ___ ____ ____ ________ _______ __
2
+ | | / / _/ |/ / / __ \/ __ \/ ____/ //_/ ___// /
3
+ | | / // // /|_/ / / /_/ / / / / / / ,< \__ \/ /
4
+ | |/ // // / / / / _, _/ /_/ / /___/ /| |___/ /_/
5
+ |___/___/_/ /_/ /_/ |_|\____/\____/_/ |_/____(_)
6
+
7
+
8
+ +------------------------------+
9
+ | :.. |
10
+ | ~===..=+.++==:.+==+======. |
11
+ | ~oooooooo==~:..+=oooooooo~ |
12
+ | .+oo=oo=::....:=oooooo+.. |
13
+ | .=ooooo=.::::+ooooo=++. |
14
+ | .=ooooo=:+:+ooooo=+:~+. |
15
+ | ..:.=ooo=o==+ooooo=+:.::.... |
16
+ |.+::.=oooooooooooo+::.........|
17
+ | ..:ooooooooo====:.......:. |
18
+ | .ooooooooo+++:......... |
19
+ | .=ooooo==~~==.+=++==+=+. |
20
+ | .=ooo==~:.++.:=+.==+.==. |
21
+ | .=oo=:..:+=:=o=.:=+~=+. |
22
+ | .~~. ..::~:. ~..~..~ |
23
+ | .~ |
24
+ +------------------------------+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
@@ -0,0 +1,89 @@
1
+ _ __ __ __ __ _ __
2
+ / | / /_ ______ ___ / /_ ___ ________ ____/ / / / (_)____/ /_
3
+ / |/ / / / / __ `__ \/ __ \/ _ \/ ___/ _ \/ __ / / / / / ___/ __/
4
+ / /| / /_/ / / / / / / /_/ / __/ / / __/ /_/ / / /___/ (__ ) /_
5
+ /_/ |_/\__,_/_/ /_/ /_/_.___/\___/_/ \___/\__,_/ /_____/_/____/\__/
6
+
7
+
8
+ 1. This is how a numbered list
9
+ 2. Looks in vimdeck
10
+ 3. What do you think?
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
@@ -0,0 +1,89 @@
1
+ ____ ____ __
2
+ / __ )__ __/ / /__ / /______
3
+ / __ / / / / / / _ \/ __/ ___/
4
+ / /_/ / /_/ / / / __/ /_(__ )
5
+ /_____/\__,_/_/_/\___/\__/____/
6
+
7
+
8
+ - First
9
+ - Second
10
+ - Third
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
@@ -0,0 +1,93 @@
1
+ ______ __
2
+ / ____/___ ____/ /__
3
+ / / / __ \/ __ / _ \
4
+ / /___/ /_/ / /_/ / __/
5
+ \____/\____/\__,_/\___/
6
+
7
+
8
+ Vimdeck does syntax highlighting too!
9
+
10
+ var x = true;
11
+
12
+ if ( x ) {
13
+ console.log( 'foo' );
14
+ }
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
@@ -0,0 +1,86 @@
1
+ ________ ______ ____
2
+ /_ __/ /_ ___ / ____/___ ____/ / /
3
+ / / / __ \/ _ \ / __/ / __ \/ __ / /
4
+ / / / / / / __/ / /___/ / / / /_/ /_/
5
+ /_/ /_/ /_/\___/ /_____/_/ /_/\__,_(_)
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
data/slides.md ADDED
@@ -0,0 +1,38 @@
1
+ # VIMDECK
2
+
3
+ Presentations with nothing but vim
4
+
5
+
6
+ # VIM ROCKS!
7
+
8
+ ![](img/vim.png)
9
+
10
+
11
+ # Numbered List
12
+
13
+ 1. This is how a numbered list
14
+ 2. Looks in vimdeck
15
+ 3. What do you think?
16
+
17
+
18
+ # Bullets
19
+
20
+ - First
21
+ - Second
22
+ - Third
23
+
24
+
25
+ # Code
26
+
27
+ Vimdeck does syntax highlighting too!
28
+
29
+ ```javascript
30
+ var x = true;
31
+
32
+ if ( x ) {
33
+ console.log( 'foo' );
34
+ }
35
+ ```
36
+
37
+
38
+ # The End!
data/vimdeck-0.0.1.gem ADDED
Binary file
data/vimdeck.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path File.join(File.dirname(__FILE__), 'lib')
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'bundler'
6
+ require 'rake'
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = 'vimdeck'
10
+ s.version = File.read('VERSION').strip
11
+ s.date = '2013-09-18'
12
+ s.summary = 'VIMDECK'
13
+ s.description = 'VIM as a presentation tool'
14
+ s.authors = ["Tyler Benziger"]
15
+ s.email = 'tabenziger@gmail.com'
16
+ s.files = ['bin/vimdeck']
17
+ s.homepage = 'http://github.com/tybenz/vimdeck'
18
+ s.license = 'MIT'
19
+ s.require_path = ['lib']
20
+ s.files = FileList['**/**/*'].exclude /.git|.svn|.DS_Store/
21
+ s.bindir = 'bin'
22
+ s.executables = ['vimdeck']
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimdeck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,13 +19,35 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/vimdeck
22
+ - Gemfile
23
+ - Gemfile.lock
24
+ - img/demo1.png
25
+ - img/demo2.png
26
+ - img/demo3.png
27
+ - img/demo4.png
28
+ - img/vim.png
29
+ - lib/templates/script.vim.erb
30
+ - lib/test
31
+ - lib/vimdeck.rb
32
+ - presentation/script.vim
33
+ - presentation/slide0.md
34
+ - presentation/slide1.md
35
+ - presentation/slide2.md
36
+ - presentation/slide3.md
37
+ - presentation/slide4.md
38
+ - presentation/slide5.md
39
+ - README.md
40
+ - slides.md
41
+ - VERSION
42
+ - vimdeck-0.0.1.gem
43
+ - vimdeck.gemspec
22
44
  homepage: http://github.com/tybenz/vimdeck
23
45
  licenses:
24
46
  - MIT
25
47
  post_install_message:
26
48
  rdoc_options: []
27
49
  require_paths:
28
- - lib
50
+ - - lib
29
51
  required_ruby_version: !ruby/object:Gem::Requirement
30
52
  none: false
31
53
  requirements: