vimdeck 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.7
data/bin/vimdeck CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'vimdeck'
3
+ # require 'vimdeck'
4
+ require_relative File.dirname(__FILE__)+"/../../lib/vimdeck.rb"
4
5
 
5
6
  Vimdeck.slideshow(ARGV[0])
@@ -8,5 +8,8 @@ b <%= buffer[:num] %>
8
8
  <% if buffer[:code] %>
9
9
  <%= buffer[:code][:start] %>,<%= buffer[:code][:end] %>SyntaxInclude <%= buffer[:code][:language] %>
10
10
  <% end %>
11
+ <% buffer[:comments].each do |comment| %>
12
+ call matchadd("Comment", "<%= comment %>")
13
+ <% end %>
11
14
  <% end %>
12
15
  b 1
data/lib/vimdeck.rb CHANGED
@@ -68,24 +68,36 @@ module Vimdeck
68
68
  code_height = code[0].split("\n").length - 2
69
69
  code = code[0].gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
70
70
  slide = slide.gsub( /```[^\n]*\n/, '' ).gsub( /\n```/, '' )
71
+
72
+ if code_height > 0
73
+ start = slide.index(code)
74
+ start = slide[0..start].split("\n").length
75
+ buffer[:code][:end] = code_height + start - 1
76
+ buffer[:code][:start] = start
77
+ end
71
78
  end
72
79
 
73
80
  slide += "\n" * 80
74
-
75
- if code_height > 0
76
- start = slide.index(code)
77
- start = slide[0..start].split("\n").length
78
- buffer[:code][:end] = code_height + start - 1
79
- buffer[:code][:start] = start
80
- end
81
+ slide += "slide #{i+1}"
81
82
 
82
83
  spaces = " "
83
84
  slide = slide.gsub( /\n/, "\n#{spaces}" )
84
85
  slide = spaces + slide
85
86
  slide = slide.gsub( / *\n/, "\n" ).gsub( / *$/, '' )
86
87
 
88
+ regex = /\{\~(.*?)\~\}/m
89
+ match = slide.match(regex)
90
+ buffer[:comments] = []
91
+ while match && match[1] && match.post_match do
92
+ slide.sub!(regex, match[1])
93
+ pattern = match[1] + "||(||_.*slide #{i+1}||)||@="
94
+ buffer[:comments] << pattern.gsub(/\n/, "||n").gsub(/\[/, "||[").gsub(/\]/, "||]").gsub(/\|/, "\\").gsub(/\"/, "\\\"")
95
+ match = match.post_match.match(regex)
96
+ end
97
+
98
+ filenum = "%03d" % (i+1)
87
99
 
88
- File.open("presentation/slide#{i}.md", "w") do |file|
100
+ File.open("presentation/slide#{filenum}.md", "w") do |file|
89
101
  file.write slide
90
102
  end
91
103
 
@@ -7,21 +7,103 @@ noremap <Right> :bn<CR>
7
7
  b 1
8
8
 
9
9
 
10
+
10
11
  b 2
11
12
 
12
13
 
14
+
13
15
  b 3
14
16
 
15
17
 
18
+
16
19
  b 4
17
20
 
18
21
 
22
+ call matchadd("Comment", "• Second\\n • Third\\(\\_.*slide 4\\)\\@=")
23
+
24
+
19
25
  b 5
20
26
 
21
- 10,15SyntaxInclude ruby
27
+
28
+ call matchadd("Comment", "• First\\(\\_.*slide 5\\)\\@=")
29
+
30
+ call matchadd("Comment", "• Third\\(\\_.*slide 5\\)\\@=")
22
31
 
23
32
 
24
33
  b 6
25
34
 
26
35
 
36
+ call matchadd("Comment", "• First\\n • Second\\(\\_.*slide 6\\)\\@=")
37
+
38
+
39
+ b 7
40
+
41
+ 2,14SyntaxInclude ruby
42
+
43
+
44
+
45
+ b 8
46
+
47
+ 2,14SyntaxInclude ruby
48
+
49
+
50
+ call matchadd("Comment", "module Parts\\n class foo\\n def slide\\n \"of a\"\\n end\\n\\n def can\\n highlight = \\(\\_.*slide 8\\)\\@=")
51
+
52
+ call matchadd("Comment", "\\n end\\n end\\n end\\(\\_.*slide 8\\)\\@=")
53
+
54
+
55
+ b 9
56
+
57
+ 2,14SyntaxInclude ruby
58
+
59
+
60
+ call matchadd("Comment", "module Parts\\n class foo\\n def slide\\n \"of a\"\\n end\\n\\n def\\(\\_.*slide 9\\)\\@=")
61
+
62
+ call matchadd("Comment", "highlight = \"vimdeck\"\\n end\\n end\\n end\\(\\_.*slide 9\\)\\@=")
63
+
64
+
65
+ b 10
66
+
67
+ 2,14SyntaxInclude ruby
68
+
69
+
70
+ call matchadd("Comment", "module Parts\\n class foo\\n def slide\\n \"of a\"\\n end\\n\\n def can\\(\\_.*slide 10\\)\\@=")
71
+
72
+ call matchadd("Comment", "= \"vimdeck\"\\n end\\n end\\n end\\(\\_.*slide 10\\)\\@=")
73
+
74
+
75
+ b 11
76
+
77
+ 2,14SyntaxInclude ruby
78
+
79
+
80
+ call matchadd("Comment", "module\\(\\_.*slide 11\\)\\@=")
81
+
82
+ call matchadd("Comment", "class foo\\n def slide\\n \"of a\"\\n end\\n\\n def can\\n highlight = \"vimdeck\"\\n end\\n end\\n end\\(\\_.*slide 11\\)\\@=")
83
+
84
+
85
+ b 12
86
+
87
+ 2,14SyntaxInclude ruby
88
+
89
+
90
+ call matchadd("Comment", "module Parts\\n class foo\\n def slide\\(\\_.*slide 12\\)\\@=")
91
+
92
+ call matchadd("Comment", "end\\n\\n def can\\n highlight = \"vimdeck\"\\n end\\n end\\n end\\(\\_.*slide 12\\)\\@=")
93
+
94
+
95
+ b 13
96
+
97
+ 2,14SyntaxInclude ruby
98
+
99
+
100
+ call matchadd("Comment", "module Parts\\n class foo\\n def\\(\\_.*slide 13\\)\\@=")
101
+
102
+ call matchadd("Comment", "\"of a\"\\n end\\n\\n def can\\n highlight = \"vimdeck\"\\n end\\n end\\n end\\(\\_.*slide 13\\)\\@=")
103
+
104
+
105
+ b 14
106
+
107
+
108
+
27
109
  b 1
@@ -89,3 +89,4 @@
89
89
 
90
90
 
91
91
 
92
+ slide 1
@@ -102,3 +102,4 @@
102
102
 
103
103
 
104
104
 
105
+ slide 2
@@ -86,3 +86,4 @@
86
86
 
87
87
 
88
88
 
89
+ slide 3
@@ -5,9 +5,9 @@
5
5
  /_____/\__,_/_/_/\___/\__/____/
6
6
 
7
7
 
8
- - First
9
- - Second
10
- - Third
8
+ First
9
+ Second
10
+ Third
11
11
 
12
12
 
13
13
 
@@ -87,3 +87,4 @@
87
87
 
88
88
 
89
89
 
90
+ slide 4
@@ -0,0 +1,90 @@
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
+
90
+ slide 5
@@ -0,0 +1,90 @@
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
+
90
+ slide 6