* src/bin/man/autfilt.x, src/bin/man/dstar2tgba.x, src/bin/man/ltl2tgba.x, src/bin/man/ltlcross.x, src/bin/man/ltlgrind.x, src/bin/man/randltl.x, src/bin/man/spot-x.x: Improve typesetting and cross-references. * tools/help2man: Adjust to better detect the optional arguments. Detect options that are not separated from their description by two spaces. Argp output some of those. * tools/man2html.pl: New file. * Makefile.am: Distribute it. * src/bin/ltlfilt.cc: Fix description of --define. * src/bin/ltlgrind.cc: Fix duplicate description for --help and --version. Reorder --help output slightly. * NEWS: Mention the few fixes.
64 lines
3.1 KiB
Perl
Executable file
64 lines
3.1 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
## -*- coding: utf-8 -*-
|
|
## Copyright (C) 2015 Laboratoire de Recherche et Développement de
|
|
## l'Epita (LRDE).
|
|
## Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
|
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
|
## et Marie Curie.
|
|
##
|
|
## This file is part of Spot, a model checking library.
|
|
##
|
|
## Spot is free software; you can redistribute it and/or modify it
|
|
## under the terms of the GNU General Public License as published by
|
|
## the Free Software Foundation; either version 3 of the License, or
|
|
## (at your option) any later version.
|
|
##
|
|
## Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
## License for more details.
|
|
##
|
|
## You should have received a copy of the GNU General Public License
|
|
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
use strict;
|
|
|
|
sub error($)
|
|
{
|
|
print "$0: ", @_;
|
|
exit 1;
|
|
}
|
|
|
|
error "Specify a directory with man pages\n" if @ARGV != 1;
|
|
|
|
my $dir = @ARGV[0];
|
|
|
|
opendir(DIR, $dir) or die $!;
|
|
while (my $file = readdir(DIR))
|
|
{
|
|
next unless $file =~ m/\.\d$/;
|
|
$file = "$dir/$file";
|
|
print "converting $file to $file.html with groff\n";
|
|
my $html = `(echo '.HEAD <LINK REL="stylesheet" TYPE="text/css" HREF="https://spot.lrde.epita.fr/spot.css">'
|
|
echo '.HEAD <meta name="viewport" content="width=device-width, initial-scale=1">'
|
|
cat $file) | groff -Kutf8 -mandoc -Thtml - -P -r`;
|
|
$html =~ s|GNU GPL version 3 or later.*http://gnu.org/licenses/gpl.html>|<a href="http://gnu.org/licenses/gpl.html">GNU GPL version 3 or later</a>|s;
|
|
$html =~ s|<h2>.*?</h2>|<div class="outline-2">$&</div>|smg;
|
|
$html =~ s|(<a href="#.*?">.*?</a><br>\n)+|<div id="table-of-contents"><h2>Table of Contents</h2><div id="text-table-of-contents"><ul>\n$&</ul></div></div>|sm;
|
|
$html =~ s|(<a href="#.*?">.*?</a>)<br>|<li>$1</li>|g;
|
|
$html =~ s|<p(.*?)>•</p></td>.<td width="10%"></td>.<td width="78%">|<p$1>•</p></td>\n<td width="88%">|smg;
|
|
$html =~ s|<spot\@lrde.epita.fr>|<<a href="mailto:spot\@lrde.epita.fr">spot\@lrde.epita.fr</a>>|;
|
|
$html =~ s|<(https?://.*)>|<<a href="$1">$1</a>>|;
|
|
$html =~ s|<p style="margin-left:11%; margin-top: 1em"><b>([^<>]*?:)\s*<br>|<h3 style="margin-left:11%">$1</h3><p style="margin-left:11%"><b>|smg;
|
|
$html =~ s|<p style="margin-left:11%; margin-top: 1em"><b>([^<>]*?:)\s*</b>\s*<br>|<h3 style="margin-left:11%">$1</h3><p style="margin-left:11%">|smg;
|
|
$html =~ s|<p style="margin-left:11%; margin-top: 1em"><b>([^<>]*?:)\s*</b></p>|<h3 style="margin-left:11%">$1</h3>|smg;
|
|
$html =~ s@<body>@<body class="man"><div id="org-div-home-and-up"><a accesskey="h" href="https://spot.lrde.epita.fr/tools.html"> UP </a>| <a accesskey="H" href="https://spot.lrde.epita.fr/index.html"> HOME </a></div>@;
|
|
$html =~ s{<b>([\w-]+)</b>\((\d+)\)}{
|
|
(-f "$1.$2") ? "<a href=\"$1.$2.html\"><b>$1</b></a>($2)" : $&;
|
|
}xge;
|
|
open(FILE, ">$file.html");
|
|
print FILE $html;
|
|
close(FILE);
|
|
}
|
|
closedir(DIR);
|
|
exit 0;
|