[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Building a troff parser
From: |
Kristaps Dzonsons |
Subject: |
Re: [Groff] Building a troff parser |
Date: |
Thu, 26 Feb 2015 15:13:56 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
>> I'm interested in building a troff parser to extract information from
>> manpages (e.g. what do the flags mean when we say `rm -rf *`?).
>
> That's a hard problem. You may want to look at Eric Raymond's
> doclifter. http://www.catb.org/esr/doclifter/
Eric,
If the pages are in mdoc(7) (which you indicated), just use libmandoc(3)
(http://mdocml.bsd.lv) to parse the file and extract flags (`Fl') in the
SYNOPSIS and correlate them to their explanation in the DESCRIPTION's
`Bl -tag' list. Not difficult at all.
Best,
Kristaps