From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7P2l-00034b-KO for qemu-devel@nongnu.org; Thu, 17 Nov 2016 10:56:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7P2g-0005Rc-Pn for qemu-devel@nongnu.org; Thu, 17 Nov 2016 10:56:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2907) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7P2g-0005RH-Iv for qemu-devel@nongnu.org; Thu, 17 Nov 2016 10:56:02 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB14FC04D2F5 for ; Thu, 17 Nov 2016 15:56:01 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 17 Nov 2016 19:55:01 +0400 Message-Id: <20161117155504.21843-15-marcandre.lureau@redhat.com> In-Reply-To: <20161117155504.21843-1-marcandre.lureau@redhat.com> References: <20161117155504.21843-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v5 14/17] texi2pod: learn quotation, deftp and deftypefn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Learn a few more markups used for API documentation. Signed-off-by: Marc-Andr=C3=A9 Lureau --- scripts/texi2pod.pl | 53 +++++++++++++++++++++++++++++++++++++++++++++++= +++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl index 8767662..fe0d503 100755 --- a/scripts/texi2pod.pl +++ b/scripts/texi2pod.pl @@ -37,6 +37,7 @@ $inf =3D ""; $ibase =3D ""; @ipath =3D (); $encoding =3D undef; +@args =3D (); =20 while ($_ =3D shift) { if (/^-D(.*)$/) { @@ -162,7 +163,8 @@ while(<$inf>) { if ($ended =3D~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { $skipping =3D pop @skstack; next; - } elsif ($ended =3D~ /^(?:example|smallexample|display)$/) { + } elsif ($ended =3D~ /^(?:example|smallexample|display + |quotation|deftp|deftypefn)$/x) { $shift =3D ""; $_ =3D ""; # need a paragraph break } elsif ($ended =3D~ /^(?:itemize|enumerate|[fv]?table)$/) { @@ -303,6 +305,7 @@ while(<$inf>) { $ic =3D~ s/\@(?:code|kbd)/C/; $ic =3D~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =3D~ s/\@(?:file)/F/; + $ic =3D~ s/\@(?:asis)//; $_ =3D "\n=3Dover 4\n"; }; =20 @@ -323,10 +326,54 @@ while(<$inf>) { $_ =3D "\n=3Ditem ".join (" : ", @columns)."\n"; }; =20 + /^\@(quotation)\s*(.+)?$/ and do { + push @endwstack, $endw; + $endw =3D $1; + $_ =3D "\n$2:" + }; + + /^{(.*)}$|^(.*)$/ and $#args > 0 and do { + $kind =3D $args[0]; + $arguments =3D $1 // ""; + if ($endw eq "deftypefn") { + $ret =3D $args[1]; + $fname =3D "B<$args[2]>"; + $_ =3D $ret ? "$ret " : ""; + $_ .=3D "$fname $arguments ($kind)"; + } else { + $_ =3D "B<$args[1]> ($kind)\n\n$arguments"; + } + @args =3D (); + }; + + /^\@(deftp)\s*(.+)?$/ and do { + push @endwstack, $endw; + $endw =3D $1; + $arg =3D $2; + $arg =3D~ s/{([^}]*)}/$1/g; + $arg =3D~ s/\@$//; + @args =3D split (/ /, $arg); + $_ =3D ""; + }; + + /^\@(deftypefn)\s*(.+)?$/ and do { + push @endwstack, $endw; + $endw =3D $1; + $arg =3D $2; + $arg =3D~ s/{([^}]*)}/$1/g; + $arg =3D~ s/\@$//; + @args =3D split (/ /, $arg); + $_ =3D ""; + }; + /^\@itemx?\s*(.+)?$/ and do { if (defined $1) { - # Entity escapes prevent munging by the <> processing below. - $_ =3D "\n=3Ditem $ic\<$1\>\n"; + if ($ic eq "") { + $_ =3D "\n=3Ditem $1\n"; + } else { + # Entity escapes prevent munging by the <> processing be= low. + $_ =3D "\n=3Ditem $ic\<$1\>\n"; + } } else { $_ =3D "\n=3Ditem $ic\n"; $ic =3D~ y/A-Ya-y/B-Zb-z/; --=20 2.10.0