That is interesting it works on Mozilla. It doesn't on Safari, but I just assumed it wouldn't other places because I was going by what style-sheets.com said regarding "ins/del" tags - that they can be inline or block elements, but "should not be used" as block elements if they are inside other block elements. Since blockquote is a block element, and your example has "ins" inside another block element, then it could be that it's just one of those things that Mozilla decides to handle since it happens to be nice.

Here are the details of what I did since you're curious. I am using Rcs::Agent to get diffs in the unified format. I think it's one of the best Rcs libraries. (The only thing that would be better for me would be a library that would allow me to get all lines of a file rather than just the 3 contextual lines surrounding the change.)

Then among other things, I:

foreach (@$diff) { if (m/^\@\@(.*)\@\@$/) { $str .= qq{<p id="rev">$1</p>}; } elsif (m/^\-(.*)$/) { push @$old, $1; } elsif (m/^\+(.*)$/) { push @$new, $1; } else { my $tst = $_; $str .= getHTMLDiff($old, $new) . $tst; undef $old; undef $new; } } $str .= getHTMLDiff($old, $new);
getHTMLDiff basically passes $old and $new to HTML::Diff, a nifty little library in CPAN that returns word-level changes and has a few html-friendly features.

So that's the tangent. If jeffa or you or others have more suggestions I'm happy and thankful to read them; in the meantime I'll go check out HTML::TokeParser. Thanks. :-)

PS You can see the in-progress results of this over at my weblog http://www.museworld.com/ by looking for entries on the front page that have a little "Revision" link at the bottom. I'm basically writing a movable type plugin to allow people to keep revision history for their weblog entries.


In reply to Re: Re: Re: Re: Regex: How do I use lookahead with search/replace? by tunesmith
in thread Regex: How do I use lookahead with search/replace? by tunesmith

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.