logic is hard to read because it is dispersed between the logic handling the tag and the logic handling the attributes themselves
logic is not totally accurate because we do not take into account the whole tree hierarchy (e.g. we rewrite meta tags no matter where they are, while we should do it only in html->head->meta) ; this is not a huge concern because usually when tag should be rewritten at only one position of the tree, then it is not valid from an HTML perspective to find it somewhere else ; however it does not help to read
logic is not open to extension of new rules: adding new rules involves precise tweaking of various parts of the code where one would prefer to just declare a new rule with its logic somewhere (probably in a class)
logic is not really easy to test: in order to test the rules, we need to setup the whole HTML document and the whole rewriter, including the set of known ZIM items, ... even if we do not care about them
Currently, when we rewrite HTML tags: