Skip to content

Commit

Permalink
Merge pull request #1669 from tomudding/feature/improved-update-propo…
Browse files Browse the repository at this point in the history
…sal-diffs

Improve reviewing of update proposals by using proper diffs
  • Loading branch information
tomudding authored Jul 9, 2023
2 parents 064cadb + 4ca99d9 commit 6de0eeb
Show file tree
Hide file tree
Showing 13 changed files with 648 additions and 132 deletions.
7 changes: 6 additions & 1 deletion .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"slowprog/composer-copy-file": "^0.3.0",
"cweagans/composer-patches": "^1.7.1",
"setasign/fpdi": "2.3.6",
"tecnickcom/tcpdf": "6.5.0"
"tecnickcom/tcpdf": "6.5.0",
"jfcherng/php-diff": "^6.15"
},
"require-dev": {
"ext-pdo_sqlite": "*",
Expand Down Expand Up @@ -118,6 +119,7 @@
"config": {
"preferred-install": {
"doctrine/orm": "source",
"jfcherng/php-diff": "source",
"*": "dist"
},
"allow-plugins": {
Expand Down Expand Up @@ -156,6 +158,9 @@
"patches": {
"doctrine/orm": {
"Fix issues with SubDecisions.": "https://raw.githubusercontent.com/GEWIS/orm/2.15.x/1-to-1-multiple-join-columns.patch"
},
"jfcherng/php-diff": {
"Always output diff.": "https://raw.githubusercontent.com/GEWIS/gewisweb-php-diff/v6/always-render-diff.patch"
}
}
},
Expand Down
239 changes: 238 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions config/autoload/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

use Application\Extensions\Doctrine\Rand;
use Application\Extensions\Doctrine\Year;
use Jfcherng\Diff\Differ;
use Jfcherng\Diff\Renderer\RendererConstant;
use Laminas\Session\Storage\SessionArrayStorage;
use Laminas\Session\Validator\HttpUserAgent;

Expand Down Expand Up @@ -157,6 +159,71 @@
'privacy-policy' => 'Policies%20&%20Regulations/Privacy%20Policy',
],

'php-diff' => [
'differ' => [
// show how many neighbor lines
// Differ::CONTEXT_ALL can be used to show the whole file
'context' => Differ::CONTEXT_ALL,
// ignore case difference
'ignoreCase' => false,
// ignore line ending difference
'ignoreLineEnding' => false,
// ignore whitespace difference
'ignoreWhitespace' => false,
// if the input sequence is too long, it will just gives up (especially for char-level diff)
'lengthLimit' => 2000,
],
'renderer' => [
// how detailed the rendered HTML is? (none, line, word, char)
'detailLevel' => 'word',
// renderer language: eng, cht, chs, jpn, ...
// or an array which has the same keys with a language file
// check the "Custom Language" section in the readme for more advanced usage
'language' => 'eng',
// show line numbers in HTML renderers
'lineNumbers' => false,
// show a separator between different diff hunks in HTML renderers
'separateBlock' => true,
// show the (table) header
'showHeader' => false,
// convert spaces/tabs into HTML codes like `<span class="ch sp"> </span>`
// and the frontend is responsible for rendering them with CSS.
// when using this, "spacesToNbsp" should be false and "tabSize" is not respected.
'spaceToHtmlTag' => false,
// the frontend HTML could use CSS "white-space: pre;" to visualize consecutive whitespaces
// but if you want to visualize them in the backend with "&nbsp;", you can set this to true
'spacesToNbsp' => false,
// HTML renderer tab width (negative = do not convert into spaces)
'tabSize' => 4,
// this option is currently only for the Combined renderer.
// it determines whether a replace-type block should be merged or not
// depending on the content changed ratio, which values between 0 and 1.
'mergeThreshold' => 1.0,
// this option is currently only for the Unified and the Context renderers.
// RendererConstant::CLI_COLOR_AUTO = colorize the output if possible (default)
// RendererConstant::CLI_COLOR_ENABLE = force to colorize the output
// RendererConstant::CLI_COLOR_DISABLE = force not to colorize the output
'cliColorization' => RendererConstant::CLI_COLOR_AUTO,
// this option is currently only for the Json renderer.
// internally, ops (tags) are all int type but this is not good for human reading.
// set this to "true" to convert them into string form before outputting.
'outputTagAsString' => false,
// this option is currently only for the Json renderer.
// it controls how the output JSON is formatted.
// see available options on https://www.php.net/manual/en/function.json-encode.php
'jsonEncodeFlags' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
// this option is currently effective when the "detailLevel" is "word"
// characters listed in this array can be used to make diff segments into a whole
// for example, making "<del>good</del>-<del>looking</del>" into "<del>good-looking</del>"
// this should bring better readability but set this to empty array if you do not want it
'wordGlues' => [' ', '-'],
// change this value to a string as the returned diff if the two input strings are identical
'resultForIdenticals' => null,
// extra HTML classes added to the DOM of the diff container
'wrapperClasses' => ['diff-wrapper'],
],
],

/*
* Doctrine global configuration, like functions
*/
Expand Down
Loading

0 comments on commit 6de0eeb

Please sign in to comment.