countergram/pytidylib

<figure> and <figcaption> not recognized

Garrett-R opened this issue · 2 comments

In the below snippet which I took from this page, <figure> and <figcaption> are not recognized:

In [1]: html = ''' 
   ...: <!DOCTYPE html> 
   ...:  
   ...: <html lang="en"> 
   ...:  
   ...: <head><title>Hello</title></head> 
   ...:  
   ...: <body> 
   ...:  
   ...:  
   ...:  
   ...: <figure> 
   ...:  
   ...:     <img src="/media/examples/elephant-660-480.jpg" 
   ...:  
   ...:          alt="Elephant at sunset"> 
   ...:  
   ...:     <figcaption>An elephant at sunset</figcaption> 
   ...:  
   ...: </figure> 
   ...:  
   ...:  
   ...:  
   ...: </body></html> 
   ...: '''                                                                                                                                                                  

In [2]: from tidylib import tidy_document                                                                                                                                    

In [3]: doc, errors = tidy_document(html)                                                                                                                                    

In [4]: print(errors)                                                                                                                                                        
line 12 column 1 - Error: <figure> is not recognized!
line 12 column 1 - Warning: discarding unexpected <figure>
line 18 column 5 - Error: <figcaption> is not recognized!
line 18 column 5 - Warning: discarding unexpected <figcaption>
line 18 column 38 - Warning: discarding unexpected </figcaption>
line 20 column 1 - Warning: discarding unexpected </figure>

I believe this HTML should not generate any warnings.

The warnings are from tidy; the bindings have no influence over them. It's been ages since I've used tidy, but are you on tidy5?

Oh my bad! I was on a very outdated version that was somehow already installed on my machine (libtidy-0.99.so.0.0.0). I upgraded to libtidy.so.5.2.0 and the above issue is no longer seen, so this be closed off.

Thank you for your help!