private void internStyles ( Document doc , List < ExternalCss > cssContents ) { Elements els = doc . select ( CSS_LINKS_SELECTOR ) ; for ( Element e : els ) { if ( ! TRUE_VALUE . equals ( e . attr ( SKIP_INLINE ) ) ) { String path = e . attr ( HREF_ATTR ) ; Element style = new Element ( Tag . valueOf ( STYLE_TAG ) , "" ) ; style . appendChild ( new DataNode ( getCss ( cssContents , path ) , "" ) ) ; e . replaceWith ( style ) ; } } }
Replace link tags with style tags in order to keep the same inclusion order