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

Introduces additional '#59' when transforming HTML tags #32

Open
MichaelKaaden opened this issue Jan 27, 2023 · 2 comments
Open

Introduces additional '#59' when transforming HTML tags #32

MichaelKaaden opened this issue Jan 27, 2023 · 2 comments

Comments

@MichaelKaaden
Copy link
Contributor

MichaelKaaden commented Jan 27, 2023

[email protected] seems to get HTML tags wrong.

Taking <h1>Hello World!</h1> as input, it produces &lt&#59;h1&gt&#59;Hello World!&lt&#59;/h1&gt&#59;.

I had expected &lt;h1&gt;Hello World!&lt;/h1&gt;

Reproduction:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="xbbcode.css">
    <title>Example</title>
</head>
<body>
<script src="xbbcode.js"></script>
<script>
    var result = XBBCODE.process({
        text: "<h1>Hello World!</h1>",
    });
    console.error("Errors", result.error);
    console.dir(result.errorQueue);
    console.log(result.html);
</script>
</body>
</html>
@MichaelKaaden
Copy link
Contributor Author

Should be fixed with PR 31.

@DetlefPeters
Copy link

Sorry but this issue is not fixed with 0.2.2.
The "security fixes" leave unwanted #&59; in the resulting string!
return text
.replaceAll("'", ''')
.replaceAll('"', '"')
.replaceAll(';', ';');
should better be
return text
.replaceAll(';', ';')
.replaceAll("'", ''')
.replaceAll('"', '"');
so that the semicolons which are inserted in the other lines on purpose are not replaced again

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