diff options
Diffstat (limited to 'scalatex/api/src/main/scala/scalatex/stages/Trim.scala')
-rw-r--r-- | scalatex/api/src/main/scala/scalatex/stages/Trim.scala | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/scalatex/api/src/main/scala/scalatex/stages/Trim.scala b/scalatex/api/src/main/scala/scalatex/stages/Trim.scala deleted file mode 100644 index 8993734..0000000 --- a/scalatex/api/src/main/scala/scalatex/stages/Trim.scala +++ /dev/null @@ -1,29 +0,0 @@ -package scalatex.stages -import acyclic.file - -/** - * Preprocesses the input string to normalize things related to whitespace - * - * Find the "first" non-whitespace-line of the text and remove the front - * of every line to align that first line with the left margin. - * - * Remove all trailing whitespace from each line. - */ -object Trim extends (String => (String, Int)){ - def apply(str: String) = { - val lines = str.split("\n", -1) - val offset = lines.iterator - .filter(_.length > 0) - .next() - .takeWhile(_ == ' ') - .length - val res = lines.iterator - .map(_.replaceFirst("\\s+$", "")) - .mkString("\n") - (res, offset) - } - def old(str: String) = { - val (res, offset) = this.apply(str) - res.split("\n", -1).map(_.drop(offset)).mkString("\n") - } -} |