From 3b11b2d295b10e2c652eab0dd8a90eb11e0e197a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 8 Aug 2023 13:15:18 +0900 Subject: [PATCH] Fix the processing again The string/rope semantics continue to bite us. The original fix in bd1cd4460609a8284bb92fd4a4c407f4cc7b68fb was not correct, for unclear reasons. This version uses ExtractAll() to ensure we get a fresh CutRope that we can AppendDestructively() to Scratch, which is more in line with what other parts of the file do. --- src/wattsi.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wattsi.pas b/src/wattsi.pas index 0e2fd17..d7643f4 100644 --- a/src/wattsi.pas +++ b/src/wattsi.pas @@ -1585,19 +1585,25 @@ TCrossReferences = record ListNode^.Next := References[ReferenceName]; References[ReferenceName] := ListNode; MissingReferences[ReferenceName] := ListNode; + NewLink := ConstructHTMLElement(eA); Scratch := Default(Rope); + ExtractedData := Element.TextContent.ExtractAll(); Scratch.Append('#refs'); - Scratch.Append(@ReferenceName); + Scratch.AppendDestructively(ExtractedData); NewLink.SetAttributeDestructively('href', Scratch); + Scratch := Default(Rope); + ExtractedData := Element.TextContent.ExtractAll(); Scratch.Append('['); - Scratch.Append(@ReferenceName); + Scratch.AppendDestructively(ExtractedData); Scratch.Append(']'); NewLink.AppendChild(TText.CreateDestructively(Scratch)); + (Node.ParentNode as TElement).ReplaceChild(NewLink, Node); Node.Free(); Node := NewLink; + Result := ProcessNode(Node); end else