Skip to content

Commit

Permalink
Solved issue 16, truncate bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fdisotto committed Jun 25, 2014
1 parent e292b31 commit 063810e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function first_n_words($text, $number_of_words) {
// \w[\w'-]* allows for any word character (a-zA-Z0-9_) and also contractions
// and hyphenated words like 'range-finder' or "it's"
// the /s flags means that . matches \n, so this can match multiple lines
$text = preg_replace("/^\W*((\w[\w'-]*\b\W*){1,$number_of_words}).*/ms", '\\1', $text);
$text = preg_replace("/^\W*((\w[\W'-]*\b\W*){1,$number_of_words}).*/ms", '\\1', $text);

// strip out newline characters from our excerpt
return str_replace("\n", "", $text);
Expand Down

0 comments on commit 063810e

Please sign in to comment.