diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/perl/texexec.pl | 14 | ||||
-rw-r--r-- | scripts/context/perl/texutil.pl | 19 | ||||
-rw-r--r-- | scripts/context/ruby/xmpl/switch.rb | 10 |
3 files changed, 30 insertions, 13 deletions
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl index 0cd31ff4b..e66e85e1d 100644 --- a/scripts/context/perl/texexec.pl +++ b/scripts/context/perl/texexec.pl @@ -193,6 +193,7 @@ my $Foxet = 0 ; my $TheEnginePath = 0 ; my $Paranoid = 0 ; my $NotParanoid = 0 ; +my $BoxType = '' ; my $StartLine = 0 ; my $StartColumn = 0 ; @@ -301,6 +302,7 @@ my $MakeMpy = ''; "engine" => \$TheEnginePath, "paranoid" => \$Paranoid, "notparanoid" => \$NotParanoid, + "boxtype=s" => \$BoxType, # media art crop bleed trim #### experiment "startline=s" => \$StartLine, "startcolumn=s" => \$StartColumn, @@ -407,7 +409,7 @@ if ( ( $LogFile ne '' ) && ( $LogFile =~ /\w+\.log$/io ) ) { *STDERR = *LOGFILE; } -my $Program = " TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005"; +my $Program = " TeXExec 5.2.5 - ConTeXt / PRAGMA ADE 1997-2005"; print "\n$Program\n\n"; @@ -1979,7 +1981,7 @@ sub DoRunModule { } sub RunFigures { - my @Files = @_; + my @Files = @_ ; $TypesetFigures = lc $TypesetFigures; return unless ( $TypesetFigures =~ /[abcd]/o ); unlink "$FiguresFile.pdf"; @@ -1990,15 +1992,19 @@ sub RunFigures { print FIG " [topspace=1.5cm,backspace=1.5cm,\n"; print FIG " header=1.5cm,footer=0pt,\n"; print FIG " width=middle,height=middle]\n"; - if ($ForceFullScreen) { print FIG "\\setupinteraction\n"; print FIG " [state=start]\n"; print FIG "\\setupinteractionscreen\n"; print FIG " [option=max]\n"; } + if ($BoxType ne '') { + if ($BoxType !~ /box$/io) { + $BoxType .= "box" ; + } + } print FIG "\\starttext\n"; - print FIG "\\showexternalfigures[alternative=$TypesetFigures,offset=$PaperOffset]\n"; + print FIG "\\showexternalfigures[alternative=$TypesetFigures,offset=$PaperOffset,size=$BoxType]\n"; print FIG "\\stoptext\n"; close(FIG); $ConTeXtInterface = "en"; diff --git a/scripts/context/perl/texutil.pl b/scripts/context/perl/texutil.pl index 240c52a0d..c53cf5053 100644 --- a/scripts/context/perl/texutil.pl +++ b/scripts/context/perl/texutil.pl @@ -2201,18 +2201,23 @@ sub HandlePdfFigure elsif ($SomeLine =~ /\/Type\s*\/Page/io) { ++$PageFound ; if ($PageFound>1) { last } } - if ((($PageFound)||($PagesFound)) && ($SomeLine =~ /\/MediaBox /io)) - { $MediaBox = $SomeLine ; - $MediaBoxFound = 1 ; - if ($PagesFound) { last } } } + if (($PageFound)||($PagesFound)) + { if (($MediaBoxFound < 2) && ($SomeLine =~ /\/ArtBox\s*\[/io)) + { $MediaBoxFound = 3 ; + $MediaBox = $SomeLine } + elsif (($MediaBoxFound < 2) && ($SomeLine =~ /\/CropBox\s*\[ /io)) + { $MediaBoxFound = 2 ; + $MediaBox = $SomeLine } + elsif (($MediaBoxFound == 0) && ($SomeLine =~ /\/MediaBox\s*\[ /io)) + { $MediaBoxFound = 1 ; + $MediaBox = $SomeLine } } } close ( PDF ) ; if ($PageFound>1) { Report ( "MultiPagePdfFile", "$SuppliedFileName" ) } -# elsif (($MediaBoxFound) && ($MediaBox)) if (($MediaBoxFound) && ($MediaBox)) { my $D = "[0-9\-\.]" ; - $MediaBox =~ /\/MediaBox\s*\[\s*($D+)\s*($D+)\s*($D+)\s*($D+)/o ; - $LLX = $1 ; $LLY = $2 ; $URX = $3 ; $URY = $4 ; + $MediaBox =~ /\/(Media|Crop|Art)Box\s*\[\s*($D+)\s*($D+)\s*($D+)\s*($D+)/o ; + $LLX = $2 ; $LLY = $3 ; $URX = $4 ; $URY = $5 ; $PdfHeight = ($URY-$LLY)*$DPtoCM ; $PdfWidth = ($URX-$LLX)*$DPtoCM ; $PdfXOffset = $LLX*$DPtoCM ; diff --git a/scripts/context/ruby/xmpl/switch.rb b/scripts/context/ruby/xmpl/switch.rb index 36cc8c346..de747bbd5 100644 --- a/scripts/context/ruby/xmpl/switch.rb +++ b/scripts/context/ruby/xmpl/switch.rb @@ -103,13 +103,19 @@ module CommandBase suffix = '.' + suffix pattern += suffix unless pattern =~ /#{suffix}$/ end + # not {} safe pattern = '**/' + pattern if @commandline.option('recurse') files = Dir[pattern] if files && files.length>0 then return files else - report("no files match pattern #{pattern}") - return nil + pattern = @commandline.argument('first') + if FileTest.file?(pattern) then + return [pattern] + else + report("no files match pattern #{pattern}") + return nil + end end end |