|
Cookbook /
InlineDiff-TalkSummary: Talk page for InlineDiff.
Maintainer:Anno
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment. Does this recipe provide any additional features to the PmWiki version 2.2.12 (2010-02-17) built-in word-level difference highlighter? See simon August 19, 2010, at 05:53 PM
The display is different, compare the attached screenshotΔ with a core diff. Some users prefer this one. :-) --Petko August 19, 2010, at 06:32 PM 2007-09-17, Maddes: Also then I get some assert errors in native.php on line 202. I started to get these as well, and managed to dig up http://bugs.horde.org/ticket/4997, based on which I fixed this by changing line 202 of assert($y <= $this->seq[$k]);
—Eemeli Aro August 06, 2009, at 10:39 AM Is it possible to extend the cookbook also for the output changes? Great recipe, thanks a lot! :-) --Henning May 16, 2007, at 10:33 AM After recognizing the importance of the correct sequence of includes, I have tried to point it out in the recipe documentation here. I hope that will help others to avoid the mistake I made. --Henning June 04, 2007, at 11:11 AM This is a very nice recipe! I did a small change in the beginning, the CSS definitions of the SDV(Thanks! --Petko August 19, 2007, at 04:28 PM Excellent recipe, thanks! I've made a small adjustment on my site to it, as the ## begin edit by Eemeli, was:
## $nextpos = strcspn(substr($string, $pos + $spaces), " \n");
$s = substr($string, $pos + $spaces);
$nextpos = strspn($s, "!@#$%^&*()=+[]{}'\\:|");
if ( $nextpos == 0 ) $nextpos = strcspn($s, " \n!@#$%^&*()=+[]{}'\\:|");
## end edit
Which should let InlineDiff see blocks of markup as separate words instead of as part of whatever word they're next to. --EemeliAro January 16, 2008, at 06:20 PM April 7, 2008 - Very good script with nice output! I made two changes on my installation: Deleted lines Deleted lines are displayed without the <del> tags. I've edited lines 108-110 of pagerevinline.php to include the tags: echo "<div class='diffmarkup'><del>",
str_replace("\n","<br />",htmlspecialchars(join("\n",$in))),
"</del></div>";
Hide "changed from" Since the "Changed to" block also contains the "from" information, I could not see any point of displaying the old text as well. So before including pagerevinline.php in config.php, I added: if ($DiffShow['source'] == 'y' || $_REQUEST['source'] == 'y') {
SDV($DiffDelFmt['c'],"<div style='display:none;'>");
SDV($DiffAddFmt['c'],"</div>
<div class='difftype'>\$[Changed line \$DiffLines:]</div>
<div class='diffchange'>");
}
This will hide the "Changed lines ..." block. Jantah In addition to the above change, you can add the following AFTER including pagerevinline.php to change the delete border color to red and add a yellow border color for changed lines.
$HTMLStylesFmt['diff'] .= ".diffdel { border-left:5px #ff9999 solid; padding-left:5px; }
.diffchange { border-left:5px #ffff99 solid; padding-left:5px; }";
Modified versionWhile putting together PageDiffSize I ended up going through the guts of InlineDiff as well, and put together my own modified versionΔ that makes better use of the defaults set by I'm also using the following in my config file to get rid of the superfluous coloured left-hand border and to default to viewing changes to the markup: —Eemeli Aro June 09, 2009, at 06:11 AM $DiffShow['source'] = (@$_REQUEST['source']!='n') ? 'y' : 'n';
if ($DiffShow['source']=='y') {
$DiffDelFmt['a'] = "\n<div class='difftype'>\$[Deleted line \$DiffLines:]</div>";
$DiffAddFmt['d'] = "\n<div class='difftype'>\$[Added line \$DiffLines:]</div>";
$DiffAddFmt['c'] = "\n<div class='difftype'>$[Changed line \$DiffLines:]</div>";
$DiffEndDelAddFmt = '';
include_once("$FarmD/cookbook/pagerevinline/pagerevinline-ea-2009-06-09.php");
}
PHP 5.3 ProblemsUsing PHP 5.3 results in deprecated warnings: Deprecated: Assigning the return value of new by reference is deprecated in cookbook/pagerevinline/Text/Diff.php on line 50, 304, 326, 348, 370 Deprecated: Assigning the return value of new by reference is deprecated in cookbook/pagerevinline/Text/Diff/Renderer/inline.php on line 122, 126 Deprecated: Assigning the return value of new by reference is deprecated in cookbook/pagerevinline/Text/Diff/Renderer.php on line 88, 104 Deprecated: Assigning the return value of new by reference is deprecated in cookbook/pagerevinline/Text/Diff/Engine/native.php on line 106, 121, 123, 125 Scott Connard November 08, 2009, at 08:08 PM I've repackaged Eemeli Aro's cleaned up version of the recipe and a fresh copy of Text_Diff from Horde's CVS (with very small changes to include paths and a method declared static). So try this one pagerevinline1.3pre.zipΔ and report how it works... Could someone please test this with PHP 4? -- Rogutes, 2009-11-11
Sorry for the delay in testing. It works great under PHP 5.3 and 5.2.4, but under PHP 4.4.9 I get the following error on a diff with inline changes (i.e., NOT full line inserts or deletes):
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in pmwiki/cookbook/pagerevinline/Text/Diff.php on line 212 Scott Connard November 24, 2009, at 04:12 PM Comments on css and questionI had to edit the definitions of .del and .ins to include a I wondered why you set it up to only show the inline diffs in changes to markup? Many thanks for the recipe - it definitely fills a hole in the diff engine! Peter Kay December 06, 2009, at 10:44 PM Talk page for the InlineDiff recipe (users). |