On Thu, Jan 09, 2025 at 05:29:12PM -0800, Lindsay Lawrence wrote:
> On Thu, Jan 9, 2025 at 1:26 PM Lindsay Lawrence <
> lawrence.lindsayj...@gmail.com> wrote:
> 
> >
> > 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?

Indeed, this is much more consistent than using external links.


> (de wikiLink (Lst)
>    (let (CurNm (get This 'nm)
>          NmParts (split (car Lst) "#")
>          Nm (or (pack (car NmParts)) CurNm)
>          Loc (pack Nm "#" (cdr NmParts))
>          Str (or (glue " " (cdr Lst)) (pack (car Lst))) )
>       (cond
>          ((fetch '(nm . +Doc) (fold Nm 0))
>             (<href> Str  (pack "?" Loc)) )
>          (*Login (<this> '*ID Loc Str))
>          (T (ht:Prin Str)) ) ) )
> 
> I can now write markup like
> 
> ={DevForum#viprc  My viprc}
> 
> to jump to id in a specific wiki doc
> 
> and also
> 
> ={#viprc My viprc}
> 
> to jump to id within the current wiki doc

Great! If ok, I will change this also in the original.

I would slightly change it to suppress the "#" if no
jump label is given:

   (de wikiLink (Lst)
      (let
         (L (++ Lst)
            S (split L "#")
            Nm (or (pack (car S)) (: nm))
            Loc (if (cdr S) (pack Nm "#" @) Nm)
            Str (or (glue " " Lst) Nm) )
         (cond
            ((fetch '(nm . +Doc) (fold Nm))
               (<href> Str (pack "?" Loc)) )
            (*Login (<this> '*ID Loc Str))
            (T (ht:Prin Str)) ) ) )

What do you think?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to