Extension:WikEdDiff/zh
![]() 发行状态: 穩定版 |
|
---|---|
![]() |
|
实现 | 用户界面 |
描述 | Inline-style difference engine with block move support |
作者 | Cacycle讨论 |
最新版本 | 1.2.5 (2015-07-20) |
MediaWiki | 1.17 - 1.25 |
PHP | 5.3.0 |
数据库更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
$wgWikEdDiffFullDiff, $wgWikEdDiffShowBlockMoves, $wgWikEdDiffCharDiff, $wgWikEdDiffRepeatedDiff, $wgWikEdDiffRecursiveDiff, $wgWikEdDiffRecursionMax, $wgWikEdDiffUnlinkBlocks, $wgWikEdDiffUnlinkMax, $wgWikEdDiffBlockMinLength, $wgWikEdDiffColoredBlocks, $wgWikEdDiffNoUnicodeSymbols, $wgWikEdDiffStripTrailingNewline, $wgWikEdDiffDebug, $wgWikEdDiffTimer, $wgWikEdDiffUnitTesting |
|
季度下載量 | 7 (Ranked 157th) |
翻译WikEdDiff扩展 | |
問題 | 开启的任务 · 报告错误 |
![]() | 此扩展需要对MediaWiki核心代码打补丁 ,如果用在MediaWiki 1.24及以前版本的话。 使用补丁执行的扩展可能会因为升级与安全补丁而禁用,或干扰二者正常工作。 如果您喜欢使用此扩展,我们强烈建议您升级到1.24及更高版本。 如果有不需要补丁的合适替代扩展的话,我们推荐您改用那个扩展。 |

deleted text, inserted text, ▶ block move mark, moved block, single character changes, highlighted moved block and ◀ block mark, and ambiguous insertion aligned to line.
WikEdDiff is a visual inline-style difference engine with block move support. This extension is a feature-identical synced one-to-one PHP port of the JavaScript library wikEd diff that is used by the Wikipedia/MediaWiki in-browser editor wikEd and by the gadget wikEdDiff. You can test wikEdDiff by checking any of these gadgets in your English Wikipedia preferences. For testing the effects of different settings, you can also use the wikEd diff online tool and demo.
功能
- Visual inline style, changes are shown in a single output text
- Block move detection and highlighting
- Resolution down to characters level
- Unicode and multilingual support
- Stepwise split (paragraphs, lines, sentences, words, characters)
- Recursive diff
- Optimized code for resolving unmatched sequences
- Minimization of length of moved blocks
- Alignment of ambiguous unmatched sequences to next line break or word border
- Clipping of unchanged irrelevant parts from the output (optional)
- Fully customizable
- Text split optimized for MediaWiki source texts
- Well commented and documented code
性能
The performance of wikEdDiff as compared to the MediaWiki bundled engine 'wikidiff3' (which is not used by default) depends mostly on the number of changes per text and text length. For typical comparisons, the MediaWiki default engine 'wikidiff3' is typically faster by a factor of up to 3 - 4-fold. For long and heavily changed articles, wikEdDiff can be slightly faster than 'wikidiff3'. These numbers are for wikEdDiff version 1.2.2 with default settings (i.e. optimal diff quality).
安裝
- For MediaWiki versions before 1.25, WikEdDiff requires a patch to the MediaWiki core to add the new hook GetDifferenceEngine.
In the file includes/content/ContentHandler.php
replace the content of function createDifferenceEngine
with:
// hook: get diff engine class name
$diffEngineClass = '';
if ( wfRunHooks( 'GetDiffEngineClass', array( $context, &$diffEngineClass ) ) ) {
// use default diff engine
$diffEngineClass = $this->getDiffEngineClass();
}
return new $diffEngineClass( $context, $old, $new, $rcid, $refreshCache, $unhide );
- 下载文件,并将其放置在您
extensions/
文件夹中的WikEdDiff
目录内。 - 将下列代码放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'WikEdDiff' ); # Optional customization options: # Show complete un-clipped diff text (false) $wgWikEdDiffFullDiff = false; # Enable block move layout with highlighted blocks and marks at their original positions (true) $wgWikEdDiffShowBlockMoves = true; # Enable character-refined diff (true) $wgWikEdDiffCharDiff = true; // Enable repeated diff to resolve problematic sequences (true) $wgWikEdDiffRepeatedDiff = true; # Enable recursive diff to resolve problematic sequences (true) $wgWikEdDiffRecursiveDiff = true; # Maximum recursion depth (10) $wgWikEdDiffRecursionMax = 10; # Reject blocks if they are too short and their words are not unique, # prevents fragmentated diffs for very different versions (true) $wgWikEdDiffUnlinkBlocks = true; # Maximum number of rejection cycles (5) $wgWikEdDiffUnlinkMax = 5; # Reject blocks if shorter than this number of real words (3) $wgWikEdDiffBlockMinLength = 3; # Display blocks in differing colors (rainbow color scheme) (false) $wgWikEdDiffColoredBlocks = false; # Do not use UniCode block move marks (legacy browsers) (false) $wgWikEdDiffNoUnicodeSymbols = false; # Strip trailing newline off of texts (false) $wgWikEdDiffStripTrailingNewline = true; # Show debug infos and stats (block, group, and fragment data objects) in debug console (false) $wgWikEdDiffDebug = false; # Show timing results in debug console (false) $wgWikEdDiffTimer = false; # Run unit tests to prove correct working, display results in debug console (false) $wgWikEdDiffUnitTesting = false;
完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
致使用MediaWiki 1.24或更早版本的用户:
上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()
。
如果您需要在早期版本(MediaWiki 1.24和更早版本)中安装此扩展,而不是wfLoadExtension( 'WikEdDiff' );
,您需要使用:
require_once "$IP/extensions/WikEdDiff/WikEdDiff.php";
參見
- wikEdDiff gadget
- wikEd diff JavaScript library
- wikEd diff online tool and demo