I'm writing a website using Catalyst, and it's mostly static content, but I'm using Catalyst and TT::Alloy to keep headers and footers reusable, and things like that.

One feature is a small blerb on the front page that the customer will change every so often, like once a month. A form supplies new content which is saved in a config file that my template pulls in; I got that working without any trouble.

The problem is that one of these items is not a single line but a larger "article", and the current content contains paragraphs and and bulleted list. So, I need to allow full HTML codes to be entered and passed through to the template.

Meanwhile, I'm serving XHTML if the browser accepts it, so a syntax error will break the page, not just "do something" like most of the web pages out there (including this one!).

Now this is a seldom-used Admin feature, not a BBS with this as a core feature. So I don't want to put too much work in it, except to reuse! I'm wondering how I might allow users to enter rich content but still ensure that I serve only well-formed XHTML.

Ideas include (1) validating the resulting page before committing the changes; (2) use a different sort of markup and transform it into XHTML. I think that's why the phpBB syntax was invented, in fact. Any Perl modules available that will help me do what I'm looking for?

Thanks,
—John


In reply to User Input for Web Content by John M. Dlugosz

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.