feat: suppress output of partial XML tool tag fragments in stream processing
This commit is contained in:
1 parent
4b42fe9086
commit
3ab9d44f60
4 files changed
+51
-4
No files matched your search
@@ -15,6 +15,7 @@ const {
|
||||
consumeXMLToolCapture: consumeXMLToolCaptureImpl,
|
||||
hasOpenXMLToolTag,
|
||||
findPartialXMLToolTagStart,
|
||||
looksLikeXMLToolTagFragment,
|
||||
} = require('./sieve-xml');
|
||||
function processToolSieveChunk(state, chunk, toolNames) {
|
||||
if (!state) {
|
||||
@@ -123,8 +124,10 @@ function flushToolSieve(state, toolNames) {
|
||||
resetIncrementalToolState(state);
|
||||
}
|
||||
if (state.pending) {
|
||||
noteText(state, state.pending);
|
||||
events.push({ type: 'text', text: state.pending });
|
||||
if (!hasOpenXMLToolTag(state.pending) && !looksLikeXMLToolTagFragment(state.pending)) {
|
||||
noteText(state, state.pending);
|
||||
events.push({ type: 'text', text: state.pending });
|
||||
}
|
||||
state.pending = '';
|
||||
}
|
||||
return events;
|
||||
|
||||
Reference in new issue
Block a user