RedTurtle/rt.bulkmodify — pull request #7 by do3cc (2014-08-05 13:51:41+00:00)
Title: Portlets

Ok, this PR has a bunch of separate commits that were intended to help understanding the implementation details.

Adding logic to allow portlet modification makes things quite a bit more complicated. To make the change easier, I modified the code to not work on brains directly, but on result objects that by themselves know how to handle text changes. This also allows for doing a single query to modify both portlets and body text.
Also, a slight refactoring happens in the way, replacements are done. Before, the replacements were done one by one, with every replacement looking for potential replacements again. This was weird and might produce funny side effects if your replacement would still match the search query. So the refactoring also changes the way the replacements are done, all replacements happen at once. Unfortunately this is also not trivial since start and stop positions have to be updated all the time. The reason for the original implementation.
There are a bunch of new tests for the functionality, all tests pass.