use of org.xwiki.xml.html.filter.HTMLFilter in project xwiki-platform by xwiki.
the class PdfExportImpl method convertToStrictXHtml.
/**
* Cleans up an HTML document, turning it into valid XHTML.
*
* @param input the source HTML to process
* @return the cleaned up source
*/
private String convertToStrictXHtml(String input) {
LOGGER.debug("Cleaning HTML:\n{}", input);
HTMLCleaner cleaner = Utils.getComponent(HTMLCleaner.class);
HTMLCleanerConfiguration config = cleaner.getDefaultConfiguration();
List<HTMLFilter> filters = new ArrayList<HTMLFilter>(config.getFilters());
filters.add(Utils.getComponent(HTMLFilter.class, "uniqueId"));
config.setFilters(filters);
String result = HTMLUtils.toString(cleaner.clean(new StringReader(input), config));
LOGGER.debug("Cleaned XHTML:\n{}", result);
return result;
}
use of org.xwiki.xml.html.filter.HTMLFilter in project xwiki-platform by xwiki.
the class OfficeHTMLCleaner method getDefaultConfiguration.
@Override
public HTMLCleanerConfiguration getDefaultConfiguration() {
HTMLCleanerConfiguration configuration = this.defaultHtmlCleaner.getDefaultConfiguration();
// Add office cleaning filters after the default filters.
List<HTMLFilter> filters = new ArrayList<HTMLFilter>(configuration.getFilters());
filters.addAll(Arrays.asList(this.stripperFilter, this.styleFilter, this.redundancyFilter, this.paragraphFilter, this.imageFilter, this.anchorFilter, this.listFilter, this.tableFilter, this.lineBreakFilter));
configuration.setFilters(filters);
return configuration;
}
use of org.xwiki.xml.html.filter.HTMLFilter in project xwiki-platform by xwiki.
the class WysiwygHTMLCleaner method getDefaultConfiguration.
@Override
public HTMLCleanerConfiguration getDefaultConfiguration() {
HTMLCleanerConfiguration configuration = this.defaultHtmlCleaner.getDefaultConfiguration();
// Add office cleaning filters after the default filters.
List<HTMLFilter> filters = new ArrayList<HTMLFilter>(configuration.getFilters());
filters.addAll(Arrays.asList(this.stripperFilter, this.styleFilter, this.redundancyFilter, this.paragraphFilter, this.imageFilter, this.listFilter, this.tableFilter));
configuration.setFilters(filters);
return configuration;
}
Aggregations