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

Bug Fixed: <header> being stripped. Simple update to RegEX #7

Merged
merged 2 commits into from
Dec 28, 2012

Conversation

exocom
Copy link
Contributor

@exocom exocom commented Dec 25, 2012

Hello,

Thanks for the awesome script! Please commit this bug fix. I have simply updated the existing RegEX to include \b word boundary.

I noticed that when a requested page contained a html5 header element it was being stripped out. The is because of the RegEX used in the replace function found in htmlCompat.

"<title>test regex</title>\n

content".replace(/<(html|head|body|title|meta)\b/gi,'<div');

Output:
"

test regex</title>\n
content"

Will match '<head ' and '' but not '<header ' or '

'.

Thanks,
Kalarrs Topham

Given this requested page:

A article header
A section of the article

Before Bug Fix: (header tag was stripped out)

            A article header

        <section>
            A section of the article
        </section>
    </article>

After Bug Fix:



A article header


A section of the article

Added word bound to htmlCompat().  This is because the regex previously matched the html5 <header> tag and striped it out.  Now '<head ' and '<head>' will match and '<header ' and '<header>' will not match so <header> will not longer be stripped out.
Added word bound to htmlCompat().  This is because the regex previously matched the html5 <header> tag and striped it out.  Now '<head ' and '<head>' will match and '<header ' and '<header>' will not match so <header> will not longer be stripped out.
balupton added a commit that referenced this pull request Dec 28, 2012
Bug Fixed: <header> being stripped. Simple update to RegEX
@balupton balupton merged commit 4a76a15 into bevry-archive:master Dec 28, 2012
@balupton
Copy link
Member

Merged :) Thanks so much! Never new of the bound word thing :)

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

Successfully merging this pull request may close these issues.

2 participants