Don't indent unclosed HTML tags containing server directives "<@"
See original GitHub issue- JSBeautify version : http://jsbeautifier.org/ on 2017-05-18
Steps to Reproduce
- Create a
test.aspx
ortest.jsp
file with the following content
<%@Master language="C#"%>
<%@Register TagPrefix="a" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="b" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="c" Namespace="a" Assembly="a"%>
<!DOCTYPE html>
<html><some-content /></html>
- Run jsbeautify. This will result in:
<%@Master language="C#"%>
<%@Register TagPrefix="a" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="b" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="c" Namespace="a" Assembly="a"%>
<!DOCTYPE html>
<html>
<some-content />
</html>
Expected outcome:
<%@Master language="C#"%>
<%@Register TagPrefix="a" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="b" Namespace="a" Assembly="a"%>
<%@Register TagPrefix="c" Namespace="a" Assembly="a"%>
<!DOCTYPE html>
<html>
<some-content />
</html>
Suggested solution: When no closing tag is found, treat server directive tags (<%@ %>
) as if they were self closing (<%@ %/>
), or as if they were comments. Could this logic be applied to unclosed tags in general?
Resources:
- Directives for ASP(X) https://msdn.microsoft.com/en-us/library/xz702w3e(v=vs.100).aspx
- Directives for JSP http://beginnersbook.com/2013/05/jsp-tutorial-directives/
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Escaping input with unclosed, invalid tags returns it ... - GitHub
When sanitizing a string with disallowedTagsMode: "escape" , extra, unneeded (escaped) closing tags are appended to the end of the string. Details. Version...
Read more >python - How do I fix wrongly nested / unclosed HTML tags?
Unfortunately, I know of no way to keep the <p> tag in the example. ... parseString(html, show_body_only=True, indent=True). becomes
Read more >How to set coding preferences in Dreamweaver - Adobe Support
Learn how to set coding preferences, code themes, format, and code rewriting preferences in Dreamweaver.
Read more >WebD2: Common HTML Tags - University of Washington
"Tags" provide web browsers with instructions about the web page, such as where to display images, and how the document is structured.
Read more >PyTidyLib: A Python Interface to HTML Tidy - PythonHosted.org
Clean up unclosed tags and unescaped characters such as ampersands ... including proper (i.e. no) indenting for pre elements, which some (X)HTML indenting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Could this problem be solved earlier?
Wew! Fixed 😃 Thanks