Skip to content

Commit

Permalink
clean rubric blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
slooise1 committed Jul 23, 2024
1 parent 6d3a7d7 commit d3336b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/qti-transformer/transformers/qb-cleanup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ export function qbCleanup($: cheerio.CheerioAPI) {
$element.remove();
}
});

$('qti-rubric-block > qti-content-body div').each(function() {
const innerHtml = $(this).html().trim();
const textContent = $(this).text().trim();

if (!textContent || textContent === '&nbsp;' || innerHtml === '<br/>') {
$(this).remove();
} else {
if ($(this).contents().first().is('br')) {
$(this).contents().first().remove();
}
}
});
}

// $('div:has(qti-extended-text-interaction)').contents().unwrap();
Expand Down

0 comments on commit d3336b1

Please sign in to comment.