tp 0.7.0pre2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dce4ec0c53ab2d9dbbb1b484e65da65b3a2dc391
4
- data.tar.gz: f216644030d74c7cbcb3c901ff1f3203de968561
3
+ metadata.gz: ed793c40721ed87cad0fbff8368009598296fc4f
4
+ data.tar.gz: 6bf5ad7637f5433d61d9f4daf476e37665385d7d
5
5
  SHA512:
6
- metadata.gz: cf0ce4dc392ba6077d19e5f57c58f53ff3a2dc09b757a57b31d221dd119a2543cfc14c6e1d17a5ffd09cf13c566ad6ba7687b01f60b35019fac4d27f7bbc8e3b
7
- data.tar.gz: 448769e2bfdb35e292e5d4f3582919b1a8f99cb66fa7b2e59f5cdea51808045bae65daeaeb284f9062c084c0b33888c5063d43a972ce7ad67500610e3d35db25
6
+ metadata.gz: 2ef9a9b36badf129ba59597d38026bc4a45d1b0ef85b2986670f63812d9bf3c4d14311bf0bd5260b183b4bb7180b46d377cc0b0e1fc334defd346ba39c73acbb
7
+ data.tar.gz: 8c27564718c1cf4607d118eb3fdba73e1a896b441b6d9c0e9f00fe89773eb220b3eff879bcdbf0f405acdbf82dfbe2db3761ac971072d590464ba2559dea0f4b
data/Readme.md CHANGED
@@ -21,6 +21,9 @@ tp slides.md
21
21
 
22
22
  Terminal Presenter
23
23
 
24
+ > These are presenter notes
25
+ > They are hidden when presenting
26
+
24
27
  # tp
25
28
 
26
29
  Presents Markdown slides in your terminal
@@ -1,25 +1,12 @@
1
1
  module Screen
2
2
  extend self
3
3
 
4
- X_GUTTER = 2
5
- Y_GUTTER = 1
6
- GUTTER_CHAR = "\u2591"
7
- SUGGEST_CHAR = "\u2588"
8
-
9
- def add_gutter(text)
10
- text = text.lines.map { |line|
11
- line == "\n" ? line : " " * X_GUTTER + line
12
- }.join
13
- text = "\n" * Y_GUTTER + text
14
- text
15
- end
16
-
17
4
  def clear!
18
5
  print "\e[2J\e[f"
19
6
  end
20
7
 
21
8
  def hide_cursor
22
- print "\e[#{height};#{width + X_GUTTER * 2}H"
9
+ print "\e[#{height};#{width}H"
23
10
  end
24
11
 
25
12
  def height
@@ -31,15 +18,13 @@ module Screen
31
18
  end
32
19
 
33
20
  def suggest(x, y)
34
- Y_GUTTER.times { print GUTTER_CHAR * (x + X_GUTTER * 2) + "\n" }
35
21
  y.times do |n|
36
22
  print "\n" if n.nonzero?
37
- print GUTTER_CHAR * X_GUTTER + SUGGEST_CHAR * x + GUTTER_CHAR * X_GUTTER
23
+ print "\u2588" * x
38
24
  end
39
- Y_GUTTER.times { print "\n" + GUTTER_CHAR * (x + X_GUTTER * 2) }
40
25
  end
41
26
 
42
27
  def width
43
- `tput cols`.to_i - X_GUTTER * 2
28
+ `tput cols`.to_i
44
29
  end
45
30
  end
@@ -11,7 +11,7 @@ module TP
11
11
 
12
12
  return unless text
13
13
 
14
- Screen.print Screen.add_gutter(text)
14
+ Screen.print text
15
15
 
16
16
  Screen.hide_cursor
17
17
 
@@ -16,7 +16,9 @@ module TP
16
16
  end
17
17
 
18
18
  def content
19
- Array(lines[2, lines.count - 2]).join
19
+ Array(lines[2, lines.count - 2]).reject { |line|
20
+ line.start_with?("> ")
21
+ }.join
20
22
  end
21
23
 
22
24
  def frames
@@ -28,11 +28,7 @@ class TP::Slide::Paragraph < TP::Slide
28
28
  end
29
29
 
30
30
  def width
31
- [Screen.width, content.length].min
32
- end
33
-
34
- def height
35
- content.wrap(Screen.width).lines.count + 2
31
+ content.length
36
32
  end
37
33
 
38
34
  def hard_width?
@@ -1,3 +1,3 @@
1
1
  module TP
2
- VERSION = "0.7.0pre2"
2
+ VERSION = "0.7.0"
3
3
  end
data/slides.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  Terminal Presenter
6
6
 
7
+ > These are presenter notes
8
+ > They are hidden when presenting
9
+
7
10
  # tp
8
11
 
9
12
  Presents Markdown slides in your terminal
@@ -3,27 +3,6 @@ require 'screen'
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Screen do
6
- describe ".add_gutter" do
7
- subject(:add_gutter) { klass.add_gutter(text) }
8
-
9
- let(:text) { " Header " }
10
-
11
- before do
12
- klass.stub width: 10
13
- end
14
-
15
- it "adds a gutter on the top and left" do
16
- expect(add_gutter).to eq("\n Header ")
17
- end
18
-
19
- context "with a paragraph slide" do
20
- let(:text) { " Header \n\nAbc" }
21
- it "indents the text and leaves a space on the right" do
22
- expect(add_gutter).to eq("\n Header \n\n Abc")
23
- end
24
- end
25
- end
26
-
27
6
  describe ".clear!" do
28
7
  subject(:clear!) { klass.clear! }
29
8
 
@@ -39,8 +18,6 @@ describe Screen do
39
18
  describe ".height" do
40
19
  subject(:height) { klass.height }
41
20
 
42
- before { klass.unstub :height }
43
-
44
21
  it "returns the height" do
45
22
  height.should be_nonzero
46
23
  end
@@ -74,17 +51,9 @@ describe Screen do
74
51
  end
75
52
  end
76
53
 
77
- describe ".suggest" do
78
- it "prints the slide size with gutter" do
79
-
80
- end
81
- end
82
-
83
54
  describe ".width" do
84
55
  subject(:width) { klass.width }
85
56
 
86
- before { klass.unstub :width }
87
-
88
57
  it "returns the width" do
89
58
  width.should be_nonzero
90
59
  end
@@ -6,13 +6,5 @@ describe String do
6
6
 
7
7
  it { string.wrap(1).should == "One\ntwo\nthree\nfour\nfive" }
8
8
  it { string.wrap(10).should == "One two\nthree four\nfive" }
9
-
10
- context "with multiple lines" do
11
- let(:string) { "One two\nthree four\nfive" }
12
-
13
- it { string.wrap(1).should == "One\ntwo\nthree\nfour\nfive" }
14
- it { string.wrap(10).should == "One two\nthree four\nfive" }
15
- it { string.wrap(100).should == string }
16
- end
17
9
  end
18
10
  end
@@ -19,7 +19,7 @@ describe TP::Renderer do
19
19
  end
20
20
 
21
21
  it "prints the text to the screen" do
22
- expect(Screen).to receive(:print).with(Screen.add_gutter(text))
22
+ expect(Screen).to receive(:print).with(text)
23
23
 
24
24
  render
25
25
  end
@@ -13,15 +13,6 @@ describe TP::Slide::Paragraph do
13
13
  its(:width) { should == 15 }
14
14
  its(:height) { should == 3 }
15
15
 
16
- context "when text is wrapped" do
17
- before do
18
- Screen.stub width: 10
19
- end
20
-
21
- its(:width) { should == 10 }
22
- its(:height) { should == 4 }
23
- end
24
-
25
16
  describe "#render_terminal" do
26
17
  subject(:lines) { slide.render_terminal.lines.to_a }
27
18
 
@@ -17,4 +17,12 @@ describe TP::Slide do
17
17
 
18
18
  its(:content) { should eq("") }
19
19
  end
20
+
21
+ context "with presenter notes" do
22
+ let(:markdown) { "# Header\n\nContent\n\n> Secrets" }
23
+
24
+ it "does not include presenter notes in the content" do
25
+ expect(slide.content).to_not include("Secrets")
26
+ end
27
+ end
20
28
  end
@@ -17,6 +17,5 @@ RSpec.configure do |config|
17
17
 
18
18
  config.before do
19
19
  Screen.stub clear!: nil, print: nil
20
- Screen.stub height: 34, width: 80
21
20
  end
22
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0pre2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Campbell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderay
@@ -205,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  version: 1.9.3
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - '>'
208
+ - - '>='
209
209
  - !ruby/object:Gem::Version
210
- version: 1.3.1
210
+ version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
213
  rubygems_version: 2.0.14