Commit 02c8ebd5 authored by Patrick Barroca's avatar Patrick Barroca 🐧

hotline #69245 : provide old alphaMaj format

parent 8b52f325
Pipeline #3282 passed with stage
in 0 seconds
......@@ -155,8 +155,15 @@ class Linse {
}
public function alphaMaj($chaine) {
return $this->getConverter()->toIndexable($chaine);
/**
* return provided string uppercased and converted to ascii
*
* @param $string string to transform
* @param $compact bool compact whitespaces
* @return string
*/
public function alphaMaj($string, $compact=true) {
return $this->getConverter()->toIndexable($string, $compact);
}
......
......@@ -38,11 +38,13 @@ class Linse_Converter {
}
public function toIndexable($data) {
return preg_replace('/\s+/',
' ',
trim(str_replace($this->_ascii_map,
$this->_ascii_to_uppercase,
$data)));
public function toIndexable($data, $compact=true) {
$ascii = trim(str_replace($this->_ascii_map,
$this->_ascii_to_uppercase,
$data));
return $compact
? preg_replace('/\s+/', ' ', $ascii)
: $ascii;
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@
class Linse_Iso5426Converter extends Linse_Converter {
public function toIndexable($data) {
public function toIndexable($data, $compact=true) {
$data = preg_replace('/\210.+\211/', '', $data); // Les delimiteurs d'article bnf NSB NSE
$result = '';
......@@ -37,7 +37,7 @@ class Linse_Iso5426Converter extends Linse_Converter {
}
$result = preg_replace('/[' . chr(123) . '-' . chr(255) .']/', '', $result);
return parent::toIndexable($result);
return parent::toIndexable($result, $compact);
}
......
......@@ -60,13 +60,13 @@ class Linse_Utf8Converter extends Linse_Converter {
];
public function toIndexable($data) {
public function toIndexable($data, $compact=true) {
$data = mb_strtoupper($data);
$data = str_replace(array_keys($this->tableMajUtf8),
array_values($this->tableMajUtf8),
$data);
$data = utf8_decode($data);
return parent::toIndexable($data);
return parent::toIndexable($data, $compact);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment