Search in sources :

Example 26 with Mattext

use of org.olat.ims.qti.editor.beecom.objects.Mattext in project openolat by klemens.

the class CSVToQuestionConverter method createMattext.

private Mattext createMattext(String text) {
    // text is already in a CDATA
    text = text.replace("// <![CDATA[", "").replace("// ]]>", "");
    // Use explicit return which create a P tag if you want a line break.
    if (text.startsWith("<br />") && text.length() > 6)
        text = text.substring(6);
    if (text.endsWith("<br />") && text.length() > 6)
        text = text.substring(0, text.length() - 6);
    // Remove any conditional comments due to strange behavior in test (OLAT-4518)
    Filter conditionalCommentFilter = FilterFactory.getConditionalHtmlCommentsFilter();
    text = conditionalCommentFilter.filter(text);
    Mattext mattext = new Mattext(text);
    return mattext;
}
Also used : Mattext(org.olat.ims.qti.editor.beecom.objects.Mattext) Filter(org.olat.core.util.filter.Filter)

Aggregations

Mattext (org.olat.ims.qti.editor.beecom.objects.Mattext)26 ArrayList (java.util.ArrayList)18 Material (org.olat.ims.qti.editor.beecom.objects.Material)16 ChoiceQuestion (org.olat.ims.qti.editor.beecom.objects.ChoiceQuestion)12 Item (org.olat.ims.qti.editor.beecom.objects.Item)12 VFSItem (org.olat.core.util.vfs.VFSItem)10 ChoiceResponse (org.olat.ims.qti.editor.beecom.objects.ChoiceResponse)10 Control (org.olat.ims.qti.editor.beecom.objects.Control)10 List (java.util.List)8 FIBResponse (org.olat.ims.qti.editor.beecom.objects.FIBResponse)8 QTIObject (org.olat.ims.qti.editor.beecom.objects.QTIObject)8 Response (org.olat.ims.qti.editor.beecom.objects.Response)8 FIBQuestion (org.olat.ims.qti.editor.beecom.objects.FIBQuestion)6 Filter (org.olat.core.util.filter.Filter)4 EssayResponse (org.olat.ims.qti.editor.beecom.objects.EssayResponse)4 File (java.io.File)2 URL (java.net.URL)2 Iterator (java.util.Iterator)2 Element (org.dom4j.Element)2 Test (org.junit.Test)2