mirror of
https://github.com/wekan/wekan.git
synced 2026-01-28 20:26:09 +01:00
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts. Thanks to xet7 !
This commit is contained in:
parent
6117097a93
commit
73e265d8fd
354 changed files with 36977 additions and 106 deletions
38
packages/markdown/marked/test/helpers/html-differ.js
Normal file
38
packages/markdown/marked/test/helpers/html-differ.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
const HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer;
|
||||
const htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true});
|
||||
|
||||
module.exports = {
|
||||
isEqual: htmlDiffer.isEqual.bind(htmlDiffer),
|
||||
firstDiff: (actual, expected, padding) => {
|
||||
padding = padding || 30;
|
||||
const result = htmlDiffer
|
||||
.diffHtml(actual, expected)
|
||||
.reduce((obj, diff) => {
|
||||
if (diff.added) {
|
||||
if (obj.firstIndex === null) {
|
||||
obj.firstIndex = obj.expected.length;
|
||||
}
|
||||
obj.expected += diff.value;
|
||||
} else if (diff.removed) {
|
||||
if (obj.firstIndex === null) {
|
||||
obj.firstIndex = obj.actual.length;
|
||||
}
|
||||
obj.actual += diff.value;
|
||||
} else {
|
||||
obj.actual += diff.value;
|
||||
obj.expected += diff.value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}, {
|
||||
firstIndex: null,
|
||||
actual: '',
|
||||
expected: ''
|
||||
});
|
||||
|
||||
return {
|
||||
actual: result.actual.substring(result.firstIndex - padding, result.firstIndex + padding),
|
||||
expected: result.expected.substring(result.firstIndex - padding, result.firstIndex + padding)
|
||||
};
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue