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

Frontend script files with doctype are interpreted as HTML #50

Open
stevenzeck opened this issue Jul 13, 2018 · 3 comments
Open

Frontend script files with doctype are interpreted as HTML #50

stevenzeck opened this issue Jul 13, 2018 · 3 comments
Assignees

Comments

@stevenzeck
Copy link
Contributor

stevenzeck commented Jul 13, 2018

Take the following PHP code sample:

<!DOCTYPE html>
<html>
<body>

<?php  
$x = 1;
 
while($x <= 5) {
  echo "The number is: $x <br>";
  $x++;
} 
?>  

</body>
</html>

The framework interprets this as an HTML file instead of PHP. It you remove the doctype, it interprets it as PHP as expected. Furthermore, the opening and closing and tags are parsed as script instead of markup.

@prettydiff
Copy link
Collaborator

I am not properly supporting PHP at this time, so I am marking this as an enhancement. If full support were present then this would be an HTML document containing a PHP tag, and the PHP tag portion would be parsed separately from the HTML as PHP instead of JavaScript.

@stevenzeck stevenzeck changed the title PHP files with doctype are interpreted as HTML Frontend script files with doctype are interpreted as HTML Jul 17, 2018
@stevenzeck
Copy link
Contributor Author

I am not properly supporting PHP at this time, so I am marking this as an enhancement

Fair enough. Which languages are supported? It looks like any frontend non-JS scripting language (JSP, PHP, etc) has this issue. This piece of JSP does the same thing:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Home Page</title>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
</head>
<body>
<c:if test = "${exception ne null}">
   <p>Exception is : ${exception} <br>
   Exception Message: ${exception.message}</p>
</c:if>
</body>
</html>

@prettydiff
Copy link
Collaborator

I am really faking it a lot with a generic script parser. In most cases this isn't an issue, but I need to perform an audit and write a bunch more test cases. This will take time.

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

No branches or pull requests

2 participants