diff --git a/inc/html.php b/inc/html.php index b962c60753..7abb05d2e4 100644 --- a/inc/html.php +++ b/inc/html.php @@ -870,13 +870,18 @@ function html_backlinks(){ * show diff * * @author Andreas Gohr + * @param string $text - compare with this text with most current version + * @param bool $intr - display the intro text */ -function html_diff($text='',$intro=true){ +function html_diff($text='',$intro=true,$type=null){ global $ID; global $REV; global $lang; global $conf; + if(!$type) $type = $_REQUEST['difftype']; + if($type != 'inline') $type = 'sidebyside'; + // we're trying to be clever here, revisions to compare can be either // given as rev and rev2 parameters, with rev2 being optional. Or in an // array in rev2. @@ -993,17 +998,48 @@ function html_diff($text='',$intro=true){ $df = new Diff(explode("\n",htmlspecialchars($l_text)), explode("\n",htmlspecialchars($r_text))); - $tdf = new TableDiffFormatter(); + if($type == 'inline'){ + $tdf = new InlineDiffFormatter(); + } else { + $tdf = new TableDiffFormatter(); + } + + + if($intro) print p_locale_xhtml('diff'); if (!$text) { - $diffurl = wl($ID, array('do'=>'diff', 'rev2[0]'=>$l_rev, 'rev2[1]'=>$r_rev)); ptln(''); } ?> - +
> diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 9ccbe14e0d..8abd4314cb 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -164,6 +164,9 @@ $lang['diff'] = 'Show differences to current revisions'; $lang['diff2'] = 'Show differences between selected revisions'; $lang['difflink'] = 'Link to this comparison view'; +$lang['diff_type'] = 'View differences:'; +$lang['diff_inline']= 'Inline'; +$lang['diff_side'] = 'Side by Side'; $lang['line'] = 'Line'; $lang['breadcrumb'] = 'Trace'; $lang['youarehere'] = 'You are here'; diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css index 09a9ecf016..42f9f622e5 100644 --- a/lib/tpl/default/design.css +++ b/lib/tpl/default/design.css @@ -652,10 +652,12 @@ div.dokuwiki table.diff td { font-family: monospace; font-size: 100%; } -div.dokuwiki td.diff-addedline { +div.dokuwiki td.diff-addedline, +div.dokuwiki span.diff-addedline { background-color: #ddffdd; } -div.dokuwiki td.diff-deletedline { +div.dokuwiki td.diff-deletedline, +div.dokuwiki span.diff-deletedline { background-color: #ffffbb; } div.dokuwiki td.diff-context {