0 votes
by (120 points)

I would like to have several links (that are no passage links) of which one could be choosen (single-use). The links should contain text and code but no passage link. (Like

<<choice>>

without passage link) And I wouldn't like to use <span id=""> because the passage these links are in will be included and can include itself.

I tried two things:

<<linkappend "Hallo <<linkappend \"Hallo2\">>Hallo2 is appended<</linkappend>><<linkappend \"Hallo3\">>Hallo3 is appended<</linkappend>>">>Hallo is appended<</linkappend>>


<<set $Replacer to "">>

<<linkreplace "Hallo <<link \"Hallo2\">><<set $Replacer to \"Hallo2 was elected\">><</link>><<link \"Hallo3\">><<set $Replacer to \"Hallo3 was elected\">><</link>>">>$Replacer<</linkreplace>>

 

Both work. For the first: It will leave a "dead" odr "empty" link. One of both doubled links will still be there but nothing happens if clicked. That's looking kind of ugly. Is there a possibility to disable all links completly?

 

Is that the way to do the thing I want or is there a better way?

 

 

 

1 Answer

0 votes
by (23.6k points)

Usually you'd just combine a regular <<link>> with a <<replace>>:

@@#test;<<nobr>>
<<link "Hallo1">>
	<<replace "#test">>
		<<set $choice to "Hallo1">>
		$choice has been selected.
	<</replace>>
<</link>>
<<link "Hallo2">>
	<<replace "#test">>
		<<set $choice to "Hallo2">>
		$choice has been selected.
	<</replace>>
<</link>>
<<link "Hallo3">>
	<<replace "#test">>
		<<set $choice to "Hallo3">>
		$choice has been selected.
	<</replace>>
<</link>>
<</nobr>>@@

 

by (120 points)
But @@#test - sets an ID, or? I don't want an ID, because in further development I'd like this passage to include itself.

I tought it would be a problem to multi-include a span with an ID - because an ID should be unique.
by (23.6k points)

Without knowing your exact setup it's hard to say whether an ID would pose a problem. If you think it does you can always just use a class instead:

@@.test;<<nobr>>
<<link "Hallo1">>
	<<replace ".test">>
		<<set $choice to "Hallo1">>
		$choice has been selected.
	<</replace>>
<</link>>
<<link "Hallo2">>
	<<replace ".test">>
		<<set $choice to "Hallo2">>
		$choice has been selected.
	<</replace>>
<</link>>
<<link "Hallo3">>
	<<replace ".test">>
		<<set $choice to "Hallo3">>
		$choice has been selected.
	<</replace>>
<</link>>
<</nobr>>@@

 

...