Skip to content
This repository was archived by the owner on Aug 2, 2020. It is now read-only.

Commit c455c63

Browse files
committed
Stripped wrapping new lines in pre contents.
1 parent aaf3dad commit c455c63

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Changelog
22

3-
##August 12, 2014
3+
##0.0.1 August 12, 2014
44

55
- Initial public release.

de-pre.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626

2727
Array.prototype.slice.call(document.querySelectorAll(tag)).forEach(function (obj) {
2828

29-
var indent = obj.previousSibling.nodeValue.match(/([ \t]*)$/);
29+
var indent = obj.previousSibling.nodeValue.match(/([ \t]*)$/),
30+
contents = obj.innerText;
3031

31-
obj.innerText = obj.innerText.replace(new RegExp('(^|\n)' + indent[1], 'g'), '$1');
32+
contents = contents.replace(new RegExp('(^|\n)' + indent[1], 'g'), '$1');
33+
contents = contents.replace(/^\s+|\s+$/g, '');
34+
35+
obj.innerText = contents;
3236

3337
});
3438

de-pre.min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* de-pre.js v0.0.1 2014-08-12T21:42:02
2+
* de-pre.js v0.0.1 2014-08-12T22:10:24
33
* https://github.com/neogeek/de-pre.js
44
*
55
* Copyright (c) 2014 Scott Doxey
66
* Released under the MIT license.
77
*/
8-
!function(a,b){"use strict";"function"==typeof define&&void 0!==define.amd?define([],b):a.depre=b}(this,function(a){"use strict";Array.prototype.slice.call(document.querySelectorAll(a)).forEach(function(a){var b=a.previousSibling.nodeValue.match(/([ \t]*)$/);a.innerText=a.innerText.replace(new RegExp("(^|\n)"+b[1],"g"),"$1")})});
8+
!function(a,b){"use strict";"function"==typeof define&&void 0!==define.amd?define([],b):a.depre=b}(this,function(a){"use strict";Array.prototype.slice.call(document.querySelectorAll(a)).forEach(function(a){var b=a.previousSibling.nodeValue.match(/([ \t]*)$/),c=a.innerText;c=c.replace(new RegExp("(^|\n)"+b[1],"g"),"$1"),c=c.replace(/^\s+|\s+$/g,""),a.innerText=c})});

0 commit comments

Comments
 (0)