Browse Source

Extended spaces & line breaks normalization

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
46f73c6fbd
  1. 16
      lib/parser_block.js

16
lib/parser_block.js

@ -109,17 +109,13 @@ ParserBlock.prototype.parse = function (src, options, env) {
if (!src) { return ''; }
if (src.indexOf('\r') >= 0) {
src = src.replace(/\r/, '');
}
if (src.indexOf('\u00a0') >= 0) {
src = src.replace(/\u00a0/g, ' ');
}
// Normalize spaces
src = src.replace(/\u00a0/g, ' ');
if (src.indexOf('\u2424') >= 0) {
src = src.replace(/\u2424/g, '\n');
}
// Normalize newlines
src = src.replace(/\r\n/, '\n');
src = src.replace(/\r\u0085/, '\n');
src = src.replace(/[\u2424\u2028\u0085]/g, '\n');
// Replace tabs with proper number of spaces (1..4)
if (src.indexOf('\t') >= 0) {

Loading…
Cancel
Save