This adds a new preserve_entities keyword argument to pynliner, for both instances and shortcut methods.
Options for preserve_entities are True and False. As of now we assume if you don't tell us, you mean True (this may change before this PR lands.)
BeautifulSoup4 converts all entities to Unicode with no option to prevent it. This means to preserve entities we must first swap them for placeholders then put them back. This introduces 2 more regular expression substitution searches which doesn't help the run speed at all. However, It does set up a substitution system which can be the basis for handling some templating languages in the future (maybe).
I'm going to let this mellow until I'm less sleep deprived. Feel free to add comments/suggestions/insults but I'm particularly interested in contributions in the form of test cases.
This adds a new
preserve_entities
keyword argument to pynliner, for both instances and shortcut methods.Options for
preserve_entities
areTrue
andFalse
. As of now we assume if you don't tell us, you meanTrue
(this may change before this PR lands.)BeautifulSoup4 converts all entities to Unicode with no option to prevent it. This means to preserve entities we must first swap them for placeholders then put them back. This introduces 2 more regular expression substitution searches which doesn't help the run speed at all. However, It does set up a substitution system which can be the basis for handling some templating languages in the future (maybe).
I'm going to let this mellow until I'm less sleep deprived. Feel free to add comments/suggestions/insults but I'm particularly interested in contributions in the form of test cases.