On Thursday, 29 בDecember 2005 16:49, Aaron wrote:
> I write documentation for denemo (denemo.sourceforge.net). Denemo is
> very keyboard centric with many keybindings and the ability to
> customize the keybindings very easily.

What is a "denemo" ? from the fact that its hosted on sourceforge, I 
assume its some kind of software, most likely open source. Its keyboard 
centric so it probably involves some user input - is it a new paint 
program, or a media manager ? (and no - I can't be troubled to go to 
the site and look for myself. I haven't heard even the tiniest bits of 
a sales pitch, and I'm not interested).

> I have an example of keybinding charts and a handcoded docbook file.
> Is there some kind perl or pythoner out there who could offer a
> script which will help spit out docbook charts from the keybinding
> charts?

Try this for size. There are two problems:
1) the keybinding name is descriptive but hardly appropriate for a 
documentation file.
2) I have no idea how to translate the binding descriptor to something 
humans can read.
I have provided functions for both translations, which currently return 
the same value as provided. It should be fairly easy to change it to do 
something else.

-- 
Oded

::..
"Never confuse your right to do something with the right thing to do."
#!/usr/bin/perl -l

print  q{<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="./docbook-complete.css" type="text/css"?>

<article><title>Speedly Keymap</title><table><title>Key bindings</title><tgroup 
 
cols="4"><thead><row><entry>Action</entry><entry>Keycombo</entry><entry>Action</entry><entry>Keycombo</entry></row></thead>
<tbody>
};


$doublecol = $ARGV[0] || 0;

sub convertKeybindName {
    my ($name) = @_;
    return $name;
}

sub convertKeybind {
    my ($bind) = @_;
    return $bind;
}

while (<STDIN>) {
s|^\s*(\w+)\s*|| and $keybindName = convertKeybindName($1);
while (s/(\w+(\(\d+\))?)//) {
    $keybind .= convertKeybind($1) . " ";
}

chop($keybind);
if ($doublecol and not defined $firstcol) {
    $firstcol = "<entry>$keybindName</entry>" . 
        "<entry>$keybind</entry>";
    next;
}

print "<row>";
print "\t$firstcol<entry>$keybindName</entry><entry>$keybind</entry>";
print "</row>";

undef $keybind;
undef $keybindName;
undef $firstcol;
}

print q{</tbody></tgroup> </table>
</article>
};

Reply via email to