Search in sources :

Example 1 with InlineRsrc

use of org.asqatasun.contentadapter.util.InlineRsrc in project Asqatasun by Asqatasun.

the class CSSJsoupPhlocContentAdapterImpl method adaptInlineCSS.

/**
     * Retrieve css content and adapt it for each inline resource
     */
private void adaptInlineCSS() {
    Set<Long> relatedCssIdSet = new HashSet<>();
    for (Element el : inlineCssElements) {
        String attributeValue = el.attr("style");
        if (StringUtils.isNotBlank(attributeValue)) {
            Resource cssResource = new CSSResourceImpl(el.nodeName() + "{" + attributeValue + "}", 0, new InlineRsrc());
            StylesheetContent cssContent = getStylesheetFromInlineResource(cssResource.getResource());
            adaptContent(cssContent, cssResource, getCurrentResourcePath(el.baseUri()), null);
            relatedCssIdSet.add(getContentDataService().saveOrUpdate(cssContent).getId());
        }
    }
    getContentDataService().saveContentRelationShip(getSSP(), relatedCssIdSet);
}
Also used : StylesheetContent(org.asqatasun.entity.audit.StylesheetContent) Element(org.jsoup.nodes.Element) Resource(org.asqatasun.contentadapter.Resource) InlineRsrc(org.asqatasun.contentadapter.util.InlineRsrc)

Aggregations

Resource (org.asqatasun.contentadapter.Resource)1 InlineRsrc (org.asqatasun.contentadapter.util.InlineRsrc)1 StylesheetContent (org.asqatasun.entity.audit.StylesheetContent)1 Element (org.jsoup.nodes.Element)1