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

Escape text output in HTML Emitter #13

Closed
wants to merge 1 commit into from

Conversation

bterlson
Copy link
Contributor

No description provided.

@rbuckton
Copy link
Owner

rbuckton commented Oct 1, 2015

Is it really necessary to take an external dependency for something as simple as HTML entity escaping?

@rbuckton
Copy link
Owner

rbuckton commented Oct 1, 2015

There's already an encode method on Emitter that does this:

    protected encode(text: string) {
        return text.replace(/[&<>'"]/g, ch => {
            switch (ch) {
                case "&": return "&amp;";
                case "<": return "&lt;";
                case ">": return "&gt;";
                case "'": return "&apos;";
                case '"': return "&quot;";
            }
        });
    }

rbuckton added a commit that referenced this pull request Oct 1, 2015
@rbuckton
Copy link
Owner

rbuckton commented Oct 1, 2015

I've fixed the missing encoding cases using existing functionality. Closing this PR.

@rbuckton rbuckton closed this Oct 1, 2015
@bterlson
Copy link
Contributor Author

bterlson commented Oct 1, 2015

I'll convert you to substackianism one day :-P But for now, thanks a bunch!!

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.

None yet

2 participants