abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson#!/usr/bin/perl
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2001, 2004, 2007, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User# $Id$
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson#
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# Do a quick-and-dirty conversion of .mandoc man pages to
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# DocBook SGML.
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson#
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# Minor hand editing of the output is usually required.
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# This has only been tested with library function man pages
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# (section 3); it probably does not work well for program
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson# man pages.
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson#
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonprint <<\END;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<!--
704e6c8876907aac0bf7380effca8bca400d4acdMark Andrews - Copyright (C) 2000, 2001 Internet Systems Consortium, Inc. ("ISC")
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson -
704e6c8876907aac0bf7380effca8bca400d4acdMark Andrews - This Source Code Form is subject to the terms of the Mozilla Public
704e6c8876907aac0bf7380effca8bca400d4acdMark Andrews - License, v. 2.0. If a copy of the MPL was not distributed with this
704e6c8876907aac0bf7380effca8bca400d4acdMark Andrews - file, You can obtain one at http://mozilla.org/MPL/2.0/.
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson-->
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User<!-- $Id$ -->
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<refentry>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<refentryinfo>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas GustafssonEND
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonmy $cursection = undef;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonmy $in_para = 0;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonsub begin_para() {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if (! $in_para) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<para>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $in_para = 1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson}
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonsub end_para() {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($in_para) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</para>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $in_para = 0;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson}
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonsub end_section {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($cursection) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</$cursection>\n"
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson}
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonsub section {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my ($tag) = @_;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson end_para();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson end_section();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<$tag>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $cursection = $tag;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson}
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonmy %tagmap = (
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson Er => errorcode,
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson Dv => type,
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson Pa => filename,
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson Li => constant, # XXX guess
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson Ar => parameter,
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson Va => parameter,
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson);
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonwhile (<>) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next if m/^\.\\\"/;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if (/^\.Dd (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<date>$1<\/date>\n<\/refentryinfo>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Dt ([^ ]+) ([^ ]+)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $title = lc $1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $volume = $2;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson chomp $volume;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print <<END;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<refmeta>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<refentrytitle>$title</refentrytitle>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<manvolnum>$volume</manvolnum>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson<refmiscinfo>BIND9</refmiscinfo>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson</refmeta>
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas GustafssonEND
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Os (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.ds (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Nm (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($cursection eq "refnamediv") {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $t = $1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/ ,$//;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<refname>$t<\/refname>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson } else {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<command>$1<\/command>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Nd (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<refpurpose>$1</refpurpose>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Sh NAME/) { section("refnamediv"); next; }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Sh SYNOPSIS/) { section("refsynopsisdiv"); next; }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Sh (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson section("refsect1");
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<title>$1</title>\n"; next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson # special: spaces can occur in arg
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Fd (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $_ = $1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson s/</&lt;/g;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson s/>/&gt;/g;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<funcsynopsisinfo>$_<\/funcsynopsisinfo>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Fn (.*?)( ([^"]+))?$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson # special: add parenthesis
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<function>$1()<\/function>$3\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson elsif (/^\.Op Fl (.*?)( ([^"]+))?$/) {
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson # special: add dash
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson print "<option>-$1<\/option>$3\n";
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson }
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson elsif (/^\.Fl (.*?)( ([^"]+))?$/) {
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson # special: add dash
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson print "<option>-$1<\/option>$3\n";
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Ft (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<funcprototype>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<funcdef>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "$1\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Fa (.*?)( ([^"]+))?$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($cursection eq "refsynopsisdiv") {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $t = $1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/^"//;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/"$//;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<paramdef>$t<\/paramdef>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson } else {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<parameter>$1<\/parameter>$3\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Fo (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<function>$1<\/function></funcdef>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Xr ([^ ]+) ([^ ]+)( ([^ ]+))?$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<citerefentry>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<refentrytitle>$1</refentrytitle><manvolnum>$2</manvolnum>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</citerefentry>$4\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.([A-Z][a-z]) (.*?)( ([^"]+))?$/ && defined($tagmap{$1})) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $tag = $tagmap{$1};
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $t = $2;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson my $punct = $4;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/^"//;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/"$//;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/</&lt;/g;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $t =~ s/>/&gt;/g;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<$tag>$t<\/$tag>$punct\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Fc$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</funcprototype>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson next;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Pp$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson end_para();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson begin_para();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Bd /) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<programlisting>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Ed$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</programlisting>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.Bl /) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<variablelist>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.El$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</para>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</listitem>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</variablelist>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $in_list = 0;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
8b862ad2b77326a01c6a4045c0ce5f4f428a5120Andreas Gustafsson elsif (/^\.It .. (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($in_list) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</listitem>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<varlistentry><term><constant>$1</constant></term>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<listitem>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<para>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $in_list = 1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson elsif (/^\.It Dv (.*)$/) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if ($in_list) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "</listitem>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<varlistentry><term><errorcode>$1</errorcode></term>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<listitem>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print "<para>\n";
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson $in_list = 1;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson } else {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson if (/./) {
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson begin_para();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson print;
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson }
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson}
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafsson
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonend_para();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonend_section();
abeaa7aeb56fd0c9c60d8fe1cc98a3cc94f4fe68Andreas Gustafssonprint "</refentry>\n";