![]() |
Drop your new ideas into the Writing.Com Suggestion Box! |
Ah, that makes perfect sense. Don't you do "completeness" checks when you parse the WritingML? I believe I recall noticing that if one half of a pair is omitted - e.g. one of {quote} or {/quote} - the other gets ignored. If so, would that help out here? How about this. Use the following new writingML codes: {table} {cell:width} {/table} If {table} or {/table} is missing, then do the usual trick of not performing any substitutions. Don't let users nest tables - simply parse from a {table} to the next {//table} Then the following substitutions should do the trick: {table} = <TABLE><TR><TD WIDTH=0> {cell:width} = </TD><TD WIDTH=width> {/table} = </TD></TR></TABLE> By ensuring that both {table} and {/table} are present for substitutions to occur, you prevent any HTML table codes being generated unless properly bracketed within a new table. Because a new table and row are generated only by the {table} pair, and because there is no nesting, you can be certain that, if they are present, anything the user enters will be safely "buffered" from the surrounding HTML code in its own single-row table. Because there is the single {cell} command dividing the columns, the user can't "sneak" anything in. Everything within this table will necessarily be wrapped by one or more <TD> fields. (And, actually, if that works, there's no reason, I suppose, not to go ahead and add a {row} that substitutes to </TD></TR><TR><TD WIDTH=0>) Might that do the trick? Admittedly, it's fairly rudimentary. But, really, that's all that users will need 99% of the time, I should think. LP |