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:
parent
b984a31117
commit
c76fe2adc6
1 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue