reStructuredText in RevTalk ?
briany at qldlearning.com
Tue Nov 10 17:53:46 CST 2009
The "usual" approach would be to strip ALL tags, while possibly
leaving some "whitelisted" tags behind. As you suspect, it would be a
monumental task to consider all possible HTML messes a person could
create, but the whitelist approach works fairly well. It won't of
course take care of unbalanced tags.
It would be nice if On-Rev gained a built-in function for this. There
is a PHP function for exactly this task:
One other approach would be to strip all tags for safety purposes, and
then use your own markup in lieu of HTML. For example, an asterisk at
the beginning of a line would correlate to a list item. A line break
would just be a line break. A double line break would become a
paragraph. Etc. If all you need are those basic tags, it shouldn't
matter much that you aren't leveraging people's HTML skills. Most
templating systems implement their own syntax for this reason --
people simply can't be trusted to hand code HTML.
> I'm using a simple file-based CMS in on-rev (along the lines of
> Andre's CMS/blog system).
> I'm looking for a simple way to allow users to include simple html
> within the files which will be included as part of the web pages. I
> need to protect from any accidental damage to the rest of the page
> (e.g. if they add <div>s or mis-matched or incorrect <table>,
> etc.) , and some users will not be familiar with html. Really all I
> need is <br>, <p>, simple <li>, and URL/mail addresses.
> I guess I could build a html parser that disallowed any 'unsafe'
> html - but that doesn't sounds trivial (and it assumes I can think
> of all the cases where html could cause a problem).
> Or I could come up with some format of my own to do it.
> Or I could build a (small subset of?) reStructuredText to make it
> easier to use, and then translate this to html for the output.
> Has anyone built this already, in a form they could share ?
> Or anything equivalent (and hopefully simpler :-)
> (btw - http://docutils.sourceforge.net/rst.html )
More information about the use-livecode