Prepare for release 2.0.0-beta18
This commit is contained in:
parent
2b05eaf0fa
commit
ef4a4e1b76
5 changed files with 74 additions and 21 deletions
|
|
@ -13,12 +13,14 @@
|
|||
[](https://www.npmjs.com/package/diff2html)
|
||||
[](https://gitter.im/rtfpessoa/diff2html?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
diff2html generates pretty HTML diffs from git diff output.
|
||||
diff2html generates pretty HTML diffs from git or unified diff output.
|
||||
|
||||
[](https://nodei.co/npm/diff2html/)
|
||||
|
||||
## Features
|
||||
|
||||
* Supports git and unified diffs
|
||||
|
||||
* Line by line and Side by side diff
|
||||
|
||||
* New and old line numbers
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "diff2html",
|
||||
"version": "2.0.0-beta17",
|
||||
"version": "2.0.0-beta18",
|
||||
"homepage": "http://rtfpessoa.github.io/diff2html/",
|
||||
"description": "Fast Diff to colorized HTML",
|
||||
"keywords": [
|
||||
|
|
|
|||
82
dist/diff2html.js
vendored
82
dist/diff2html.js
vendored
|
|
@ -2333,32 +2333,30 @@ process.umask = function() { return 0; };
|
|||
var oldLine2 = null; // Used for combined diff
|
||||
var newLine = null;
|
||||
|
||||
/* Add previous block(if exists) before start a new file */
|
||||
var saveBlock = function() {
|
||||
|
||||
/* Add previous block(if exists) before start a new file */
|
||||
if (currentBlock) {
|
||||
currentFile.blocks.push(currentBlock);
|
||||
currentBlock = null;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Add previous file(if exists) before start a new one
|
||||
* if it has name (to avoid binary files errors)
|
||||
*/
|
||||
var saveFile = function() {
|
||||
|
||||
/*
|
||||
* Add previous file(if exists) before start a new one
|
||||
* if it has name (to avoid binary files errors)
|
||||
*/
|
||||
if (currentFile && currentFile.newName) {
|
||||
files.push(currentFile);
|
||||
currentFile = null;
|
||||
}
|
||||
};
|
||||
|
||||
/* Create file structure */
|
||||
var startFile = function() {
|
||||
saveBlock();
|
||||
saveFile();
|
||||
|
||||
/* Create file structure */
|
||||
currentFile = {};
|
||||
currentFile.blocks = [];
|
||||
currentFile.deletedLines = 0;
|
||||
|
|
@ -2479,18 +2477,72 @@ process.umask = function() { return 0; };
|
|||
return;
|
||||
}
|
||||
|
||||
var values = [];
|
||||
if (utils.startsWith(line, 'diff')) {
|
||||
if (
|
||||
utils.startsWith(line, 'diff') || // Git diffs always start with diff
|
||||
!currentFile || // If we do not have a file yet, we should crete one
|
||||
(
|
||||
currentFile && // If we already have some file in progress and
|
||||
(
|
||||
currentFile.oldName && utils.startsWith(line, '---') || // Either we reached a old file identification line
|
||||
currentFile.newName && utils.startsWith(line, '+++') // Or we reached a new file identification line
|
||||
)
|
||||
)
|
||||
) {
|
||||
startFile();
|
||||
} else if (currentFile && !currentFile.oldName && (values = getSrcFilename(line, config))) {
|
||||
}
|
||||
|
||||
var values;
|
||||
|
||||
/*
|
||||
* --- Date Timestamp[FractionalSeconds] TimeZone
|
||||
* --- 2002-02-21 23:30:39.942229878 -0800
|
||||
*/
|
||||
if (currentFile && !currentFile.oldName &&
|
||||
utils.startsWith(line, '---') && (values = getSrcFilename(line, config))) {
|
||||
currentFile.oldName = values;
|
||||
currentFile.language = getExtension(currentFile.oldName, currentFile.language);
|
||||
} else if (currentFile && !currentFile.newName && (values = getDstFilename(line, config))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* +++ Date Timestamp[FractionalSeconds] TimeZone
|
||||
* +++ 2002-02-21 23:30:39.942229878 -0800
|
||||
*/
|
||||
if (currentFile && !currentFile.newName &&
|
||||
utils.startsWith(line, '+++') && (values = getDstFilename(line, config))) {
|
||||
currentFile.newName = values;
|
||||
currentFile.language = getExtension(currentFile.newName, currentFile.language);
|
||||
} else if (currentFile && utils.startsWith(line, '@@')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentFile && utils.startsWith(line, '@')) {
|
||||
startBlock(line);
|
||||
} else if ((values = oldMode.exec(line))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* There are three types of diff lines. These lines are defined by the way they start.
|
||||
* 1. New line starts with: +
|
||||
* 2. Old line starts with: -
|
||||
* 3. Context line starts with: <SPACE>
|
||||
*/
|
||||
if (currentBlock && (utils.startsWith(line, '+') || utils.startsWith(line, '-') || utils.startsWith(line, ' '))) {
|
||||
createLine(line);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(currentFile && currentFile.blocks.length) ||
|
||||
(currentBlock && currentBlock.lines.length)
|
||||
) {
|
||||
startFile();
|
||||
}
|
||||
|
||||
/*
|
||||
* Git diffs provide more information regarding files modes, renames, copies,
|
||||
* commits between changes and similarity indexes
|
||||
*/
|
||||
if ((values = oldMode.exec(line))) {
|
||||
currentFile.oldMode = values[1];
|
||||
} else if ((values = newMode.exec(line))) {
|
||||
currentFile.newMode = values[1];
|
||||
|
|
@ -2532,8 +2584,6 @@ process.umask = function() { return 0; };
|
|||
} else if ((values = combinedDeletedFile.exec(line))) {
|
||||
currentFile.deletedFileMode = values[1];
|
||||
currentFile.isDeleted = true;
|
||||
} else if (currentBlock) {
|
||||
createLine(line);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
5
dist/diff2html.min.js
vendored
5
dist/diff2html.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "diff2html",
|
||||
"version": "2.0.0-beta17",
|
||||
"version": "2.0.0-beta18",
|
||||
"homepage": "http://rtfpessoa.github.io/diff2html/",
|
||||
"description": "Fast Diff to colorized HTML",
|
||||
"keywords": [
|
||||
|
|
|
|||
Loading…
Reference in a new issue