(titles: (HTMLElement | undefined)[])
| 762 | |
| 763 | // 处理作业和考试题目的方法 |
| 764 | const workOrExamQuestionTitleTransform = (titles: (HTMLElement | undefined)[]) => { |
| 765 | // 是否为多个小题的题目 |
| 766 | const is_multiple_question = titles.length > 1; |
| 767 | const optimizationTitle = titles |
| 768 | .map((el, i) => { |
| 769 | if (el) { |
| 770 | const titleCloneEl = el.cloneNode(true) as HTMLElement; |
| 771 | const childNodes = titleCloneEl.childNodes; |
| 772 | // 一般多小题题目只有第一个 title 存在题型文本 |
| 773 | if (i === 0) { |
| 774 | // 删除序号 |
| 775 | childNodes[0]?.remove(); |
| 776 | // 删除题型 |
| 777 | childNodes[0]?.remove(); |
| 778 | } |
| 779 | // 显示图片链接在题目中 |
| 780 | return optimizationElementWithImage(titleCloneEl, true).innerText; |
| 781 | } |
| 782 | return ''; |
| 783 | }) |
| 784 | .join('\n'); |
| 785 | |
| 786 | return removeRedundantWords( |
| 787 | StringUtils.of(optimizationTitle) |
| 788 | .nowrap(is_multiple_question ? '\n' : ' ') |
| 789 | .nospace() |
| 790 | .toString() |
| 791 | .trim(), |
| 792 | redundanceWordsText.split('\n') |
| 793 | ); |
| 794 | }; |
| 795 | |
| 796 | // 这里跟章节测试的连线题不一样,章节测试是新版连线题 |
| 797 | /** 新建答题器 */ |
no test coverage detected