mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 05:27:37 +00:00
fix(jsdoc): preserve newlines in JSDoc description and tag continuation
This commit is contained in:
1 parent
60fc7ec252
commit
f08e97af1f
2 files changed
+36
-24
No files matched your search
+18
-11
@@ -38,22 +38,29 @@ public class DTSJSDocParser {
|
||||
|
||||
for (String line : lines) {
|
||||
line = cleanLine(line);
|
||||
if (line.isEmpty()) continue;
|
||||
|
||||
if (line.startsWith("@")) {
|
||||
foundFirstTag = true;
|
||||
lastTag = parseTag(line, info);
|
||||
} else if (!foundFirstTag) {
|
||||
if (descriptionBuilder.length() > 0) {
|
||||
descriptionBuilder.append(" ");
|
||||
}
|
||||
descriptionBuilder.append(line);
|
||||
} else if (lastTag != null) {
|
||||
String existing = lastTag.getDescription();
|
||||
if (existing == null || existing.isEmpty()) {
|
||||
lastTag.setDescription(line);
|
||||
if (line.isEmpty()) {
|
||||
// Preserve blank lines as paragraph gaps (only if description has started)
|
||||
if (descriptionBuilder.length() > 0) {
|
||||
descriptionBuilder.append("\n");
|
||||
}
|
||||
} else {
|
||||
lastTag.setDescription(existing + " " + line);
|
||||
if (descriptionBuilder.length() > 0) {
|
||||
descriptionBuilder.append("\n");
|
||||
}
|
||||
descriptionBuilder.append(line);
|
||||
}
|
||||
} else if (lastTag != null) {
|
||||
if (!line.isEmpty()) {
|
||||
String existing = lastTag.getDescription();
|
||||
if (existing == null || existing.isEmpty()) {
|
||||
lastTag.setDescription(line);
|
||||
} else {
|
||||
lastTag.setDescription(existing + "\n" + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-13
@@ -69,22 +69,27 @@ public class JSDocParser {
|
||||
CleanLine cleanLine = cleanLine(rawLine, contentOffset + position);
|
||||
String line = cleanLine.text;
|
||||
|
||||
if (!line.isEmpty()) {
|
||||
if (line.startsWith("@")) {
|
||||
foundFirstTag = true;
|
||||
lastTag = parseTagLine(line, cleanLine.offset, info);
|
||||
} else if (!foundFirstTag) {
|
||||
if (line.startsWith("@")) {
|
||||
foundFirstTag = true;
|
||||
lastTag = parseTagLine(line, cleanLine.offset, info);
|
||||
} else if (!foundFirstTag) {
|
||||
if (line.isEmpty()) {
|
||||
// Preserve blank lines as paragraph gaps (only if description has started)
|
||||
if (descriptionBuilder.length() > 0) {
|
||||
descriptionBuilder.append(" ");
|
||||
descriptionBuilder.append("\n");
|
||||
}
|
||||
} else {
|
||||
if (descriptionBuilder.length() > 0) {
|
||||
descriptionBuilder.append("\n");
|
||||
}
|
||||
descriptionBuilder.append(line);
|
||||
} else if (lastTag != null) {
|
||||
String existing = lastTag.getDescription();
|
||||
if (existing == null || existing.isEmpty()) {
|
||||
lastTag.setDescription(line);
|
||||
} else {
|
||||
lastTag.setDescription(existing + " " + line);
|
||||
}
|
||||
}
|
||||
} else if (lastTag != null && !line.isEmpty()) {
|
||||
String existing = lastTag.getDescription();
|
||||
if (existing == null || existing.isEmpty()) {
|
||||
lastTag.setDescription(line);
|
||||
} else {
|
||||
lastTag.setDescription(existing + "\n" + line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user