Fixed the order Search/Replace expressions are applied.

S/R expressions where inserted at the start of the rules list in order so they where applied in reverse.  Used a reverse iterator over the list of search/replace expressions so they are applied in the correct order.
This commit is contained in:
Eli Algranti 2012-04-29 21:09:06 +10:00
parent 82ca10aca3
commit 9c5faee800

View File

@ -538,7 +538,7 @@ class HTMLPreProcessor(object):
search_replace = getattr(self.extra_opts, 'search_replace', None) search_replace = getattr(self.extra_opts, 'search_replace', None)
if search_replace: if search_replace:
search_replace = json.loads(search_replace) search_replace = json.loads(search_replace)
for search_pattern, replace_txt in search_replace: for search_pattern, replace_txt in reversed(search_replace):
do_search_replace(search_pattern, replace_txt) do_search_replace(search_pattern, replace_txt)
end_rules = [] end_rules = []