feediron / ttrss_plugin-feediron

Evolution of ttrss_plugin-af_feedmod
https://discourse.tt-rss.org/t/plugin-update-feediron-v1-2-0/2018
MIT License
206 stars 34 forks source link

Execution order/future works #120

Open dugite-code opened 5 years ago

dugite-code commented 5 years ago

Future Discussion

Filters could use an Observer pattern to make extending and modifying FeedIron a simpler task. This would Also free up Filters so they can be better mixed and matched.

THIS WOULD BE A BREAKING CHANGE

I'm proposing adding an execution order to filters. I feel this makes filter a bit more readable not to mention powerful. For example you could have a "processed" variable so an option could choose to work on the original html or the processed html passed from previous operations.

"somesite.com":{
    "1": {
        "type": "readability"
    },
    "2": {
        "type": "insert",
        "string": "<br>"
    },
    "3": {
        "type": "xpath",
        "processed": false,
        "xpath": "article",
        "cleanup": "h2"
    },
    "join_element": "<p>",
    "cleanup": ["~<script([^<]|<(?!/script))*</script>~msi"],
    "debug": true
}
dugite-code commented 4 years ago

On Hold till after initial Module work is completed

dugite-code commented 4 years ago

Now that the Initial initial Module work is completed execution order work is underway. Replacing the current module loading with an Observer Pattern can be introduced at a later date

aparhatus commented 4 years ago

I was just about to ask if this was possible, when I came upon this issue. This would be an excellent addition.

Is it possible to do anything similar currently? My main wish is to use a different join_element for different elements, so I tried to use multiple xpath filters (similar to your example, not by using an array), but I couldn't get it working.

dugite-code commented 4 years ago

I haven't merged this into master yet as it's a general work in progress and has several issues to sort out. Unfortunately I've not had a much free time recently to push this forward.

You can see my work in the modular-dev branch: https://github.com/feediron/ttrss_plugin-feediron/blob/modular-dev/init.php#L534