[xml] HtmlUtil#getStartTag: support tags with digits, like <h2>

GitOrigin-RevId: c3997423c38ade8a759aa086bc7d788c18e834b8
This commit is contained in:
Tagir Valeev
2023-10-16 18:12:26 +02:00
committed by intellij-monorepo-bot
parent 7f7cfc7d4c
commit 116aeed551
2 changed files with 18 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
// "Insert <p>" "false"
class Test {
/**
* Answer to the ultimate question of life, the universe, and everything
*<caret>
* <h2>Subheader</h2>
* That's it. That's all there is.
*
* @return The number 42
*/
int answer() {
return 42;
}
}

View File

@@ -540,10 +540,11 @@ public final class HtmlUtil {
if (startsWithTag(line)) {
int tagStart = line.indexOf("<");
if (tagStart >= 0) {
tagStart ++;
tagStart++;
for (int i = tagStart; i < line.length(); i ++) {
if (!Character.isAlphabetic(line.charAt(i))) {
return line.substring(tagStart,i);
char ch = line.charAt(i);
if (!Character.isAlphabetic(ch) && !Character.isDigit(ch)) {
return line.substring(tagStart, i);
}
}
}