[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 09/17] texi2pod: learn quotation, deftp and defty
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v6 09/17] texi2pod: learn quotation, deftp and deftypefn |
Date: |
Tue, 6 Dec 2016 17:13:35 +0300 |
Learn a few more markups used for API documentation.
Signed-off-by: Marc-André Lureau <address@hidden>
---
scripts/texi2pod.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 51 insertions(+), 3 deletions(-)
diff --git a/scripts/texi2pod.pl b/scripts/texi2pod.pl
index 8767662d30..6e8fec41a1 100755
--- a/scripts/texi2pod.pl
+++ b/scripts/texi2pod.pl
@@ -37,6 +37,7 @@ $inf = "";
$ibase = "";
@ipath = ();
$encoding = undef;
address@hidden = ();
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)$/) {
@@ -303,6 +305,7 @@ while(<$inf>) {
$ic =~ s/\@(?:code|kbd)/C/;
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
$ic =~ s/\@(?:file)/F/;
+ $ic =~ s/\@(?:asis)//;
$_ = "\n=over 4\n";
};
@@ -323,10 +326,54 @@ 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/address@hidden//;
+ @args = split (/ /, $arg);
+ $_ = "";
+ };
+
+ /^\@(deftypefn)\s*(.+)?$/ and do {
+ push @endwstack, $endw;
+ $endw = $1;
+ $arg = $2;
+ $arg =~ s/{([^}]*)}/$1/g;
+ $arg =~ s/address@hidden//;
+ @args = split (/ /, $arg);
+ $_ = "";
+ };
+
/address@hidden(.+)?$/ and do {
if (defined $1) {
- # Entity escapes prevent munging by the <> processing below.
- $_ = "\n=item $ic\<$1\>\n";
+ if ($ic eq "") {
+ $_ = "\n=item $1\n";
+ } else {
+ # Entity escapes prevent munging by the <> processing below.
+ $_ = "\n=item $ic\<$1\>\n";
+ }
} else {
$_ = "\n=item $ic\n";
$ic =~ y/A-Ya-y/B-Zb-z/;
@@ -388,6 +435,7 @@ sub postprocess
s/address@hidden([^\}]*)\}/\U$1/g;
s/address@hidden([^\}]*)\}/F<$1>/g;
s/address@hidden([^\}]*)\}/S<$1>/g;
+ s/address@hidden([^\}]*)\}/$1/g;
s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
# keep references of the form @ref{...}, print them bold
--
2.11.0
- [Qemu-devel] [PATCH v6 02/17] qapi: improve TransactionAction doc, (continued)
- [Qemu-devel] [PATCH v6 02/17] qapi: improve TransactionAction doc, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 03/17] qga/schema: improve guest-set-vcpus Returns: section, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 04/17] qapi: add some sections in docs, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 05/17] docs: add master qapi texi files, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 06/17] qapi: rework qapi Exception, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 07/17] qapi: use a QAPIParseError in parser, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 09/17] texi2pod: learn quotation, deftp and deftypefn,
Marc-André Lureau <=
- [Qemu-devel] [PATCH v6 10/17] json: reorder documentation body, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 13/17] build-sys: use --no-split for info, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 14/17] build-sys: remove dvi doc generation, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 12/17] docs: add qemu logo to pdf, Marc-André Lureau, 2016/12/06
- [Qemu-devel] [PATCH v6 08/17] qapi: add qapi2texi script, Marc-André Lureau, 2016/12/06