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.
@@ -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(/^(доц\.|проф\.|ст\.преп\.|ст\. преп\.|преп\.|асс\.)\s*/);
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 = plainText.match(/\((лк|пр|лб|зач|экз|зчО|кр|конс)\)/);
194
- const weeksMatch = plainText.match(/\(([^)]*нед\.?[^)]*)\)/);
195
- const roomMatch = fullHtml.match(/(?:<sup>[^<]*<\/sup>)?([А-Яа-яA-Za-z]-\d+)/);
196
- const teacherMatch = fullHtml.match(/<br\s*\/?>\s*([^<]+?)(?:<br|<\/td|<i|$)/);
197
- const subgroupMatch = plainText.match(/(\d+)\s*подгруппа/);
198
- const weekParity = parseWeekParity(fullHtml);
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chuvsu-js",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Node.js library for ChuvSU student portal (lk.chuvsu.ru) and schedule (tt.chuvsu.ru)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",