comedi-www/make_device_table.pl

59 lines
1.5 KiB
Perl
Raw Permalink Normal View History

#!/usr/bin/env perl
# Script to convert devices.txt file from comedi into a html table
#Copyright (C) 2008 Frank Mori Hess <fmhess@users.sourceforge.net>
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation, version 2.1
#of the License, or (at your option) any later version.
#This library 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
#Lesser General Public License for more details.
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#USA.
use strict;
use warnings;
print
'<?xml version="1.0" encoding="utf-8"?>
<!--This file is autogenerated. Do not edit-->
<table class="alternating-background">
<tr>
<th>Make</th>
<th>Model</th>
<th>Driver</th>
<th>comedi_config Name</th>
</tr>
';
while(my $line = <>)
{
chomp($line);
if($line =~ m/(.*)\t(.*)\t(.*)\t(.*)/)
{
my $make = $1;
my $model = $2;
my $driver = $3;
my $config_name = $4;
print " <tr>\n";
print " <td>$make</td>\n";
print " <td>$model</td>\n";
print " <td>$driver</td>\n";
print " <td>$config_name</td>\n";
print " </tr>\n";
}else
{
warn "Failed to parse input line: $line\n";
}
}
print "</table>\n";