Example below:
import wikitextparser as wtp
wikicode = wtp.parse("<ref>a [reference]</ref>")
tag = wikicode.get_tags()[0]
tag.parsed_contents
tag.string = "<ref>a modified [reference]</ref>"
Commenting out the call tag.parsed_contents produces expected behaviour. Then content of the tag doesn't seem to matter.
Example below:
Commenting out the call
tag.parsed_contentsproduces expected behaviour. Then content of the tag doesn't seem to matter.