French Umlaut with curly brackets are still missing
karliwalti opened this issue · comments
At https://github.com/in2code-de/publications/blob/develop/Classes/Utility/BibTexUtility.php#L187 the German Umlaute were added, but the most common French ones are still missing. these are:
{'{e}} and {`{e}} and {^{e}} and {^{o}} and {\c{s}}
the results should be the same as without curly brackets.
Hi Mr. Karlen,
I added a feature branch frenchUmlauts and put in the missing french Umlaute. But as I did not understand well the right writing convention, please have a look at it:
https://github.com/in2code-de/publications/blob/frenchUmlaute/Classes/Utility/BibTexUtility.php#L187
please, can you send me a test set for the relevant bibtex possibilities? Then I can test it and make a pull request ...
Just added a pull request #62 that also fixes #57 in the same file.
Attached the test file (please rename it to .bib
TestLibraryPublications.txt
Da passiert noch einiges schief im Moment, welches noch nicht alles nachvollziebar ist. Wahrscheinlich hat dies wieder mit der Reihenfolge in der Tabelle zu tun, analog fix #6d70ece
The issue is that not all programs export bibtex files equally. There are at least 3 ways of outputting special characters. In addition, still some chars were not in the table.
I have now reorganized the array, and added a decoding array that will capture more cases. You can find it in #64 . Please let me know if ti work in your test env too.
Es macht gar nichts...
Welche php version wird da genutzt?
Undf gibt es eine fehlermeldung dazu im typo3 log?
php 7.4.30
es sind keine Fehler diesbezüglich vorhanden, denn er importiert ja erfolgreich, nur wird nichts decodiert..., die Zeichen werden halt so umgesetzt wie importiert.
Bitte
wiefolgt wechseln:
return str_replace(self::$decoding, self::$decoded, $string);
Für È und Ê hab ich selbst hinbekommen. Das č weiss ich nicht, wie ich das anstellen soll...
Das ş \c{s} war leider noch nicht drinn:
muss das zeichen noch in zeile
ergänzt werden.Danach die Zeile mit den "s" vor die zeile mit "c" schieben (natürlich in allen drei arrays).
The full list of latex characters can be found here: https://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf
This list is huge, and in case some of them will be used in the abstract, it might be imported wrongly. therefore, I suggest to use a latex engine for the abstract in the future.
ups, seems so.
But for the moment the solution fits much better, than before...
There are still 3 issues to clarify:
- Special Char acronym for names: Check whether special char here:
- A comma and empty space in year brackets for Mörgeli et al: This seems to be a rendering of the month which can deal only with numbers. solution: fix template with either replace "{publication.month}" with <publications:format.monthNameFromNumber month="{publication.month}" limit="3"/> or return characters instead of empty in or remove month from template altogether (best)
- There is unfortunately a space after A in Alesund. Likely this is due to a mistake in the template and not the conversion itself: keep as is.
to 3) the space after A in Alesund is in the imported bibfile...
to 2) As far as I remember, the month was included, because of sorting reasons. I will keep it in the template, but try your suggestion.
I have a solution for the issue 2, with the month, I expanded in my local environment the monthNameFromNumber class to catch and format month names, if the importer imports month names as strings, not as numbers.
and for issue 3 also, I put the Templates more inline, then the space dissapears...
Could you provide a solution for issue 1?
Could you try this?
it would also solve #63
/**
* @return string
*/
public function render(): string
{
/** Reformat already stored Initials */
$names_temp=str_replace('.',' ',$this->renderChildren());
/** Pick initial from each name and stich together with spacer*/
$names = GeneralUtility::trimExplode(' ', $names_temp, true);
$initials='';
foreach ($names as $name) {
$initials .= $name[0] . $this->arguments['suffix'] . $this->arguments['glue'];
}
return rtrim($initials, $this->arguments['glue']);
}
I don´t see the issue at the moment. The function trimExplode seems allright.
Could you try the following 2 outputs?
-
Add a second name in the benchmark i.e. Mörgeli, Änis Elvira
-
replace $name[0] with $name in code (only for debugging purpose)
Does setting a second name display ".E.," or nothing like before?
it seems that special Chars count as 2???
here is my code:
foreach ($names as $name) {
$firstletter = substr($name, 0, 3);
$initials .= $firstletter . $this->arguments['suffix'] . $this->arguments['glue'];
}
Yes it is a multibyte encoding. Unfortunately it does not need to be limited to 2 bytes.
Therefore, third thing to try:
3) replace '$name[0]' with 'mb_substr($name, 0, 1)'
cheerio, it works. :-)
so I make a pull request... :-)