On Thu, Jan 9, 2025 at 5:18 AM Alexander Burger <[email protected]>
wrote:
>
> Cool! If this works, could we also introduce it into the original
> version?
>
> Of course.
The ;{ .. } change is straightforward and is useful for more than simple
linking.
But: Doesn't this conflict with with other URLs having an argument?
> Shouldn't it be "#" instead of "?"?
>
I struggled with this a bit. At the moment, I don't have a use case
where it matters.
For link jumps not in session, and in session but not editing (when there
are additional url params), it works correctly and
using the ^{..} syntax (with the suggested code change below), one can now
link jump both within the same page and across wiki pages.
For example:
^{?DevForum#viprc viprc}
When in a session, generates
<a href="http://localhost:52641/51111718579557851~?DevForum#viprc">viprc</a>
And without a session
<a href="http://localhost:1780/?DevForum#viprc">viprc</a>
> Can you try the changes?
>
> ...
(ifn (pre? "?" (car S))
(prin "???")
(<href>
(or (glue " " (cdr S)) (pack (car S)))
(if *Login
(setq Url (baseHRef NIL *SesId (car S)) )
(setq Url (baseHRef *Port1 (car S)) )
) )
)
..
Much better! Tested and works as described.
First principle of picolisp: Be succinct.
Second principle: There is often an existing built-in function to help with
the first principle.
:)
/Lindsay
PS: After all of that, I realize another, and perhaps contextually better,
solution may be to modify the 'wikiLink function, ={ .. } syntax, to handle
'#' when parsing the document name?