Blair
Blair
On 7/16/08, Hoolahawk <hool...@gmail.com> wrote:
>
Any diff algorithm that works on HTML can be incorporated into FarCry.
How you do it just depends on what you need from the UI. For example
you could just tack the diff output under the TinyMCE widget if that
suited your users.
Blair
On 7/16/08, Hoolahawk <hool...@gmail.com> wrote:
>
Any diff algorithm that works on HTML can be incorporated into FarCry.
How you do it just depends on what you need from the UI. For example
you could just tack the diff output under the TinyMCE widget if that
suited your users.
Take a look at cfdiff (or diff.cfc) by Rick Osbourne. It does a diff comparison on 2 ascii data objects (example: comparing 2
Yeah. You'd want to use a regular expression and replace all ending
paragraph tags with chr(10) and/or chr(13). chr(10) is a line feed
(or NL / New Line), and chr(13) is a carriage return. (Basically your
Windows and *nix equivs).
Regards,
<cfset bodyNew = reReplace(stObj.body, "(\<p.[^\>]+\>)",
"#chr(10)##chr(13)##chr(10)##chr(13)#", "all") />
That should replace all paragraphs with the ascii equivalent (in this
case, I replaced it with 2 carriage returns and line feeds since there
is no actual ascii equivalent to a paragraph. To test, try replacing
the ascii codes with a string so you can visualize the result. The
code should also get self-closing paragraph tags "<p />", however
won't get them if they don't have a space before the forward slash "<p/
>".
Next, I'd suggest replacing single line breaks (<br /> tags) with the
following:
<cfset bodyNew = reReplace(bodyNew, "(\<br[^\>]+\>)",
"#chr(10)##chr(13)#", "all") />
The only downside I can think of is that this won't pick up a tag if
it doesn't close properly (in other words, it's expecting xhtml
eqivalent).
Hope this helps get you in the right direction.
--
Jeff Coughlin
Web Application Developer
http://jeffcoughlin.com