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

[mgp-users-jp 00948] [PATCH] mgp2html.pl.in (Debian Bug#150624, Bug#150630)



contrib/mgp2html.pl.in に対するパッチです。

* \ による継続行の処理 (Bug#150624  http://bugs.debian.org/150624 )
* cont, imageあたりの処理 (Bug#150630 http://bugs.debian.org/150630 )

これでいいでしょうか?

--- ../../cvs/kit/contrib/mgp2html.pl.in	Mon Aug 30 17:20:15 1999
+++ mgp2html.pl.in	Sun Jun 23 23:04:50 2002
@@ -79,10 +79,17 @@
 
 &prologue;
 while (<>) {
-	s/\n$//;
+	s/[\n\r]*$//; # trim CR and LF
 
 	$_ = '' if (/^#/o);
 
+	# multiline processing (lines ending with '\')
+	while ((/\\$/) && (not eof())) {
+		$_=substr($_,0,-1); # cuts last char (should be '\')
+		$_=$_.<>; # concatenate next line
+		s/[\n\r]*$//; # trim CR and LF
+	}
+
 	if ($_ eq '' || $_ =~ /^[^%]/) {
 		$line++;
 		$cont = 0 if ($cont == 2);
@@ -103,6 +110,8 @@
 		next;
 	}
 
+        $cont = 0 if ($cont == 2);
+        $cont = 2 if ($cont == 1);
 	&cmds($_);
 }
 &pageepilogue;
@@ -152,14 +161,15 @@
 			if (!$doimage) {
 				# don't use images
 			} elsif (scalar(@dir) == 2 || scalar(@dir) == 3) {
-				print "<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n");
 			} elsif (scalar(@dir) == 4) {
 				# interpretation wrong
-				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n");
 			} elsif (scalar(@dir) >= 5) {
 				# interpretation wrong
-				print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n";
+				&output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n");
 			}
+			$endline = "<BR>\n";
 		} elsif ($dir[0] eq 'nodefault') {
 			$nodefault++;
 		} elsif ($dir[0] =~ /^(left|leftfill|right|center)$/) {

-- 
鵜飼文敏