I do have plans to add table recognition to Text::Autoformat. Specifically, to port the table recognition code already used in Perl6::Perldoc::Parser. Those following this thread might find that code interesting (search for /Build entire table/).
Damian | [reply] [Watch: Dir/Any] [d/l] |
| [reply] [Watch: Dir/Any] |
How does inferring field positions in fixed record format files relate to outputting data in tabular format?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [Watch: Dir/Any] |
It's not the output so much as it is just recognizing that the data is in a table. Text::Autoformat first has to parse the paragraphs that it's dealing with before it can decide what to do about them. A heuristic could be developed that says "this chunk of data is a table". Once you've got that, if you're going to reformat it, you've got to know where the columns are. The OP's code may be able to serve both purposes. Maybe. :-)
| [reply] [Watch: Dir/Any] |
Ah. I see what you are getting at. Yes, I think it probably could be used for that purpose.
Mind you, having just taken an extended squint inside Text::Autoformat, i think it would take a very brave person to try and add table inferencing code with all the other things going on in that module.
I'm not adverse to making full use of the regex engine, and the regexes in there are nicely laid out and commented. But, trying to combine the heuristic in the OPs code, with the various heuristics already used in that module, and come away with something that worked, even for some fairly specific cases let alone the general case, would be quite an achievement.
For example, imagine trying to extend the POD example of a quoted email/maillist post that has had it's formatting screwed over by re-quoting. What if the original text contained a table with some left and some right justified fields? Combining the heuristics to extract and reformat that would be quite difficult.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [Watch: Dir/Any] |