-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for wrap_in
#180
Comments
Might be an interesting feature. |
I am wondering if it's not possible to implement something more drastic, and which may be more interesting on the long term: the possibility to transform an element (given an XPath) into another element. In an ideal case, it could be possible to:
Finally, I think that methods (maybe called functions in PHP? Coming from Python, sorry) able to do that would also allow to manipulate the DOM in an easier way and avoid the use of regular expressions in php-readability. |
I've seen this on SO : https://stackoverflow.com/a/4675664, which allows to delete an element selected by an XPath while keeping its content. It would be an easy answer to the point 3 of my post above. Renaming a node is a bit more troublesome, because it consists to select everything in that node, create a new element, move everything into the latter, then replacing the first node by the new one. However, as tricky as it could be to implement, the method could then be used for all the examples above. Edit: it might be easier than I thought, see this link. |
@techexo thanks for your feedback. A way to transform/rename a node could be interesting, I think a separate issue for it would be very welcome ;-) |
Fixes j0k3r#180 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Fixes j0k3r#180 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Fixes j0k3r#180 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Fixes j0k3r#180 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Some site configs have
wrap_in([string]): [xpath]
directives.As this directive is not supported by fivefilters (see fivefilters/ftr-site-config#249 (comment)) there's no documentation to say what it does and how it works. Its name suggests that it instructs the content extractor to wrap elements matching
[xpath]
withstring
tags, e.g.:wrap_in(figure): //img
.This directive would let us to wrap
span
quotes withblockquote
tags like on this page: https://washingtonmonthly.com/magazine/january-february-march-2018/how-to-fix-facebook-before-it-fixes-us/Should we implement it in Graby?
The text was updated successfully, but these errors were encountered: