use of org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent in project OpenOLAT by OpenOLAT.
the class XmlDocument method readContent.
// fxdiff FXOLAT-97: index run in infinite loop
protected FileContent readContent(VFSLeaf leaf) throws IOException {
InputStream is = leaf.getInputStream();
// Remove all HTML and Tags
NekoContent output;
try {
output = new NekoHTMLFilter().filter(is);
if (log.isDebug())
log.debug("HTML content without tags :" + output);
} catch (Exception e) {
throw new IOException(e);
} finally {
FileUtils.closeSafely(is);
}
return new FileContent(output.getTitle(), output.getContent());
}
use of org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent in project OpenOLAT by OpenOLAT.
the class NekoHTMLFilterTest method testHtmlTextAndTitle.
@Test
public void testHtmlTextAndTitle() {
String htmlText = "<html><head><title>Hello Neko</title><meta name=\"generator\" content=\"olat-tinymce-1\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>" + "<H1>Test HTML Seite fuer JUnit Test</H1>" + "Dies ist<br />der Test Text" + // Text = 'Dies ist der Test Text'
"</body></html>";
// must include '\u00A0' !!! 19.5.2010/cg
String text = "Hello Neko Test HTML Seite fuer JUnit Test Dies ist der Test\u00A0Text";
NekoContent content = filter.filter(new ByteArrayInputStream(htmlText.getBytes()));
Assert.assertNotNull(content);
Assert.assertEquals("Hello Neko", content.getTitle());
Assert.assertEquals(text, content.getContent());
}
use of org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent in project openolat by klemens.
the class XmlDocument method readContent.
// fxdiff FXOLAT-97: index run in infinite loop
protected FileContent readContent(VFSLeaf leaf) throws IOException {
InputStream is = leaf.getInputStream();
// Remove all HTML and Tags
NekoContent output;
try {
output = new NekoHTMLFilter().filter(is);
if (log.isDebug())
log.debug("HTML content without tags :" + output);
} catch (Exception e) {
throw new IOException(e);
} finally {
FileUtils.closeSafely(is);
}
return new FileContent(output.getTitle(), output.getContent());
}
use of org.olat.core.util.filter.impl.NekoHTMLFilter.NekoContent in project openolat by klemens.
the class NekoHTMLFilterTest method testHtmlTextAndTitle.
@Test
public void testHtmlTextAndTitle() {
String htmlText = "<html><head><title>Hello Neko</title><meta name=\"generator\" content=\"olat-tinymce-1\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>" + "<H1>Test HTML Seite fuer JUnit Test</H1>" + "Dies ist<br />der Test Text" + // Text = 'Dies ist der Test Text'
"</body></html>";
// must include '\u00A0' !!! 19.5.2010/cg
String text = "Hello Neko Test HTML Seite fuer JUnit Test Dies ist der Test\u00A0Text";
NekoContent content = filter.filter(new ByteArrayInputStream(htmlText.getBytes()));
Assert.assertNotNull(content);
Assert.assertEquals("Hello Neko", content.getTitle());
Assert.assertEquals(text, content.getContent());
}
Aggregations