Skip to content

Commit

Permalink
Generate references using SetAttribute() & AppendChild() with strings…
Browse files Browse the repository at this point in the history
… directly
  • Loading branch information
sideshowbarker committed Aug 10, 2023
1 parent a72d468 commit c6fabf1
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/wattsi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1587,18 +1587,8 @@ TCrossReferences = record
MissingReferences[ReferenceName] := ListNode;

NewLink := ConstructHTMLElement(eA);
Scratch := Default(Rope);
ExtractedData := Element.TextContent.ExtractAll();
Scratch.Append('#refs');
Scratch.AppendDestructively(ExtractedData);
NewLink.SetAttributeDestructively('href', Scratch);

Scratch := Default(Rope);
ExtractedData := Element.TextContent.ExtractAll();
Scratch.Append('[');
Scratch.AppendDestructively(ExtractedData);
Scratch.Append(']');
NewLink.AppendChild(TText.CreateDestructively(Scratch));
NewLink.SetAttribute('href', '#refs' + ReferenceName);
NewLink.AppendChild(TText.Create('[' + ReferenceName + ']'));

(Node.ParentNode as TElement).ReplaceChild(NewLink, Node);
Node.Free();
Expand Down

0 comments on commit c6fabf1

Please sign in to comment.