# HG changeset patch # User Paul Issott # Date 1403451366 -3600 # Node ID 08fef135770ff21b6a41d8b47bf3a2d9988ffc9d # Parent 8fcfcd2e14453247e04c2a43f997cd80c173ffa3 Add tpp diff -r 8fcfcd2e1445 -r 08fef135770f tpp/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tpp/receipt Sun Jun 22 16:36:06 2014 +0100 @@ -0,0 +1,37 @@ +# SliTaz package receipt. + +PACKAGE="tpp" +VERSION="1.3.1" +CATEGORY="utilities" +SHORT_DESC="Text presentation program." +MAINTAINER="paul@slitaz.org" +DEPENDS="ruby ruby-ncurses ncurses" +TARBALL="$PACKAGE-$VERSION.tar.gz" +WEB_SITE="http://www.ngolde.de/tpp.html" +WGET_URL="http://www.ngolde.de/download/$TARBALL" + +# Rules to configure and make the package. +compile_rules() +{ + cd $src + # use debian patches and fixes + patch -i ../../stuff/ruby19.patch + patch -i ../../stuff/optional-x.patch + cd examples + for tppfile in *.tpp; do + iconv -f ISO-8859-1 -t UTF-8 -o $tppfile.new $tppfile && \ + touch -r $tppfile $tppfile.new && \ + mv $tppfile.new $tppfile + done + cd .. + # make DESTDIR=$DESTDIR install +} + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + mkdir -p $fs/usr/bin $fs/usr/share/doc/tpp/examples + install $src/tpp.rb $fs/usr/bin/tpp + install -m644 $src/examples/* $fs/usr/share/doc/tpp/examples +} + diff -r 8fcfcd2e1445 -r 08fef135770f tpp/stuff/optional-x.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tpp/stuff/optional-x.patch Sun Jun 22 16:36:06 2014 +0100 @@ -0,0 +1,51 @@ +Description: Don't execute commands with --exec by default +Author: Axel Beckert +Debian-Bug: 706644 + +Index: tpp/tpp.rb +=================================================================== +--- tpp.orig/tpp.rb 2013-06-12 22:13:55.000000000 +0200 ++++ tpp/tpp.rb 2013-06-12 22:15:08.000000000 +0200 +@@ -725,9 +725,13 @@ + end + + def do_exec(cmdline) +- rc = Kernel.system(cmdline) +- if not rc then +- # @todo: add error message ++ if $execok then ++ rc = Kernel.system(cmdline) ++ if not rc then ++ # @todo: add error message ++ end ++ else ++ @screen.addstr("--exec disabled by default for security reasons. Use option -x to enable it.") + end + end + +@@ -1683,6 +1687,7 @@ + $stderr.puts "\t -t \tset filetype as output format" + $stderr.puts "\t -o \twrite output to file " + $stderr.puts "\t -s \twait seconds between slides (with -t autoplay)" ++ $stderr.puts "\t -x\t\tallow parsing of --exec in input files" + $stderr.puts "\t --version\tprint the version" + $stderr.puts "\t --help\t\tprint this help" + $stderr.puts "\n\t currently available types: ncurses (default), autoplay, latex, txt" +@@ -1699,6 +1704,7 @@ + output = nil + type = "ncurses" + time = 1 ++$execok = nil + + skip_next = false + +@@ -1720,6 +1726,8 @@ + elsif ARGV[i] == "-s" then + time = ARGV[i+1].to_i + skip_next = true ++ elsif ARGV[i] == "-x" then ++ $execok = 1 + elsif input == nil then + input = ARGV[i] + end + diff -r 8fcfcd2e1445 -r 08fef135770f tpp/stuff/ruby19.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tpp/stuff/ruby19.patch Sun Jun 22 16:36:06 2014 +0100 @@ -0,0 +1,294 @@ +Description: make key events work on ruby 1.9 +Author: Chad Fowler +Debian-Bug: 671530 + +Index: tpp/tpp.rb +=================================================================== +--- tpp.orig/tpp.rb 2013-06-12 18:13:40.000000000 +0200 ++++ tpp/tpp.rb 2013-06-12 21:05:55.000000000 +0200 +@@ -44,7 +44,7 @@ + "blue" => 5, + "cyan" => 6, + "magenta" => 7, +- "black" => 8, ++ "black" => 8, + "default" =>-1} + colors[color] + end +@@ -95,7 +95,7 @@ + end # class FileParser + + +-# Represents a page (aka `slide') in TPP. A page consists of a title and one or ++# Represents a page (aka `slide') in TPP. A page consists of a title and one or + # more lines. + class Page + +@@ -145,8 +145,8 @@ + + + +-# Implements a generic visualizer from which all other visualizers need to be +-# derived. If Ruby supported abstract methods, all the do_* methods would be ++# Implements a generic visualizer from which all other visualizers need to be ++# derived. If Ruby supported abstract methods, all the do_* methods would be + # abstract. + class TppVisualizer + +@@ -154,8 +154,8 @@ + # nothing + end + +- # Splits a line into several lines, where each of the result lines is at most +- # _width_ characters long, caring about word boundaries, and returns an array ++ # Splits a line into several lines, where each of the result lines is at most ++ # _width_ characters long, caring about word boundaries, and returns an array + # of strings. + def split_lines(text,width) + lines = [] +@@ -190,13 +190,13 @@ + $stderr.puts "Error: TppVisualizer#do_footer has been called directly." + Kernel.exit(1) + end +- ++ + def do_header(header_text) + $stderr.puts "Error: TppVisualizer#do_header has been called directly." + Kernel.exit(1) + end + +- ++ + def do_refresh + $stderr.puts "Error: TppVisualizer#do_refresh has been called directly." + Kernel.exit(1) +@@ -316,7 +316,7 @@ + $stderr.puts "Error: TppVisualizer#do_command_prompt has been called directly." + Kernel.exit(1) + end +- ++ + def do_beginslideright + $stderr.puts "Error: TppVisualizer#do_beginslideright has been called directly." + Kernel.exit(1) +@@ -377,7 +377,7 @@ + Kernel.exit(1) + end + +- # Receives a _line_, parses it if necessary, and dispatches it ++ # Receives a _line_, parses it if necessary, and dispatches it + # to the correct method which then does the correct processing. + # It returns whether the controller shall wait for input. + def visualize(line,eop) +@@ -446,10 +446,10 @@ + do_huge(figlet_text) + when /^--footer / + @footer_txt = line.sub(/^--footer /,"") +- do_footer(@footer_txt) ++ do_footer(@footer_txt) + when /^--header / + @header_txt = line.sub(/^--header /,"") +- do_header(@header_txt) ++ do_header(@header_txt) + when /^--title / + title = line.sub(/^--title /,"") + do_title(title) +@@ -547,7 +547,7 @@ + @withborder = true + draw_border + end +- ++ + def do_command_prompt() + message = "Press any key to continue :)" + cursor_pos = 0 +@@ -614,11 +614,11 @@ + (@termwidth-2).times { @screen.addstr("-") }; @screen.addstr("'") + 1.upto(@termheight-3) do |y| + @screen.move(y,0) +- @screen.addstr("|") ++ @screen.addstr("|") + end + 1.upto(@termheight-3) do |y| + @screen.move(y,@termwidth-1) +- @screen.addstr("|") ++ @screen.addstr("|") + end + end + +@@ -700,7 +700,7 @@ + end + + def show_help_page +- help_text = [ "tpp help", ++ help_text = [ "tpp help", + "", + "space bar ............................... display next entry within page", + "space bar, cursor-down, cursor-right .... display next page", +@@ -775,7 +775,7 @@ + @screen.move(@termheight - 3, (@termwidth - footer_txt.length)/2) + @screen.addstr(footer_txt) + end +- ++ + def do_header(header_txt) + @screen.move(@termheight - @termheight+1, (@termwidth - header_txt.length)/2) + @screen.addstr(header_txt) +@@ -918,7 +918,7 @@ + time_to_sleep = 1.to_f / 20 + Kernel.sleep(time_to_sleep) + xcount -= 1 +- end ++ end + when "right" + (@termwidth - @indent).times do |pos| + @screen.move(@cur_line,@termwidth - pos - 1) +@@ -991,7 +991,7 @@ + @screen.move(line,col*15 + 2) + if current_page == i then + @screen.printw("%2d %s <=",i+1,pages[i].title[0..80]) +- else ++ else + @screen.printw("%2d %s",i+1,pages[i].title[0..80]) + end + line += 1 +@@ -1092,7 +1092,7 @@ + + def do_footer(footer_text) + end +- ++ + def do_header(header_text) + end + +@@ -1166,7 +1166,7 @@ + + def do_revon + end +- ++ + def do_command_prompt + end + def do_revoff +@@ -1183,7 +1183,7 @@ + + def do_endslide + end +- ++ + def do_beginslideright + end + +@@ -1349,7 +1349,7 @@ + + end + +-# Implements an interactive controller which feeds the visualizer until it is ++# Implements an interactive controller which feeds the visualizer until it is + # told to stop, and then reads a key press and executes the appropiate action. + class InteractiveController < TppController + +@@ -1396,17 +1396,17 @@ + loop do + ch = @vis.get_key + case ch +- when 'q'[0], 'Q'[0] # 'Q'uit ++ when ?q.ord, ?Q.ord # 'Q'uit + return +- when 'r'[0], 'R'[0] # 'R'edraw slide ++ when ?r.ord, ?R.ord # 'R'edraw slide + changed_page = true # @todo: actually implement redraw +- when 'e'[0], 'E'[0] ++ when ?e.ord, ?E.ord + @cur_page = @pages.size - 1 + break +- when 's'[0], 'S'[0] ++ when ?s.ord, ?S.ord + @cur_page = 0 + break +- when 'j'[0], 'J'[0] # 'J'ump to slide ++ when ?j.ord, ?J.ord # 'J'ump to slide + screen = @vis.store_screen + p = @vis.read_newpage(@pages,@cur_page) + if p >= 0 and p < @pages.size +@@ -1417,28 +1417,28 @@ + @vis.restore_screen(screen) + end + break +- when 'l'[0], 'L'[0] # re'l'oad current file ++ when ?l.ord, ?L.ord # re'l'oad current file + @reload_file = true + return +- when 'c'[0], 'C'[0] # command prompt ++ when ?c.ord, ?C.ord # command prompt + screen = @vis.store_screen + @vis.do_command_prompt + @vis.clear + @vis.restore_screen(screen) +- when '?'[0], 'h'[0] ++ when ??.ord, ?h.ord + screen = @vis.store_screen + @vis.show_help_page + ch = @vis.get_key + @vis.clear + @vis.restore_screen(screen) +- when :keyright, :keydown, ' '[0] ++ when :keyright, :keydown, ' '.ord + if @cur_page + 1 < @pages.size and eop then + @cur_page += 1 + @pages[@cur_page].reset_eop + @vis.new_page + end + break +- when 'b'[0], 'B'[0], :keyleft, :keyup ++ when ?b.ord, ?B.ord, :keyleft, :keyup + if @cur_page > 0 then + @cur_page -= 1 + @pages[@cur_page].reset_eop +@@ -1455,7 +1455,7 @@ + end + + +-# Implements a visualizer which converts TPP source to a nicely formatted text ++# Implements a visualizer which converts TPP source to a nicely formatted text + # file which can e.g. be used as handout. + class TextVisualizer < TppVisualizer + +@@ -1475,7 +1475,7 @@ + + def do_footer(footer_text) + end +- ++ + def do_header(header_text) + end + +@@ -1539,7 +1539,7 @@ + + def do_revon + end +- ++ + def do_command_prompt + end + def do_revoff +@@ -1556,7 +1556,7 @@ + + def do_endslide + end +- ++ + def do_beginslideright + end + +@@ -1650,8 +1650,8 @@ + + end + +-# Implements a non-interactive controller to control non-interactive +-# visualizers (i.e. those that are used for converting TPP source code into ++# Implements a non-interactive controller to control non-interactive ++# visualizers (i.e. those that are used for converting TPP source code into + # another format) + class ConversionController < TppController +