vimdeck 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vimdown
1
+ # vimdeck
2
2
 
3
3
  VIM as a presentation tool
4
4
 
@@ -7,24 +7,24 @@ VIM as a presentation tool
7
7
 
8
8
  1. Write your slides in a markdown file
9
9
 
10
- 2. Run `bin/vimdown` and it will generate a file for each slide and open them in VIM
10
+ 2. Run `bin/vimdeck` and it will generate a file for each slide and open them in VIM
11
11
 
12
12
  ## VIM Script
13
13
 
14
- Vimdown will also provide a script file that will set up keybindings for you.
14
+ Vimdeck will also provide a script file that will set up keybindings for you.
15
15
 
16
16
  PageUp/Left go backwards
17
17
  PageDown/Right go forward
18
18
 
19
19
  ##Screenshots:
20
20
 
21
- Vimdown converts h1s and h2s into ascii art
21
+ Vimdeck converts h1s and h2s into ascii art
22
22
  ![](img/demo1.png)
23
23
 
24
24
  Lists are displayed as they are written
25
25
  ![](img/demo2.png)
26
26
 
27
- Vimdown will also augment its vimscript to provide syntax highlighting
27
+ Vimdeck will also augment its vimscript to provide syntax highlighting
28
28
  ![](img/demo3.png)
29
29
 
30
30
  Images are even converted to ascii art!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/img/demo1.png CHANGED
Binary file
data/lib/vimdeck.rb CHANGED
@@ -16,7 +16,8 @@ module Vimdeck
16
16
  end
17
17
 
18
18
  def self.ascii_art(img)
19
- AsciiArt.new(img)
19
+ a = AsciiArt.new(img)
20
+ a.to_ascii_art width: 30
20
21
  end
21
22
 
22
23
  def self.script_template
@@ -30,70 +31,62 @@ module Vimdeck
30
31
  @buffers = []
31
32
 
32
33
  Dir.mkdir("presentation") unless File.exists?("presentation")
34
+
33
35
  slides.each_with_index do |slide, i|
34
- new_slide = ''
35
- headers = []
36
+ code_block = false
36
37
 
37
38
  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*(.*)/ )
39
+ match = line.match( /```(.*)$/ )
40
+ if !code_block && match && match[1]
41
+ code_block = true
42
+ elsif code_block && line.match( /```/ )
43
+ code_block=false
44
+ elsif !code_block
45
+ match = line.match( /##\s*(.*)\n/ )
43
46
  if match && match[1]
44
- headers << artii(match[1], "large")
47
+ slide.sub!( match[0], artii(match[1], "small") + "\n" )
48
+ else
49
+ match = line.match( /#\s*(.*)\n/ )
50
+ if match && match[1]
51
+ slide.sub!( match[0], artii(match[1], "large") + "\n" )
52
+ else
53
+ match = line.match( /\!\[\]\(([^\(\)]*)\)/ )
54
+ if match && match[1]
55
+ slide.sub!(match[0], self.ascii_art(match[1]))
56
+ end
57
+ end
45
58
  end
46
59
  end
47
60
  end
48
61
 
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
62
  buffer = {:num => i + 1}
64
63
  code_height = 0
65
64
  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
65
+ code = slide.match( /```([^\n]*)\n.*\n```/m )
66
+ if code
67
+ buffer[:code] = { :language => code[1] }
68
+ code_height = code[0].split("\n").length - 2
69
+ code = code[0].gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
70
+ slide = slide.gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
74
71
  end
75
72
 
76
- headers.each do |h|
77
- new_slide += h + "\n"
78
- end
79
- new_slide += rest if rest
80
- new_slide += "\n" * 80
73
+ slide += "\n" * 80
81
74
 
82
75
  if code_height > 0
83
- start = new_slide.index(code)
84
- start = new_slide[0..start].split("\n").length
76
+ start = slide.index(code)
77
+ start = slide[0..start].split("\n").length
85
78
  buffer[:code][:end] = code_height + start - 1
86
79
  buffer[:code][:start] = start
87
80
  end
88
81
 
89
82
  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( / *$/, '' )
83
+ slide = slide.gsub( /\n/, "\n#{spaces}" )
84
+ slide = spaces + slide
85
+ slide = slide.gsub( / *\n/, "\n" ).gsub( / *$/, '' )
93
86
 
94
87
 
95
88
  File.open("presentation/slide#{i}.md", "w") do |file|
96
- file.write new_slide
89
+ file.write slide
97
90
  end
98
91
 
99
92
  @buffers << buffer
@@ -18,7 +18,7 @@ b 4
18
18
 
19
19
  b 5
20
20
 
21
- 10,14SyntaxInclude javascript
21
+ 10,15SyntaxInclude ruby
22
22
 
23
23
 
24
24
  b 6
@@ -1,8 +1,7 @@
1
- _ __ __ __ __ _ __
2
- / | / /_ ______ ___ / /_ ___ ________ ____/ / / / (_)____/ /_
3
- / |/ / / / / __ `__ \/ __ \/ _ \/ ___/ _ \/ __ / / / / / ___/ __/
4
- / /| / /_/ / / / / / / /_/ / __/ / / __/ /_/ / / /___/ (__ ) /_
5
- /_/ |_/\__,_/_/ /_/ /_/_.___/\___/_/ \___/\__,_/ /_____/_/____/\__/
1
+ _ __ __ __ __ _ __
2
+ / |/ /_ ____ _ / / ___ _______ ___/ / / / (_)__/ /_
3
+ / / // / ' \/ _ \ -_) __/ -_) _ / / /__/ (_-< __/
4
+ /_/|_/\_,_/_/_/_/_.__\__/_/ \__/\_,_/ /____/_/___\__/
6
5
 
7
6
 
8
7
  1. This is how a numbered list
@@ -7,11 +7,12 @@
7
7
 
8
8
  Vimdeck does syntax highlighting too!
9
9
 
10
- var x = true;
10
+ require 'erb'
11
11
 
12
- if ( x ) {
13
- console.log( 'foo' );
14
- }
12
+ template = ERB.new('template.erb')
13
+
14
+ # Compile template
15
+ template.result(binding)
15
16
 
16
17
 
17
18
 
data/slides.md CHANGED
@@ -8,7 +8,7 @@ Presentations with nothing but vim
8
8
  ![](img/vim.png)
9
9
 
10
10
 
11
- # Numbered List
11
+ ## Numbered List
12
12
 
13
13
  1. This is how a numbered list
14
14
  2. Looks in vimdeck
@@ -26,12 +26,13 @@ Presentations with nothing but vim
26
26
 
27
27
  Vimdeck does syntax highlighting too!
28
28
 
29
- ```javascript
30
- var x = true;
29
+ ```ruby
30
+ require 'erb'
31
31
 
32
- if ( x ) {
33
- console.log( 'foo' );
34
- }
32
+ template = ERB.new('template.erb')
33
+
34
+ # Compile template
35
+ template.result(binding)
35
36
  ```
36
37
 
37
38
 
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -39,7 +39,7 @@ files:
39
39
  - README.md
40
40
  - slides.md
41
41
  - VERSION
42
- - vimdeck-0.0.2.gem
42
+ - vimdeck-0.0.4.gem
43
43
  - vimdeck.gemspec
44
44
  homepage: http://github.com/tybenz/vimdeck
45
45
  licenses:
data/vimdeck-0.0.2.gem DELETED
Binary file