j0k3r / graby

Graby helps you extract article content from web pages
MIT License
365 stars 74 forks source link

Change the way to merge config for find & replace string #207

Closed j0k3r closed 5 years ago

j0k3r commented 5 years ago

find_string & replace_string had special case when merging them. But it failed when merging multiple times some site config.

Update it to a bit more complex solution to ensure find_string & replace_string aren't duplicated when merging config multiple times.

We can't perform an array_unique on these values (looks like fabrizio got the point years ago) mostly because replace_string can have same values, example:

find_string: <amp-img
replace_string: <img

find_string: <other-img
replace_string: <img

To fix that issue, we combine find & replace as key & value in one array, we merge them (so we can't have duplicates keys) and then rebuild find & replace string in the current config.

@fivefilters, you might be interested by applying that fix on FullTextRSS I think.

Fix https://github.com/wallabag/wallabag/issues/4025

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.02%) to 96.531% when pulling 9336ff5ccf618404b3579ffcdf4e413a93dcc3d8 on fix-bad-merge-find-replace-string into 36a0f614cbc684997f6e9f72e1c37273e491b8e5 on master.