fix: stopNodes should preserve text content as string (#795)#797
Open
abhu85 wants to merge 1 commit intoNaturalIntelligence:masterfrom
Open
fix: stopNodes should preserve text content as string (#795)#797abhu85 wants to merge 1 commit intoNaturalIntelligence:masterfrom
abhu85 wants to merge 1 commit intoNaturalIntelligence:masterfrom
Conversation
…gence#795) When using stopNodes option, numeric and boolean-like text content was being converted to JavaScript numbers/booleans (e.g., "6" became 6). This fix ensures stopNode content remains as raw string text, which is the expected behavior since stopNodes are meant to preserve unparsed content. Changes: - Add doNotParseTagValue parameter to parseTextData function - Pass true for this parameter when processing stopNode content - Add regression test for numeric/boolean/scientific notation strings Fixes NaturalIntelligence#795
Author
|
Hi @AmitagPro 👋 Friendly ping on this PR. It fixes the All CI checks are passing. Would appreciate a review when you have a moment. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<a>6</a>withstopNodes: ["*.a"]now returns{ a: "6" }instead of{ a: 6 }Problem
When using
stopNodesoption, numeric and boolean-like text content was being converted to JavaScript numbers/booleans. According to the documentation,stopNodesshould preserve content as raw text.Reproduction (from #795):
Solution
Added
doNotParseTagValueparameter toparseTextDatafunction and set it totruewhen processing stopNode content. This skips theparseValuecall that converts strings to numbers/booleans, while still allowingtagValueProcessorto work for user customization.Test Plan
Compatibility
tagValueProcessorbehavior preservedFixes #795