Repository navigation
Merged
Conversation
…ested in script blocks Forms containing a <script> block with a <lookup> (or other substitution) tag, combined with <macros>, <page>, <translations>, or <subform>, get whitespace/newlines injected around the substituted value because HtmlFormEntryGenerator's internal DOM round-trips indent the serialized xml, and JAXP's indenter inserts whitespace text nodes around element boundaries in mixed text/element content. An injected literal newline inside a quoted JS string is invalid syntax, breaking the form's script. Add a documentToString(Document, boolean indent) overload and use indent=false for the purely-internal round-trips in applyMacros, processPages, applyTranslations, and processSubforms, since that intermediate xml is never shown to a human. InitializerExportUtil and OrderTagAttributeDescriptor keep indent=true, preserving human-readable export output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks
mogoodrich
approved these changes
Sep 17, 2026
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
<lookup>(or other substitution) tags nested inside inline<script>blocks get whitespace/newlines injected around the substituted value when the form also contains<macros>,<page>,<translations>, or<subform>.HtmlFormEntryGenerator(viaHtmlFormEntryUtil.documentToString()) before the<lookup>tag is actually substituted byapplyTags().documentToString()setsOutputKeys.INDENT="yes", and JAXP's indenting transformer inserts whitespace text nodes around element boundaries in mixed text/element content — corrupting a<lookup>sitting inside<script>text. A literal newline injected into a quoted JS string is invalid syntax, so the browser throwsUncaught SyntaxError: Invalid or unexpected tokenand the script fails to run.documentToString(Document, boolean indent)overload, and passindent=falseat the 4 purely-internal round-trip call sites (applyMacros,processPages,applyTranslations,processSubforms) since that intermediate xml is only consumed by further string/regex processing, never shown to a human.InitializerExportUtilandOrderTagAttributeDescriptorkeepindent=true, preserving human-readable exported form XML.Test plan
mvn -pl api compilesucceedsmvn -pl api testpasses (no regressions)<macros>and a<script>block containing<lookup expression="patient.uuid"/>) that the rendered script is no longer corrupted🤖 Generated with Claude Code