Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added collapseWhitespace static function, used it on parseP

  • Loading branch information...
commit 9172f0edfaab6bf9487a1ae0b989580b21c62425 1 parent e43ac1c
@barnabywalters barnabywalters authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 mf2/Parser.php
View
17 mf2/Parser.php
@@ -57,6 +57,19 @@ public function __construct($input, $baseurl = null, $convertClassic = false) {
}
// !Utility Functions
+
+ /**
+ * Collapse Whitespace
+ *
+ * Collapses any sequences of whitespace within a string into a single space
+ * character.
+ *
+ * @param string $str
+ * @return string
+ */
+ public static function collapseWhitespace($str) {
+ return preg_replace('/\s+/', ' ', $str);
+ }
/**
* Microformat Name From Class string
@@ -156,8 +169,8 @@ public function parseP(\DOMElement $p) {
// Use innertext
$pValue = trim($p->nodeValue);
}
-
- return $pValue;
+
+ return self::collapseWhitespace($pValue);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.