All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PATCH v4 12/15] texi2pod: learn quotation, deftp and deftypefn
Date: Thu, 10 Nov 2016 19:22:06 +0400	[thread overview]
Message-ID: <20161110152209.18379-13-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20161110152209.18379-1-marcandre.lureau@redhat.com>

Learn a few more markups used for API documentation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 scripts/texi2pod.pl | 44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl
index 8767662..5df4b5f 100755
--- a/scripts/texi2pod.pl
+++ b/scripts/texi2pod.pl
@@ -37,6 +37,7 @@ $inf = "";
 $ibase = "";
 @ipath = ();
 $encoding = undef;
+@args = ();
 
 while ($_ = shift) {
     if (/^-D(.*)$/) {
@@ -162,7 +163,8 @@ while(<$inf>) {
 	if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
 	    $skipping = pop @skstack;
 	    next;
-	} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
+	} elsif ($ended =~ /^(?:example|smallexample|display
+                            |quotation|deftp|deftypefn)$/x) {
 	    $shift = "";
 	    $_ = "";	# need a paragraph break
 	} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
@@ -323,6 +325,46 @@ while(<$inf>) {
 	$_ = "\n=item ".join (" : ", @columns)."\n";
     };
 
+    /^\@(quotation)\s*(.+)?$/ and do {
+        push @endwstack, $endw;
+        $endw = $1;
+        $_ = "\n$2:"
+    };
+
+    /^{(.*)}$|^(.*)$/ and $#args > 0 and do {
+        $kind = $args[0];
+        $arguments = $1 // "";
+        if ($endw eq "deftypefn") {
+            $ret = $args[1];
+            $fname = "B<$args[2]>";
+            $_ = $ret ? "$ret " : "";
+            $_ .= "$fname $arguments ($kind)";
+        } else {
+            $_ = "B<$args[1]> ($kind)\n\n$arguments";
+        }
+        @args = ();
+    };
+
+    /^\@(deftp)\s*(.+)?$/ and do {
+        push @endwstack, $endw;
+        $endw = $1;
+        $arg = $2;
+        $arg =~ s/{([^}]*)}/$1/g;
+        $arg =~ s/\@$//;
+        @args = split (/ /, $arg);
+        $_ = "";
+    };
+
+    /^\@(deftypefn)\s*(.+)?$/ and do {
+        push @endwstack, $endw;
+        $endw = $1;
+        $arg = $2;
+        $arg =~ s/{([^}]*)}/$1/g;
+        $arg =~ s/\@$//;
+        @args = split (/ /, $arg);
+        $_ = "";
+    };
+
     /^\@itemx?\s*(.+)?$/ and do {
 	if (defined $1) {
 	    # Entity escapes prevent munging by the <> processing below.
-- 
2.10.0

  parent reply	other threads:[~2016-11-10 15:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 15:21 [Qemu-devel] [PATCH v4 00/15] qapi doc generation (whole version, squashed) Marc-André Lureau
2016-11-10 15:21 ` [Qemu-devel] [PATCH v4 01/15] qapi: improve device_add schema Marc-André Lureau
2016-11-17 17:30   ` Markus Armbruster
2016-11-17 17:36     ` Markus Armbruster
2016-11-10 15:21 ` [Qemu-devel] [PATCH v4 02/15] qga/schema: fix double-return in doc Marc-André Lureau
2016-11-17 17:30   ` Markus Armbruster
2016-11-17 17:36     ` Markus Armbruster
2016-11-10 15:21 ` [Qemu-devel] [PATCH v4 03/15] qga/schema: improve guest-set-vcpus Returns: section Marc-André Lureau
2016-11-17 17:30   ` Markus Armbruster
2016-11-17 17:37     ` Markus Armbruster
2016-11-10 15:21 ` [Qemu-devel] [PATCH v4 04/15] qapi: fix schema symbol sections Marc-André Lureau
2016-11-17 17:31   ` Markus Armbruster
2016-11-17 17:38     ` Markus Armbruster
2016-11-10 15:21 ` [Qemu-devel] [PATCH v4 05/15] qapi: fix missing symbol @prefix Marc-André Lureau
2016-11-17 17:31   ` Markus Armbruster
2016-11-17 17:38     ` Markus Armbruster
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 06/15] qapi: fix various symbols mismatch in documentation Marc-André Lureau
2016-11-17 17:33   ` Markus Armbruster
2016-11-17 17:38     ` Markus Armbruster
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 07/15] qapi: use one symbol per line Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 08/15] qapi: add missing colon-ending for section name Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 09/15] qapi: add some sections in docs Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 10/15] docs: add master qapi texi files Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 11/15] qapi: add qapi2texi script Marc-André Lureau
2016-11-10 15:22 ` Marc-André Lureau [this message]
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 13/15] qmp-commands: (SQUASHED) move doc to schema Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 14/15] docs: add qemu logo Marc-André Lureau
2016-11-10 15:43   ` Daniel P. Berrange
2016-11-17 10:49     ` Marc-André Lureau
2016-11-10 15:22 ` [Qemu-devel] [PATCH v4 15/15] build-sys: add qapi doc generation targets Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161110152209.18379-13-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.