37 $objects = preg_split(
"/\\@([\\w]*)/uix", $subject, -1, PREG_SPLIT_DELIM_CAPTURE
38 | PREG_SPLIT_NO_EMPTY);
40 if (in_array($objects[0], self::$ignored_keywords)) {
41 $objects = array_splice($objects, 2);
44 if (strlen((
string) $objects[0]) <= 3) {
45 $objects = array_splice($objects, 1);
49 foreach ($objects as $key => $object) {
50 if ((
int) $key % 2 == 0 || (
int) $key == 0) {
52 $entry[
'entryType'] = strtolower((
string) $object);
55 preg_match(
"/^{(?<cite>.*),\\n/um", (
string) $object, $cite_matches);
56 if ($cite_matches[
'cite'] ??
false) {
57 $entry[
'cite'] = $cite_matches[
'cite'];
61 $re =
"/(?<attr>[\\w]*)\\s*=\\s*[{\"]*(?<content>(.*?))\\s*[}\"]*?\\s*[,]*?\\s*\\n/";
63 preg_match_all($re, (
string) $object, $matches, PREG_SET_ORDER);
65 foreach ($matches as $match) {
66 $clean = $match[
'content'];
67 $clean = preg_replace(
"/[\", \\t\\s]*\\n/u",
"\n", $clean);
69 $entry[strtolower($match[
'attr'])] = $clean;
72 $entries[] = $entry ?? [];
86 $result = preg_replace(
"/^\n/um",
"", $result);
88 $result = preg_replace(
"/^[\\s]*$/um",
"\n", (
string) $result);
89 $result = preg_replace(
"/\\n\\n\\n/um",
"\n\n", (
string) $result);
92 $result = preg_replace(
"/^%.*\\n/um",
"", (
string) $result);
95 $result = preg_replace(
"/^[ ]+/um",
"\t", (
string) $result);
96 $result = preg_replace(
"/^([\\w])/um",
"\t$1", (
string) $result);
99 $result = preg_replace(
'/\\n}/uimx',
'}', (
string) $result);
102 $result = preg_replace(
"/}[\\s]*$/um",
"\n}", (
string) $result);
115 $bibtex_special_chars[
'ä'] =
'{\"a}';
116 $bibtex_special_chars[
'ë'] =
'{\"e}';
117 $bibtex_special_chars[
'ï'] =
'{\"i}';
118 $bibtex_special_chars[
'ö'] =
'{\"o}';
119 $bibtex_special_chars[
'ü'] =
'{\"u}';
120 $bibtex_special_chars[
'Ä'] =
'{\"A}';
121 $bibtex_special_chars[
'Ë'] =
'{\"E}';
122 $bibtex_special_chars[
'Ï'] =
'{\"I}';
123 $bibtex_special_chars[
'Ö'] =
'{\"O}';
124 $bibtex_special_chars[
'Ü'] =
'{\"U}';
125 $bibtex_special_chars[
'â'] =
'{\^a}';
126 $bibtex_special_chars[
'ê'] =
'{\^e}';
127 $bibtex_special_chars[
'î'] =
'{\^i}';
128 $bibtex_special_chars[
'ô'] =
'{\^o}';
129 $bibtex_special_chars[
'û'] =
'{\^u}';
130 $bibtex_special_chars[
'Â'] =
'{\^A}';
131 $bibtex_special_chars[
'Ê'] =
'{\^E}';
132 $bibtex_special_chars[
'Î'] =
'{\^I}';
133 $bibtex_special_chars[
'Ô'] =
'{\^O}';
134 $bibtex_special_chars[
'Û'] =
'{\^U}';
135 $bibtex_special_chars[
'à'] =
'{\`a}';
136 $bibtex_special_chars[
'è'] =
'{\`e}';
137 $bibtex_special_chars[
'ì'] =
'{\`i}';
138 $bibtex_special_chars[
'ò'] =
'{\`o}';
139 $bibtex_special_chars[
'ù'] =
'{\`u}';
140 $bibtex_special_chars[
'À'] =
'{\`A}';
141 $bibtex_special_chars[
'È'] =
'{\`E}';
142 $bibtex_special_chars[
'Ì'] =
'{\`I}';
143 $bibtex_special_chars[
'Ò'] =
'{\`O}';
144 $bibtex_special_chars[
'Ù'] =
'{\`U}';
145 $bibtex_special_chars[
'á'] =
'{\\\'a}';
146 $bibtex_special_chars[
'é'] =
'{\\\'e}';
147 $bibtex_special_chars[
'í'] =
'{\\\'i}';
148 $bibtex_special_chars[
'ó'] =
'{\\\'o}';
149 $bibtex_special_chars[
'ú'] =
'{\\\'u}';
150 $bibtex_special_chars[
'Á'] =
'{\\\'A}';
151 $bibtex_special_chars[
'É'] =
'{\\\'E}';
152 $bibtex_special_chars[
'Í'] =
'{\\\'I}';
153 $bibtex_special_chars[
'Ó'] =
'{\\\'O}';
154 $bibtex_special_chars[
'Ú'] =
'{\\\'U}';
155 $bibtex_special_chars[
'à'] =
'{\`a}';
156 $bibtex_special_chars[
'è'] =
'{\`e}';
157 $bibtex_special_chars[
'ì'] =
'{\`i}';
158 $bibtex_special_chars[
'ò'] =
'{\`o}';
159 $bibtex_special_chars[
'ù'] =
'{\`u}';
160 $bibtex_special_chars[
'À'] =
'{\`A}';
161 $bibtex_special_chars[
'È'] =
'{\`E}';
162 $bibtex_special_chars[
'Ì'] =
'{\`I}';
163 $bibtex_special_chars[
'Ò'] =
'{\`O}';
164 $bibtex_special_chars[
'Ù'] =
'{\`U}';
165 $bibtex_special_chars[
'ç'] =
'{\c c}';
166 $bibtex_special_chars[
'ß'] =
'{\ss}';
167 $bibtex_special_chars[
'ñ'] =
'{\~n}';
168 $bibtex_special_chars[
'Ñ'] =
'{\~N}';
169 $bibtex_special_chars[
'ń'] =
"{\\'n}";
170 $bibtex_special_chars[
'l'] =
"{\\'n}";
171 $bibtex_special_chars[
'&'] =
"{\&}";
172 $bibtex_special_chars[
'@'] =
"{\@}";
179 if (substr($s, 0, 3) === chr(hexdec(
'EF')) . chr(hexdec(
'BB')) . chr(hexdec(
'BF'))) {
180 return substr($s, 3);
Interface ilBiblFileReaderInterface.
static array $ignored_keywords
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilBiblFileReaderBase.
setFileContent(string $file_content)
convertBibSpecialChars()
PhpArrayIndexImmediatelyRewrittenInspection