Package: gtml
Version: 3.5.4-1
Severity: wishlist
Tags: patch

The #include command will process GTML commands in the input file.
Therefore, it's not possible to include a file that contains lines
beginning with # (for example, shell scripts): one would need to alter
the included file and place a #literal command at the beginning, which
might not always be an option.

The attached patch adds an #includeliteral command that solves this
problem. Please apply.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing'), (10, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.2-athlon
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages gtml depends on:
ii  perl                          5.8.7-7    Larry Wall's Practical Extraction 

gtml recommends no packages.

-- no debconf information
diff -ur gtml-3.5.4-orig/debian/changelog gtml-3.5.4/debian/changelog
--- gtml-3.5.4-orig/debian/changelog    2005-11-27 12:45:54.000000000 +0100
+++ gtml-3.5.4/debian/changelog 2005-11-27 12:57:33.000000000 +0100
@@ -1,3 +1,10 @@
+gtml (3.5.4-1.1) experimental; urgency=low
+
+  * Add new command "#includeliteral"; note that I don't know Perl -- it
+    works, but it's probably ugly.
+
+ -- Flavio Stanchina <[EMAIL PROTECTED]>  Sun, 27 Nov 2005 12:57:21 +0100
+
 gtml (3.5.4-1) unstable; urgency=low
 
   * New upstream release and new upstream (http://sf.net/projects/gtml)
diff -ur gtml-3.5.4-orig/gtml gtml-3.5.4/gtml
--- gtml-3.5.4-orig/gtml        2004-10-29 15:43:23.000000000 +0200
+++ gtml-3.5.4/gtml     2005-11-27 12:52:34.000000000 +0100
@@ -1707,6 +1707,25 @@
 # ----------------------------------------------------------------------------
 # Process lines of a source file.
 
+sub ProcessLinesLiteral
+{
+    local ($iname) = @_;
+    local ($INFILE) = $filenum++;
+
+    if ( ! -r $iname )
+    {
+        &Error("`$iname' unreadable");
+        return;
+    }
+
+    open($INFILE, $iname);
+
+    while ( $_ = <$INFILE> )
+    {
+        print(OUTFILE $_);
+    }
+}
+
 sub ProcessLines
 {
     local ($iname) = @_;
@@ -1909,6 +1928,27 @@
         #
         # Included files.
         #
+        elsif ( /^#includeliteral/ )
+        {
+            chop;
+            if ( $compression ) 
+            { 
+                print(OUTFILE &CompressLines);
+            }
+
+            &Substitute();
+            s/^#includeliteral[ \t]*"//;
+            s/".*$//; #"
+            $file = $_;
+            $file = &ResolveIncludeFile($file);
+            $dependencies{$iname} .= "$file ";
+            if ( $file ne "" )
+            {
+# TODO #                &Notice("    --- $file\n");
+                &ProcessLinesLiteral($file);
+            }
+            next;
+        }
         elsif ( /^#include/ )
         {
             chop;

Reply via email to