cheap-impression-presenter 1.0.0

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.
@@ -0,0 +1,33 @@
1
+ module Chimp
2
+ module Plugin
3
+ class SIXEL < Base
4
+ def process(what,parameters,screen,additional)
5
+ if parameters[0] !~ /\d/
6
+ screen.print 'Use ```sixel,NUM with NUM beeing the width if the picture in characters.'
7
+ return
8
+ end
9
+
10
+ printit = if what =~ /\.svg$/
11
+ "inkscape -D -d 300 --export-type=png #{File.join(File.dirname(additional[:fname]),what)} -o - | img2sixel -w #{parameters[0].to_i*10}"
12
+ else
13
+ "img2sixel -w #{parameters[0].to_i*10} #{File.join(File.dirname(additional[:fname]),what)}"
14
+ end
15
+ if parameters.include? 'right'
16
+ pos = screen.get_pos
17
+ len = screen.columns
18
+ screen.print " " * (len-parameters[0].to_i)
19
+ screen.print `#{printit}`
20
+ screen.set_pos *pos
21
+ elsif parameters.include? 'center'
22
+ len = screen.columns
23
+ screen.print " " * ((len-parameters[0].to_i)/2)
24
+ screen.print `#{printit}`
25
+ x, y = screen.get_pos
26
+ screen.set_pos 0,y
27
+ else
28
+ screen.print `#{printit}`
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
data/tools/chimp ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby
2
+
3
+ curpath = __FILE__
4
+ while ::File::symlink?(curpath)
5
+ curpath = ::File::dirname(curpath) + '/' + ::File::readlink(curpath)
6
+ end
7
+ require 'optparse'
8
+ require_relative '../lib/ChimpParser'
9
+ require_relative '../lib/ChimpPlugin'
10
+ require_relative '../lib/ChimpParser-Grammar'
11
+ require_relative '../lib/output/screen'
12
+
13
+ ARGV.options { |opt|
14
+ opt.summary_indent = ' ' * 2
15
+ opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] [FILENAME]\n"
16
+ opt.on("Options:")
17
+ opt.on("--help", "-h", "This text") { puts opt; exit }
18
+ opt.on("Filename needs to be a chimp presentation.")
19
+ opt.parse!
20
+ }
21
+ if ARGV.length == 0 || !File.exist?(ARGV[0])
22
+ puts ARGV.options
23
+ exit
24
+ end
25
+
26
+ grammy = Chimp::Parser::SimpleGrammar.parse File::read(ARGV[0]), :fname => File.realpath(ARGV[0])
27
+ screen = Chimp::Parser::Screen.new
28
+ grammy.prepare screen
29
+ grammy.output screen
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cheap-impression-presenter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Juergen eTM Mangler
8
+ bindir: tools
9
+ cert_chain: []
10
+ date: 2025-06-15 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: tty-screen
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.8'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.8'
26
+ - !ruby/object:Gem::Dependency
27
+ name: pastel
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.8'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.8'
40
+ description: see https://github.com/etm/chimp
41
+ email: juergen.mangler@gmail.com
42
+ executables:
43
+ - chimp
44
+ extensions: []
45
+ extra_rdoc_files:
46
+ - README.md
47
+ - INSTALL.md
48
+ files:
49
+ - AUTHORS
50
+ - INSTALL.md
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - chimp.gemspec
55
+ - lib/ChimpParser-Grammar.rb
56
+ - lib/ChimpParser.rb
57
+ - lib/ChimpPlugin.rb
58
+ - lib/output/screen.rb
59
+ - lib/plugins/figlet.rb
60
+ - lib/plugins/lnums.rb
61
+ - lib/plugins/sixel.rb
62
+ - tools/chimp
63
+ homepage: https://github.com/etm/chimp
64
+ licenses:
65
+ - GPL-3.0-or-later
66
+ metadata: {}
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.7.0
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.6.2
82
+ specification_version: 4
83
+ summary: CHIMP - Make a cheap impression. Present via terminal.
84
+ test_files: []