summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ctable/doit
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/ctable/doit')
-rw-r--r--Master/texmf-dist/doc/latex/ctable/doit58
1 files changed, 20 insertions, 38 deletions
diff --git a/Master/texmf-dist/doc/latex/ctable/doit b/Master/texmf-dist/doc/latex/ctable/doit
index 91b71e02b15..b2da791d8a9 100644
--- a/Master/texmf-dist/doc/latex/ctable/doit
+++ b/Master/texmf-dist/doc/latex/ctable/doit
@@ -1,9 +1,6 @@
-#!/usr/bin/env ruby
-require 'optparse'
+#!/usr/bin/ruby
require 'erb'
-require 'rubygems'
-require 'rio'
-require 'session'
+require 'scriptingutils'
# doit - make all or some example picture sets.
@@ -19,10 +16,8 @@ require 'session'
# The prefix (s) for source verbatims and (empty) for result files is set by PRE
# Windows users should replace NULL with perhaps "c:/temp/null"
-MYNAME = File.basename($0)
DIGS = 2
ALL = Dir["[0-9]"*DIGS+"[a-z]"].sort
- NULL = '/dev/null'
PRE = ['s','']
# clean up directory
@@ -40,53 +35,40 @@ def clean(all=false)
exit(0)
end
-# call the system shell with command
-# exit on error
-def sys(command)
- sh = Session::Bash.new
- o,e = sh.execute(command)
- unless sh.exit_status == 0
- puts "error running: #{command}",
- " exit_status: #{sh.exit_status}",
- " output: #{o}",
- " error: #{e}"
-
- exit(sh.exit_status)
- end
-end
-
@quiet = false
-ARGV.options do |opt|
- opt.banner = "Create example images\n"
- opt.banner << "No arguments: create them all\n"
- opt.banner << "Example: ./#{MYNAME} 03? # creates 03a.pdf, 03b.pdf, s03a.pdf, and s03b.pdf"
- opt.separator ""
- opt.on('-h','--help','print this help and exit') do puts opt.help; exit end
- opt.on("-c","--clean","Clean up, but keep pdf files") do clean end
- opt.on("-C","--Clean","Clean up, including pdf files") do clean(true) end
- opt.on("-q","--quiet","Be silent") do @quiet = true end
- opt.parse!
+def handle_options
+ ARGV.options do |opt|
+ opt.banner = "Create example images\n"
+ opt.banner << "No arguments: create them all\n"
+ opt.banner << "Example: ./#{MYNAME} 03? # creates 03a.pdf, 03b.pdf, s03a.pdf, and s03b.pdf"
+ opt.separator ""
+ opt.on('-h','--help','print this help and exit') do puts opt.help; exit end
+ opt.on("-c","--clean","Clean up, but keep pdf files") do clean end
+ opt.on("-C","--Clean","Clean up, including pdf files") do clean(true) end
+ opt.on("-q","--quiet","Be silent") do @quiet = true end
+ opt.parse!
+ end
end
+init(nil,:handle_options)
set = ARGV.empty? ? ALL : ARGV
tex = DATA.readlines("\n\n") # tex[0] -> source verbatim, tex[1] -> result
-sh = Session::Shell.new
set.each do |j|
puts j unless @quiet
0.upto(1) do |i|
f = "#{PRE[i]}#{j}"
- r = rio(f+'.tex') < ERB.new(tex[i]).result(binding)
- sys("pdflatex --interaction=nonstopmode #{r.path}")
+ open(f+'.tex','w') do |o| o.print ERB.new(tex[i]).result(binding) end
+ sys("pdflatex --interaction=nonstopmode #{f}")
sys("pdfcrop #{f}.pdf #{f}.pdf")
end
end
-# $Id: doit,v 1.6 2009-09-15 11:28:26 wybo Exp $
+# $Id: doit,v 1.8 2010-06-26 21:09:37 wybo Exp $
__END__
\documentclass{article}
\usepackage[a4paper,margin=20mm,noheadfoot]{geometry}
\pagestyle{empty}
\begin{document}\ttfamily
\fontsize{10}{12 pt}\selectfont
-\begin{verbatim}<%= open(j).readlines.delete_if {|x| x =~ /\$Id|remove for source/ } %>\end{verbatim}
+\begin{verbatim}<%= open(j).readlines.delete_if {|x| x =~ /\$Id|remove for source/ }.join %>\end{verbatim}
\end{document}
\documentclass[twoside]{article}
@@ -98,5 +80,5 @@ __END__
\pagestyle{empty}
\parindent0pt
\begin{document}
-<%= open(j).readlines.delete_if {|x| x =~ /\$Id/ } %>
+<%= open(j).readlines.delete_if {|x| x =~ /\$Id/ }.join %>
\end{document}