Skip to content

Commit 26880f0

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.get/set_Link/Href ( Fixes #241 )
1 parent 2783042 commit 26880f0

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

Turtle.types.ps1xml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
<Name>HLineBy</Name>
7676
<ReferencedMemberName>HorizontalLine</ReferencedMemberName>
7777
</AliasProperty>
78+
<AliasProperty>
79+
<Name>Href</Name>
80+
<ReferencedMemberName>Link</ReferencedMemberName>
81+
</AliasProperty>
7882
<AliasProperty>
7983
<Name>l</Name>
8084
<ReferencedMemberName>Step</ReferencedMemberName>
@@ -3925,6 +3929,43 @@ if ($chromeOutput -match '&lt;img\ssrc="data:image/\w+;base64,(?&lt;b64&gt;[^"]+
39253929

39263930
</GetScriptBlock>
39273931
</ScriptProperty>
3932+
<ScriptProperty>
3933+
<Name>Link</Name>
3934+
<GetScriptBlock>
3935+
&lt;#
3936+
.SYNOPSIS
3937+
Gets a Turtle's link
3938+
.DESCRIPTION
3939+
Gets a link reference (href) associated with the turtle.
3940+
3941+
If one is present, this will nest the turtle inside of an &lt;a&gt; element
3942+
.EXAMPLE
3943+
turtle link https://psturtle.com/ link
3944+
3945+
#&gt;
3946+
$this.'.link'
3947+
3948+
</GetScriptBlock>
3949+
<SetScriptBlock>
3950+
&lt;#
3951+
.SYNOPSIS
3952+
Sets a Turtle's link
3953+
.DESCRIPTION
3954+
Sets a link reference (`href`) associated with the turtle.
3955+
3956+
If one is present, this will nest the turtle inside of an anchor `&lt;a&gt;` element
3957+
.EXAMPLE
3958+
turtle link https://psturtle.com/
3959+
#&gt;
3960+
param(
3961+
[string]
3962+
$Link
3963+
)
3964+
3965+
$this | Add-Member NoteProperty '.Link' $link -Force
3966+
3967+
</SetScriptBlock>
3968+
</ScriptProperty>
39283969
<ScriptProperty>
39293970
<Name>Mask</Name>
39303971
<GetScriptBlock>
@@ -4613,14 +4654,19 @@ foreach ($key in $this.SVGAttribute.Keys) {
46134654

46144655
"&lt;svg $(@(foreach ($attributeName in $svgAttributes.Keys) {
46154656
" $attributeName='$($svgAttributes[$attributeName])'"
4616-
}) -join '')&gt;"
4657+
}) -join '')&gt;"
46174658
# Declare any SVG animations
46184659
if ($this.SVGAnimation) {$this.SVGAnimation}
4619-
4660+
if ($this.Link) {
4661+
"&lt;a href='$($this.Link)'&gt;"
4662+
}
46204663
# Output our own path
46214664
$this.PathElement.OuterXml
46224665
# Followed by any text elements
46234666
$this.TextElement.OuterXml
4667+
if ($this.Link) {
4668+
"&lt;/a&gt;"
4669+
}
46244670

46254671
# If the turtle has children
46264672
$children = @(foreach ($turtleName in $this.Turtles.Keys) {

0 commit comments

Comments
 (0)