Skip to content
Snippets Groups Projects
Commit 4d91449d authored by Steven Wittens's avatar Steven Wittens
Browse files

Quick improvement to autoteaser generation:

added double-width dot and comma, and right-to-left question mark as sentence boundaries.
parent 9541a3a2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -209,6 +209,18 @@ function node_teaser($body) { ...@@ -209,6 +209,18 @@ function node_teaser($body) {
return substr($body, 0, $length + 1); return substr($body, 0, $length + 1);
} }
if ($length = strpos($body, '。', $size)) {
return substr($body, 0, $length + 1);
}
if ($length = strpos($body, '、', $size)) {
return substr($body, 0, $length + 1);
}
if ($length = strpos($body, '؟ ', $size)) {
return substr($body, 0, $length + 1);
}
/* /*
** Nevermind, we split it the hard way ... ** Nevermind, we split it the hard way ...
*/ */
......
...@@ -209,6 +209,18 @@ function node_teaser($body) { ...@@ -209,6 +209,18 @@ function node_teaser($body) {
return substr($body, 0, $length + 1); return substr($body, 0, $length + 1);
} }
if ($length = strpos($body, '。', $size)) {
return substr($body, 0, $length + 1);
}
if ($length = strpos($body, '、', $size)) {
return substr($body, 0, $length + 1);
}
if ($length = strpos($body, '؟ ', $size)) {
return substr($body, 0, $length + 1);
}
/* /*
** Nevermind, we split it the hard way ... ** Nevermind, we split it the hard way ...
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment