question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't indent unclosed HTML tags containing server directives "<@"

See original GitHub issue

Steps to Reproduce

  1. Create a test.aspx or test.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>
  1. 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:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
fengerzhcommented, Jul 13, 2018

Could this problem be solved earlier?

1reaction
alirobecommented, Oct 8, 2018

Wew! Fixed 😃 Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found