@@ -18,13 +18,13 @@ def extract_css_skin(html: str) -> dict[str, Any]:
1818
1919
2020def _collect_css (html : str ) -> str :
21- style_blocks = re .findall (r"<style[^>]*>(.*?)</style>" , html , flags = re .I | re .S )
22- inline_styles = re .findall (r"\sstyle=[\"']([^\"']+)[\"']" , html , flags = re .I )
21+ style_blocks = re .findall (r"<style[^>]*>(.*?)</style>" , html , flags = re .IGNORECASE | re .DOTALL )
22+ inline_styles = re .findall (r"\sstyle=[\"']([^\"']+)[\"']" , html , flags = re .IGNORECASE )
2323 return "\n " .join ([* style_blocks , * inline_styles ])
2424
2525
2626def _extract_fonts (css : str ) -> dict [str , str ]:
27- families = re .findall (r"font-family\s*:\s*([^;}{]+)" , css , flags = re .I )
27+ families = re .findall (r"font-family\s*:\s*([^;}{]+)" , css , flags = re .IGNORECASE )
2828 cleaned : list [str ] = []
2929 for family in families :
3030 first = family .split ("," )[0 ].strip ().strip ("'\" " )
@@ -68,10 +68,10 @@ def _first_css_value(
6868 hinted = _first_block (css , rf"[^{{]*(?:{ selector_hint } )[^{{]*" )
6969 if hinted :
7070 haystack = hinted
71- match = re .search (rf"{ property_name } \s*:\s*([^;}}{{]+)" , haystack , flags = re .I )
71+ match = re .search (rf"{ property_name } \s*:\s*([^;}}{{]+)" , haystack , flags = re .IGNORECASE )
7272 return match .group (1 ).strip () if match else default
7373
7474
7575def _first_block (css : str , selector_pattern : str ) -> str :
76- match = re .search (rf"{ selector_pattern } \{{([^}}]+)\}}" , css , flags = re .I | re .S )
76+ match = re .search (rf"{ selector_pattern } \{{([^}}]+)\}}" , css , flags = re .IGNORECASE | re .DOTALL )
7777 return match .group (1 ) if match else ""
0 commit comments