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

Question for wrap_in() #340

Open
HolgerAusB opened this issue Nov 18, 2023 · 3 comments
Open

Question for wrap_in() #340

HolgerAusB opened this issue Nov 18, 2023 · 3 comments

Comments

@HolgerAusB
Copy link
Contributor

Question to wrap_in(), from here: #262

I love it! @Kdecherf is there a reason, why wrapping is only allowed with blockquote, p and div? Or did I just read the code wrong? Could also be helpful for any other tag-pair like b, strong, em, h2 and even foobar. So if this is done before most other things, I could strip or string_replace 'foobar'. Which currently is sometimes difficult because of auto-stripping span-tags in wallabag.

@fivefilters could we please have this COOOOL feature for FTR and P2K, too?

I used it here:

@Kdecherf
Copy link
Collaborator

Hello @HolgerAusB,

I've put an allow-list in order to respect HTML semantic usage: blockquote, p and div are allowing flow content tags whereas b, strong and others only accept phrasing content tags, see:

@HolgerAusB
Copy link
Contributor Author

HolgerAusB commented Nov 20, 2023

@Kdecherf Understood. We can't set attributes for the wrap, can we? Like class, id, style... ok, last one would be nasty, I know.

@HolgerAusB
Copy link
Contributor Author

@Kdecherf another idea would be to have a new
wrap_text_in(<tag>): <xpath>
where only the found text() within matching xpath could be wrapped in <strong>, <em>, <h2> or many others.

Example

source:

<div class="foobar bold column stress">
    <p>
        Lorem ipsum dolor sit amet, consectetur adipisici elit...
    </p>
</div>

site-config:

wrap_text_in(em): //div[contains(@class, 'stress')]
wrap_text_in(strong): //div[contains(@class, 'bold')]

results in:

<div class="foobar bold column stress">
    <p>
        <em>
            <strong>
                Lorem ipsum dolor sit amet, consectetur adipisici elit...
            </strong>
        </em>
    </p>
</div>

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