]> granicus.if.org Git - apache/commitdiff
Remove trailing and leading newlines and spaces caused by xml formatting styles
authorDaniel Gruno <humbedooh@apache.org>
Thu, 26 Apr 2012 06:09:31 +0000 (06:09 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Thu, 26 Apr 2012 06:09:31 +0000 (06:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1330665 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/style/scripts/prettify.js

index f287cdecc15cead548de3028dd5d85a84b3c0f13..20ca6930fb0735a790c3586bf78f966064e696de 100644 (file)
@@ -546,6 +546,10 @@ var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[
               text = text.replace(/[ \t\r\n]+/g, ' ');
             } else {
               text = text.replace(/\r\n?/g, '\n');  // Normalize newlines.
+              text = text.replace(/^\r?\n\s*/g, '');  // Remove leading newlines
+              text = text.replace(/^\s*/g, '');  // Remove leading spaces due to indented formatting
+              text = text.replace(/\r?\n\s*$/g, '');  // Remove ending newlines
+              
             }
             // TODO: handle tabs here?
             chunks[k] = text;