You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since mf2py does class substitutions for backcompat parsing it changes the original BeautifulSoup document given to parse. Not sure this is a bug for usage yet, but is a "quirk" for sure.
The following is an example, with the html variable being the following HTML as a string
<articleclass="hentry"><sectionclass="entry-content"><pclass="entry-summary">This is a summary</p><p>This is <ahref="/tags/mytag" rel="tag">mytag</a> inside content. </p></section></article>
Change the entire document to mf2 equivalent i.e. don't make shallow copies while applying mf1 to mf2 conversion rules. (This was the original behaviour which I changed! my bad.)
Implement some workaround to make a deep copy and work on that for parsing to completely preserve the original document.
The text was updated successfully, but these errors were encountered:
seems very low priority to me, especially given other higher priority spec bug fixes and features on tap (whitespace, alt text, etc). i think just documenting it in the docstring is fine.
Since mf2py does class substitutions for backcompat parsing it changes the original BeautifulSoup document given to parse. Not sure this is a bug for usage yet, but is a "quirk" for sure.
cc: @kevinmarks @snarfed @sknebel @bear
Example
The following is an example, with the
html
variable being the following HTML as a stringNow run the following in python
This will output the original HTML
Now run
This will output the "modified" HTML
Note the following:
article
gets an additionalh-entry
class from backcompat>>> parse(bs)
again will give erroneous results as it will skip all the properties!Problem code
This happens because of https://github.com/microformats/mf2py/blob/master/mf2py/backcompat.py#L112 in backcompat. This creates a shallow copy of the element to apply the backcompat rules (BeautifulSoup does not support deepcopy yet.) But this does not affect the children of the element somehow.
Possible solutions
The text was updated successfully, but these errors were encountered: