groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] GNU troff branch, master, updated. 3949425d5304d86e740ec0


From: Deri James
Subject: [Groff-commit] GNU troff branch, master, updated. 3949425d5304d86e740ec0019b2bcc1131a549fb
Date: Thu, 02 Jan 2014 15:59:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU troff".

http://git.sv.gnu.org/gitweb/?p=groff.git;a=commitdiff;h=3949425d5304d86e740ec0019b2bcc1131a549fb

The branch, master has been updated
       via  3949425d5304d86e740ec0019b2bcc1131a549fb (commit)
      from  bd60d043a586f879b2194be3accf4e0fafdff23f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3949425d5304d86e740ec0019b2bcc1131a549fb
Author: Deri James <address@hidden>
Date:   Thu Jan 2 15:46:21 2014 +0000

    pdfmom can now be used as a command pipe, gropdf
    handles preconv output

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                    |   10 ++++++
 src/devices/gropdf/gropdf.pl |    5 ++-
 src/devices/gropdf/pdfmom.pl |   69 ++++++++++++++++++++++++++++++++++++++---
 tmac/pdf.tmac                |    9 ++++-
 4 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 465105a..11d45d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-01-02  Deri James  <address@hidden>
+
+       * src/devices/gropdf/gropdf.pl: gropdf use to fail when handling
+         output from preconv, now works.
+
+       * src/devices/gropdf/pdfmom.pl: can now be used as a pipeline, and 
+         improvements made to its switch handling and use with preconv.
+
+       * tmac/pdf.tmac: changes to support preconv.
+
 2014-01-02  Colin Watson  <address@hidden>
 
        * font/devascii/Makefile.sub ($(FONTS)): Convert extended regex
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 92b3787..f18bac8 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -711,6 +711,7 @@ sub do_x
            {
                my $pdfmark=$1;
                $pdfmark=~s((\d{4,6}) u)(sprintf("%.1f",$1/$desc{sizescale}))eg;
+               $pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg;
 
                if ($pdfmark=~m/(.+) \/DOCINFO/)
                {
@@ -1125,6 +1126,7 @@ sub PutHotSpot
     $l=~s/Color/C/;
     $l=~s/Action/A/;
     $l=~s'/Subtype /URI'/S /URI';
+    $l=~s(\\\[u00(..)\])(chr(hex($1)))eg;
     my @xwds=split(' ',"<< $l >>");
     my $annotno=BuildObj(++$objct,ParsePDFValue(address@hidden));
     my $annot=$obj[$objct];
@@ -1622,7 +1624,7 @@ sub nextwd
 
     return('') if !defined($wd);
 
-    if ($wd=~m/^(.*?)(<<|>>|\[|\])(.*)/)
+    if ($wd=~m/^(.*?)(<<|>>|(?:(?<!\\)\[|\]))(.*)/)
     {
        if (defined($1) and length($1))
        {
@@ -2326,6 +2328,7 @@ sub do_p
     $cpage=$obj[$cpageno]->{DATA};
     $pages->{'Count'}++;
     $stream="q 1 0 0 1 0 0 cm\n$linejoin J\n$linecap j\n";
+    $stream.=$strkcol."\n", $curstrk=$strkcol if $strkcol ne '';
     $mode='g';
     $curfill='';
 #    @address@hidden;
diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl
index c2bb297..c9c8e58 100644
--- a/src/devices/gropdf/pdfmom.pl
+++ b/src/devices/gropdf/pdfmom.pl
@@ -24,13 +24,19 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
+use File::Temp qw/tempfile/;
 my @cmd;
 my $dev='pdf';
+my $preconv='';
+my $readstdin=1;
 
 $ENV{PATH}=$ENV{GROFF_BIN_PATH}.':'.$ENV{PATH} if exists($ENV{GROFF_BIN_PATH});
+$ENV{TMPDIR}=$ENV{GROFF_TMPDIR} if exists($ENV{GROFF_TMPDIR});
 
 while (my $c=shift)
 {
+    $c=~s/(?<!\\)"/\\"/g;
+    
     if (substr($c,0,2) eq '-T')
     {
        if (length($c) > 2)
@@ -41,7 +47,24 @@ while (my $c=shift)
        {
            $dev=shift;
        }
-
+       next;
+    }
+    elsif (substr($c,0,2) eq '-K')
+    {
+       if (length($c) > 2)
+       {
+           $preconv=$c;
+       }
+       else
+       {
+           $preconv=$c;
+           $preconv.=shift;
+       }
+       next;
+    }
+    elsif (substr($c,0,2) eq '-k')
+    {
+       $preconv=$c;
        next;
     }
     elsif ($c eq '-z' or $c eq '-Z')
@@ -49,21 +72,57 @@ while (my $c=shift)
        $dev=$c;
        next;
     }
-
     elsif ($c eq '-v')
     {
        print "GNU pdfmom (groff) version @address@hidden";
        exit;
     }
+    elsif (substr($c,0,1) eq '-')
+    {
+       if (length($c) > 1)
+       {
+           push(@cmd,"\"$c\"");
+           push(@cmd,"'".shift."'") if length($c)==2 and 
index('dDfFIKLmMnoPrwW',substr($c,-1)) >= 0;
+       }
+       else
+       {
+           # Just a '-'
+           
+           push(@cmd,$c);
+           $readstdin=2;
+       }
+    }
+    else
+    {
+       # Got a filename?
+       
+       push(@cmd,"\"$c\"");
+       $readstdin=0 if $readstdin == 1;
+       
+    }
 
-    push(@cmd,$c);
 }
 
-my $cmdstring=join(' ',@cmd);
+my $cmdstring=' '.join(' ',@cmd).' ';
+
+if ($readstdin)
+{
+    my ($fh,$tmpfn)=tempfile('pdfmom-XXXXX', UNLINK=>1);
+
+    while (<STDIN>)
+    {
+       print $fh ($_);
+    }
+    
+    close($fh);
+    
+    $cmdstring=~s/ - / $tmpfn / if $readstdin == 2;
+    $cmdstring.=" $tmpfn " if $readstdin == 1;
+}
 
 if ($dev eq 'pdf')
 {
-    system("groff -Tpdf -dPDF.EXPORT=1 -mom -z $cmdstring 2>&1 | grep '^.ds' | 
groff -Tpdf -mom - $cmdstring");
+    system("groff -Tpdf -dPDF.EXPORT=1 -mom -z $cmdstring 2>&1 | grep '^.ds' | 
groff -Tpdf -mom - $preconv $cmdstring");
 }
 elsif ($dev eq 'ps')
 {
diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
index 04d1c52..8867823 100644
--- a/tmac/pdf.tmac
+++ b/tmac/pdf.tmac
@@ -574,7 +574,10 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .\" if any, and set the marker -- if we still can't identify the name
 .\" for the destination, then this marker will not be created.
 .\"
-.pdf*href.set \\*[pdf:href-N] \\*[pdf:href-D] \\$1
+.ds PDFBOOKMARK.NAME "\\*[pdf:href-N]\\*[pdf:href-D]
+.pdf*href.set \\*[PDFBOOKMARK.NAME] \\$1
+.ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\$*
+.if dPDF.EXPORT .tm .ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\$*
 .\"
 .\"
 .\" Irrespective of whether this marker is created, or not,
@@ -702,7 +705,9 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .   \"
 \#.   if dPDFHREF.COLOUR .defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
 .   nr pdf:bm.width \\w'\\*[PDFHREF.DESC]'
-.   nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\X'pdf: markstart \\n[rst] \\n[rsb] 
\\n[PDFHREF.LEADING] \\*[pdf:href.link]'\\*[PDFHREF.DESC]\X'pdf: markend'\m[]\c
+.   nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\c
+.   device pdf: markstart \\n[rst] \\n[rsb] \\n[PDFHREF.LEADING] 
\\*[pdf:href.link]
+.   nop \&\\*[PDFHREF.DESC]\X'pdf: markend'\m[]\c
 .   \"
 .   \" Clean up the temporary registers and strings, used to
 .   \" compute the "hot-spot" bounds, and format the reference,


hooks/post-receive
-- 
GNU troff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]