chuvsu-js 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/parse.js +1 -1
- package/dist/tt/parse.js +13 -6
- package/package.json +1 -1
package/dist/common/parse.js
CHANGED
|
@@ -31,7 +31,7 @@ export function parseTeacher(s) {
|
|
|
31
31
|
const trimmed = s.trim();
|
|
32
32
|
if (!trimmed)
|
|
33
33
|
return { name: "" };
|
|
34
|
-
const posMatch = trimmed.match(/^(доц\.|проф\.|ст\.преп\.|ст\.
|
|
34
|
+
const posMatch = trimmed.match(/^(доц\.|проф\.|ст\.преп\.|ст\. преп\.|преп\.|асс\.|зав\.каф\.)\s*/);
|
|
35
35
|
const afterPos = posMatch ? trimmed.slice(posMatch[0].length) : trimmed;
|
|
36
36
|
const degMatch = afterPos.match(/^([кд]\.[а-яё.-]+н\.)\s*/);
|
|
37
37
|
const name = degMatch ? afterPos.slice(degMatch[0].length).trim() : afterPos.trim();
|
package/dist/tt/parse.js
CHANGED
|
@@ -185,17 +185,24 @@ function parseSemesterEntry(el) {
|
|
|
185
185
|
if (sub)
|
|
186
186
|
substitutions.push(sub);
|
|
187
187
|
}
|
|
188
|
+
// Strip red divs from HTML/text before parsing the regular entry
|
|
189
|
+
let cleanHtml = fullHtml;
|
|
190
|
+
let cleanText = plainText;
|
|
191
|
+
for (const div of redDivs) {
|
|
192
|
+
cleanHtml = cleanHtml.replace(div.outerHTML ?? "", "");
|
|
193
|
+
cleanText = cleanText.replace(text(div), "");
|
|
194
|
+
}
|
|
188
195
|
// Parse regular entry
|
|
189
196
|
const subjectEl = td.querySelector('span[style*="color: blue"]');
|
|
190
197
|
const subject = subjectEl ? text(subjectEl) : "";
|
|
191
198
|
if (!subject)
|
|
192
199
|
return null;
|
|
193
|
-
const typeMatch =
|
|
194
|
-
const weeksMatch =
|
|
195
|
-
const roomMatch =
|
|
196
|
-
const teacherMatch =
|
|
197
|
-
const subgroupMatch =
|
|
198
|
-
const weekParity = parseWeekParity(
|
|
200
|
+
const typeMatch = cleanText.match(/\((лк|пр|лб|зач|экз|зчО|кр|конс)\)/);
|
|
201
|
+
const weeksMatch = cleanText.match(/\(([^)]*нед\.?[^)]*)\)/);
|
|
202
|
+
const roomMatch = cleanHtml.match(/(?:<sup>[^<]*<\/sup>)?([А-Яа-яA-Za-z]-\d+)/);
|
|
203
|
+
const teacherMatch = cleanHtml.match(/<br\s*\/?>\s*([^<]+?)(?:<br|<\/td|<div|<i|$)/);
|
|
204
|
+
const subgroupMatch = cleanText.match(/(\d+)\s*подгруппа/);
|
|
205
|
+
const weekParity = parseWeekParity(cleanHtml);
|
|
199
206
|
return {
|
|
200
207
|
room: roomMatch?.[1] ?? "",
|
|
201
208
|
subject,
|