File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1215,19 +1215,24 @@ def _static_extract_serialized_html_deps(
12151215        # HTMLdependency.get_tag_representation() 
12161216        pattern  =  r'<script type="application/json" data-html-dependency="">((?:.|\r|\n)*?)</script>' 
12171217        dep_strs  =  re .findall (pattern , html )
1218-         # Deduplicate dependencies. htmltools normally would dedupe dependencies, but 
1219-         # with HTMLTextDocuments, the input HTML would usually have been generated by 
1220-         # something else (like Quarto) and may not have the dependencies deduped. 
1221-         dep_strs  =  list (set (dep_strs ))
12221218
12231219        # Remove the serialized HTML dependencies from the HTML string 
12241220        html  =  re .sub (pattern , "" , html )
12251221
1222+         # Reconstitute the HTMLDependency objects 
1223+         # 
1224+         # Note: htmltools normally would dedupe dependencies, but 
1225+         # with HTMLTextDocuments, the input HTML would usually have been generated by 
1226+         # something else (like Quarto) and may not have the dependencies deduped. 
1227+         seen_deps : set [str ] =  set ()
12261228        deps : list [HTMLDependency ] =  []
12271229        for  dep_str  in  dep_strs :
1230+             if  dep_str  in  seen_deps :
1231+                 continue 
12281232            args  =  json .loads (dep_str )
12291233            dep  =  HTMLDependency (** args )
12301234            deps .append (dep )
1235+             seen_deps .add (dep_str )
12311236
12321237        return  (html , deps )
12331238
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments