mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-25 19:44:50 +00:00
refactor(ttml): extract recursion into traverseChildNodesForNestedTags()
- Extracted child-node traversal logic from `extractText()` into a helper method `traverseChildNodesForNestedTags()`. - No functional change.
This commit is contained in:
@@ -205,6 +205,15 @@ public class SrtFromTtmlWriter {
|
|||||||
return srtSafeText;
|
return srtSafeText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recursively process all child nodes to ensure text inside
|
||||||
|
// nested tags (e.g., <span>) is also extracted.
|
||||||
|
private void traverseChildNodesForNestedTags(final Node parent,
|
||||||
|
final StringBuilder text) {
|
||||||
|
for (final Node child : parent.childNodes()) {
|
||||||
|
extractText(child, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CHECKSTYLE:OFF checkstyle:JavadocStyle
|
// CHECKSTYLE:OFF checkstyle:JavadocStyle
|
||||||
// checkstyle does not understand that span tags are inside a code block
|
// checkstyle does not understand that span tags are inside a code block
|
||||||
/**
|
/**
|
||||||
@@ -244,10 +253,8 @@ public class SrtFromTtmlWriter {
|
|||||||
text.append(NEW_LINE);
|
text.append(NEW_LINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Recursively process child nodes
|
|
||||||
for (final Node child : node.childNodes()) {
|
traverseChildNodesForNestedTags(node, text);
|
||||||
extractText(child, text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user