On Jan 7, 2013, at 6:43 PM, Jonathan Wilkes wrote:
From: Ed Kelly morph_2016@yahoo.co.uk To: Jonathan Wilkes jancsika@yahoo.com; João Pais jmmmpais@googlemail.com; Hans-Christoph Steiner hans@at.or.at Cc: Pd List pd-list@iem.at Sent: Monday, January 7, 2013 5:48 PM Subject: Re: [PD] translate the Start Here! page
May I make a suggestion?
If PD Meta contained a list of objects, and a short description of each object's function, it could be dynamically parsed into an XML document, the PD object list we've been arguing about in FLOSSmanuals could be generated by a PHP script, and so always up-to-date. It could be part of the autobuild process for pd-extended to generate this file.
To generate such a libname-meta.pd in the first place you'd have to parse each *-help.pd inside the libdir for the "DESCRIPTION values" comment; it's one less step to write those results directly into the XML document.
Btw-- if you do that, keep in mind that messages in the pd file format can span multiple lines, so make sure you regsub the file as a whole (or the [pd META] subpatch) to grab everything from the TAG to the un-escaped semicolon.
I just did some of this parsing in python for getting translation strings from patches:
regex = re.compile('#X text [0-9]+ [0-9]+ ([^;]*);', re.MULTILINE | re.DOTALL) matches = [m.groups() for m in regex.finditer(text)]
nonewlines = re.compile('\n', re.MULTILINE) nobackslashes = re.compile(' \\', re.MULTILINE) escapedoublequote = re.compile('[^\\]"', re.MULTILINE)
ids = [] for m in matches: if m: chunk = m[0] chunk = re.sub(nonewlines, ' ', chunk) chunk = re.sub(nobackslashes, '', chunk) chunk = re.sub(escapedoublequote, '\"', chunk) if chunk not in ids: ids.append(chunk)
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/doc/tutorials/st...
.hc