Skip to content

Commit

Permalink
Merge pull request #8 from phalcongelist/2.0.x
Browse files Browse the repository at this point in the history
Bump version (2.0.4)
  • Loading branch information
sergeyklay authored Sep 20, 2016
2 parents cce4029 + 86329ca commit c1b0348
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 12 deletions.
6 changes: 5 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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! <br />
Phalcon Team

[:nfr:]: https://github.com/phalcongelist/php-diff/wiki/New-Feature-Request---NFR
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ script:
notifications:
email:
recipients:
- serghei@phalconphp.com
- build@phalconphp.com
on_success: change
on_failure: always
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
Expand All @@ -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 <[email protected]> <br>
© 2016, Phalcon Framework Team and contributors <br>
© 2009-2016, Chris Boulton <[email protected]> <br>
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
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
22 changes: 19 additions & 3 deletions src/Diff/Renderer/Html/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 .= '<table class="Differences DifferencesInline">';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th>Old</th>';
$html .= '<th>New</th>';
$html .= '<th>Differences</th>';
$html .= '<th>' . htmlspecialchars($this->oldTitle) . '</th>';
$html .= '<th>' . htmlspecialchars($this->newTitle) . '</th>';
$html .= '<th>' . htmlspecialchars($this->diffTitle) . '</th>';
$html .= '</tr>';
$html .= '</thead>';
foreach ($changes as $i => $blocks) {
Expand Down
15 changes: 13 additions & 2 deletions src/Diff/Renderer/Html/SideBySide.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 .= '<table class="Differences DifferencesSideBySide">';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th colspan="2">Old Version</th>';
$html .= '<th colspan="2">New Version</th>';
$html .= '<th colspan="2">' . htmlspecialchars($this->oldTitle) . '</th>';
$html .= '<th colspan="2">' . htmlspecialchars($this->newTitle) . '</th>';
$html .= '</tr>';
$html .= '</thead>';

Expand Down

0 comments on commit c1b0348

Please sign in to comment.