Skip to content
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

[idea] HTML Regex Substitution Feature #39

Open
Paculino opened this issue Jun 7, 2024 · 2 comments
Open

[idea] HTML Regex Substitution Feature #39

Paculino opened this issue Jun 7, 2024 · 2 comments

Comments

@Paculino
Copy link
Contributor

Paculino commented Jun 7, 2024

Whether I'm using dillo+ or not, I often come across instances when it would be helpful to find-and-replace within html prior to rendering, whether it be global and automatic, or manually applied. For instance, it is often helpful to redirect urls to alternative frontends (such as is possible in browsers such as firefox/icecat with the privacy-redirect extension). This is especially true here as there is no javascript, but the redirect must be manually done except when starting from these alternatives already. In addition to utilitarian redirects for frontends, it would allow redirecting to a preferred wikipedia theme/skin without signing in, or do something humorous like the xkcd substitutions.

If manual only, it could be accessed from the tools menu, or perhaps using ^h, as is common in programs with replace features. If global/automatic, it might be accessed similarly, or from within dillorc.

If in dillorc, the substitutions might be defined by something like sed_command='[command(s)]', then dillo could run sed from the system with the variable from dillorc being the command(s). This would ensure the substitution behavior matches with what the user is accustomed to.

@Paculino
Copy link
Contributor Author

Considering the cross-system difficulty with using regex.h for the regex aspect (simple literal replace doesn't need it, fortunately), it might be better to use execlp() or similar (maybe with blocking using && or ; for safety); that way the replacement syntax matches the default on the system that dillo is installed on. I'm working on some other things right now, but would like to work on getting this eventually. The execlp() could be run if and only if the line is not commented in dillorc, and it might be good to have a separate one for html/gemini/gopher and for css. Between downloading the page and rendering it, the page's files would go into the stdin for execlp. This would hurt performance, but could be disabled by commenting out the page. Once I have time, I will try to familiarize myself with the parts of the code that handle rendering pages and parsing dillorc.

@crossbowerbt
Copy link
Owner

I've used something similar in the past for an unrelated program.

We need to think a bit on how to implement it in an intelligent manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants