When searching the sites listed by google, it seemed that the world and his dog wanted to explain templating to me - how to get data from a dataset into some sort of styled html. Well, I need to do the opposite; use a template, some html pages, and some magic to get a nice, clean dataset.

Ok. So at first I was gonna attack the problem with some regexps. But, considering the number of seperate sets of data to untemplate, this is an extremely unattractive prospect.

I have a number of html pages for each day. Each day has one or more contributions. Also, the contributions have an option title.

Eg, a contribution like this may appear a few times in a page:

<tr><td><b>A Title</b> - <b>12/3/2002 23:11</b> <br> Some Contribution <p> </td> </tr>
Unfortunately, the page HTML isn't always hunky-dory, it seems to side on the non-standard kind, which I think sidelines most of the HTML modules. Luckly though, all the contributions are all written in the same manner.

Can anyone help? Is there a module already written for something like this? If not, where would I start? Just quotemeta() the template and do some sort of match? But there's more than one match per page. I'm finding myself out of my league here...

tlhf
xxx


In reply to Untemplating by tlhf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.