diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5367ede0..3e3bc892 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -5,7 +5,11 @@ Phalcon Diff is an open source project and a volunteer effort.
Phalcon Diff does not have human resources fully dedicated to the maintenance of this software.
If you want something to be improved or you want a new feature please submit a Pull Request.
-If you have a change or new feature in mind, please fill an [NFR](https://github.com/phalcon/cphalcon/wiki/New-Feature-Request---NFR).
+If you have a change or new feature in mind, please fill an [NFR][:nfr:].
+**Note**: We don't add changes directly to stable branches or `master`.
+So, if you are going to do a PR, use the dev-branch.
Thanks!
Phalcon Team
+
+[:nfr:]: https://github.com/phalcongelist/php-diff/wiki/New-Feature-Request---NFR
diff --git a/.travis.yml b/.travis.yml
index 59b48436..ac38ecb3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,6 @@ script:
notifications:
email:
recipients:
- - serghei@phalconphp.com
+ - build@phalconphp.com
on_success: change
on_failure: always
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7acdaaac..c908ced0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+# [2.0.5](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.5) (2016-XX-XX)
+
+
+# [2.0.4](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.4) (2016-09-20)
+
+* Added ability to set title for `SideBySide` renderer
+* Added ability to set title for `Inline` renderer
+* Added `mbstring` extension as package dependency [#6](https://github.com/phalcongelist/php-diff/issues/6)
+
# [2.0.3](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.3) (2016-07-18)
* Fixed `BaseArray` class name
diff --git a/README.md b/README.md
index 75ea4fa6..b1656366 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ This is a fork of [Chris Boulton's Diff][fork] project.
## Introduction
-A comprehensive library for generating differences between
+Phalcon Diff is a comprehensive library for generating differences between
two hashable objects (strings or arrays). Generated differences can be
rendered in all of the standard formats including:
@@ -21,6 +21,41 @@ The logic behind the core of the diff engine (ie, the sequence matcher)
is primarily based on the Python difflib package. The reason for doing
so is primarily because of its high degree of accuracy.
+Please write us if you have any feedback.
+
+## Get Started
+
+### Requirements
+
+To run this library on your project, you need at least:
+
+* PHP >= 5.4
+* PHP mbstring extension
+
+### Installation
+
+Install [Composer][composer] in a common location or in your project:
+
+```sh
+$ curl -s http://getcomposer.org/installer | php
+```
+
+Create the `composer.json` file as follows:
+
+```json
+{
+ "require": {
+ "phalcongelist/php-diff": "~2.0"
+ }
+}
+```
+
+Run the composer installer:
+
+```sh
+$ php composer.phar install
+```
+
## Example Use
More complete documentation will be available shortly.
@@ -35,9 +70,10 @@ More complete documentation will be available shortly.
Phalcon Diff is open-sourced software licensed under the [New BSD License][license].
-© 2009-2016, Chris Boulton
© 2016, Phalcon Framework Team and contributors
+© 2009-2016, Chris Boulton
All rights reserved.
[fork]: https://github.com/chrisboulton/php-diff
+[composer]: https://getcomposer.org
[license]: https://github.com/phalcongelist/php-diff/blob/master/docs/LICENSE.txt
diff --git a/composer.json b/composer.json
index 802d6900..43a0fef2 100644
--- a/composer.json
+++ b/composer.json
@@ -3,6 +3,9 @@
"type": "library",
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
"license": "BSD-3-Clause",
+ "keywords": [
+ "php", "diff", "phalcon"
+ ],
"authors": [
{
"name": "Phalcon Team",
@@ -16,13 +19,15 @@
],
"support": {
"source": "https://github.com/phalcongelist/php-diff",
- "issues": "https://github.com/phalcongelist/php-diff/issues"
+ "issues": "https://github.com/phalcongelist/php-diff/issues",
+ "wiki": "https://github.com/phalcongelist/php-diff/wiki"
},
"require": {
- "php": ">= 5.4"
+ "php": ">= 5.4",
+ "ext-mbstring": "*"
},
"require-dev": {
- "squizlabs/php_codesniffer": "~2.6"
+ "squizlabs/php_codesniffer": "~2.7"
},
"autoload": {
"psr-4": {
diff --git a/src/Diff/Renderer/Html/Inline.php b/src/Diff/Renderer/Html/Inline.php
index fa4eaba1..ba4e4af7 100644
--- a/src/Diff/Renderer/Html/Inline.php
+++ b/src/Diff/Renderer/Html/Inline.php
@@ -25,6 +25,10 @@
*/
class Inline extends BaseArray
{
+ private $oldTitle = 'Old';
+ private $newTitle = 'New';
+ private $diffTitle = 'Differences';
+
/**
* Render a and return diff with changes between the two sequences
* displayed inline (under each other)
@@ -40,12 +44,24 @@ public function render()
return $html;
}
+ if (isset($this->options['oldTitle'])) {
+ $this->oldTitle = $this->options['oldTitle'];
+ }
+
+ if (isset($this->options['newTitle'])) {
+ $this->newTitle = $this->options['newTitle'];
+ }
+
+ if (isset($this->options['diffTitle'])) {
+ $this->diffTitle = $this->options['diffTitle'];
+ }
+
$html .= '';
$html .= '';
$html .= '';
- $html .= 'Old | ';
- $html .= 'New | ';
- $html .= 'Differences | ';
+ $html .= '' . htmlspecialchars($this->oldTitle) . ' | ';
+ $html .= '' . htmlspecialchars($this->newTitle) . ' | ';
+ $html .= '' . htmlspecialchars($this->diffTitle) . ' | ';
$html .= '
';
$html .= '';
foreach ($changes as $i => $blocks) {
diff --git a/src/Diff/Renderer/Html/SideBySide.php b/src/Diff/Renderer/Html/SideBySide.php
index 2976183e..4744f917 100644
--- a/src/Diff/Renderer/Html/SideBySide.php
+++ b/src/Diff/Renderer/Html/SideBySide.php
@@ -25,6 +25,9 @@
*/
class SideBySide extends BaseArray
{
+ private $oldTitle = 'Old Version';
+ private $newTitle = 'New Version';
+
/**
* Render a and return diff with changes between the two sequences
* displayed side by side.
@@ -40,11 +43,19 @@ public function render()
return $html;
}
+ if (isset($this->options['oldTitle'])) {
+ $this->oldTitle = $this->options['oldTitle'];
+ }
+
+ if (isset($this->options['newTitle'])) {
+ $this->newTitle = $this->options['newTitle'];
+ }
+
$html .= '';
$html .= '';
$html .= '';
- $html .= 'Old Version | ';
- $html .= 'New Version | ';
+ $html .= '' . htmlspecialchars($this->oldTitle) . ' | ';
+ $html .= '' . htmlspecialchars($this->newTitle) . ' | ';
$html .= '
';
$html .= '';