Received: from eggs.gnu.org ([140.186.70.92]:58620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsxTO-0004yi-Ns for qemu-devel@nongnu.org; Thu, 02 Feb 2012 09:17:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsxTE-0006DI-BN for qemu-devel@nongnu.org; Thu, 02 Feb 2012 09:17:14 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:45655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsxTE-0006Bl-4L for qemu-devel@nongnu.org; Thu, 02 Feb 2012 09:17:04 -0500 From: Michael Tokarev Date: Thu, 2 Feb 2012 18:16:41 +0400 Message-Id: <1328192202-23450-1-git-send-email-mjt@msgid.tls.msk.ru> Subject: [Qemu-devel] [PATCH 1/2] Support @documentencoding in scripts/texi2pod.pl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Tokarev Currently our texi2pod ignores @documentencoding even if it is set properly in *.texi files. This results in a mojibake in documents generated from qemu.pod (which is generated from qemu-doc.texi by texi2pod), because the rest of the tools assumes ASCII encoding. This patch recognizes first @documentencoding in input and places it at the beginning of output as =encoding directive. Signed-Off-By: Michael Tokarev --- scripts/texi2pod.pl | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl index 9ed056a..94097fb 100755 --- a/scripts/texi2pod.pl +++ b/scripts/texi2pod.pl @@ -36,6 +36,7 @@ $fnno = 1; $inf = ""; $ibase = ""; @ipath = (); +$encoding = undef; while ($_ = shift) { if (/^-D(.*)$/) { @@ -97,6 +98,12 @@ while(<$inf>) { /^\@setfilename\s+([^.]+)/ and $fn = $1, next; /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; + # Look for document encoding + /^\@documentencoding\s+([^.]+)/ and do { + $encoding = $1 unless defined $encoding; + next; + }; + # Identify a man title but keep only the one we are interested in. /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { if (exists $defs{$1}) { @@ -336,6 +343,8 @@ $inf = pop @instack; die "No filename or title\n" unless defined $fn && defined $tl; +print "=encoding $encoding\n\n" if defined $encoding; + $sects{NAME} = "$fn \- $tl\n"; $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; -- 1.7.2.5