ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] How to typeset interactive, hyphenated URLs in a bibliography?
@ 2025-04-06 16:25 Riviera Taylor
  2025-04-06 16:40 ` [NTG-context] " Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Riviera Taylor @ 2025-04-06 16:25 UTC (permalink / raw)
  To: ntg-context

Hello,

I'd like the URL to link to the webpage rather than what it currently
links to: `hyphenatedurl#https://example.com/this-is-a-really-long-slug/for-example-purposes-only/`

Kind regards,

Riviera


Running LuaMetaTeX, Version 2.11.07 (Functionality : level 20250226)

MWE:

\startbuffer[default]
  @website{smith2025,
    title = {Bob Smith's Website},
    author = {Smith, Bob},
    year = {2025},
    urlkey = {bobsmith},
    howpublished =
    {https://example.com/this-is-a-really-long-slug/for-example-purposes-only/}
  }
\stopbuffer
\savebuffer[list=default,file=default.bib,prefix=no]

\startbuffer[bib_env]
  \usebtxdefinitions[default]
  \definebtxrendering[default]
                     [default=,
                       specification=default,
                       sorttype=authoryear,
                       numbering=no,
                       criterium=all,
                       method=global,
                       dataset=default,
                       group=default
                     ]

  \setupbtxlist[default]
               [alternative=paragraph,
                 margin=3\emwidth,
                 before=\blank,
                 after=\blank,
                 align={normal,tolerant},
                 interaction=start,
                 state=start,
                 symbol=none,
                 hang=yes,
                 distance={-6\emwidth}]

  \definebtx[default]
            [default=,
              specification=default,
              authorconversion=normal]

  \definebtxdataset[default]

  \definebtx[default:cite]
            [default=,
             specification=default,
             separator:2={ and },
             otherstext={\btxspace\em{et al.}},
             etallimit=3,
            ]
  \definebtx[default:cite:author]
            [default:cite]

  \definebtx[default:list]
            [default]
  \definebtx[default:list:website]
            [default:list]

  \setupbtx[default:cite]
           [alternative=authoryear]
  \setupbtx[default:list]
           [alternative=authoryear,authorconversion=invertedshort]

  \usebtxdataset[default][default.bib]

  \startsetups btx:default:list:website
    \btxdoif{author}   {\btxflush{author}\btxspace}
    \btxdoif{year}     {\btxleftparenthesis\btxflush{year}\btxrightparenthesis}
    \btxdoif{title}    {{\em{\btxflush{title}}}\btxperiod}
    \btxdoif{howpublished} {
      Available at:
\goto{\btxflush{howpublished}}[url(\hyphenatedurl{\btxflush{howpublished}})]
      \btxleftparenthesis
        {Accessed}\btxspace{April 6 2025}
        \btxrightparenthesis
    }
    \btxperiod
    \removeunwantedspaces
  \stopsetups

\stopbuffer
\savebuffer[list=bib_env,file=bib_env.tex,prefix=no]

\startbuffer[text]
  \quote{Welcome to my website} \cite[smith2025].
\stopbuffer
\savebuffer[list=text,file=text.tex,prefix=no]


\starttext

\setupinteraction[state=start,color=black]

\environment bib_env

\enabledirectives[hyphenators.urls.packslashes]
\sethyphenatedurlbefore{/}


\startsectionlevel[title={Text}]
  \input text
\stopsectionlevel
\startsectionlevel[title={Bibliography}]
  \placebtxrendering[default]
\stopsectionlevel

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: How to typeset interactive, hyphenated URLs in a bibliography?
  2025-04-06 16:25 [NTG-context] How to typeset interactive, hyphenated URLs in a bibliography? Riviera Taylor
@ 2025-04-06 16:40 ` Pablo Rodriguez via ntg-context
  2025-04-06 16:49   ` Pablo Rodriguez via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2025-04-06 16:40 UTC (permalink / raw)
  To: ntg-context; +Cc: Pablo Rodriguez

On 4/6/25 18:25, Riviera Taylor wrote:
> Hello,
>
> I'd like the URL to link to the webpage rather than what it currently
> links to: `hyphenatedurl#https://example.com/this-is-a-really-long-slug/for-example-purposes-only/`

Hi Riviera,

this seems to work for me:

    \btxdoif{howpublished} {
      Available at:\btxspace
        \goto{\btxflush{howpublished}}[url(\btxflush{howpublished})]
      \btxleftparenthesis
        {Accessed}\btxspace{April 6 2025}
        \btxrightparenthesis
    }

Just add a space before and add \hyphenatedurl in the first pair of
braces (not in the parentheses for url).

I hope it helps,

Pablos
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: How to typeset interactive, hyphenated URLs in a bibliography?
  2025-04-06 16:40 ` [NTG-context] " Pablo Rodriguez via ntg-context
@ 2025-04-06 16:49   ` Pablo Rodriguez via ntg-context
  2025-04-06 17:02     ` Riviera Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2025-04-06 16:49 UTC (permalink / raw)
  To: ntg-context; +Cc: Pablo Rodriguez

On 4/6/25 18:40, Pablo Rodriguez via ntg-context wrote:
> [...]
>         \goto{\btxflush{howpublished}}[url(\btxflush{howpublished})]

Sorry, Riviera, this line just should read:

 \goto{\hyphenatedurl{\btxflush{howpublished}}}
     [url(\btxflush{howpublished})]

I hope it is clear now,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: How to typeset interactive, hyphenated URLs in a bibliography?
  2025-04-06 16:49   ` Pablo Rodriguez via ntg-context
@ 2025-04-06 17:02     ` Riviera Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Riviera Taylor @ 2025-04-06 17:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Pablo,

That works for me, thanks for clarifying!

Riviera

On Sun, 6 Apr 2025 at 18:50, Pablo Rodriguez via ntg-context
<ntg-context@ntg.nl> wrote:
>
> On 4/6/25 18:40, Pablo Rodriguez via ntg-context wrote:
> > [...]
> >         \goto{\btxflush{howpublished}}[url(\btxflush{howpublished})]
>
> Sorry, Riviera, this line just should read:
>
>  \goto{\hyphenatedurl{\btxflush{howpublished}}}
>      [url(\btxflush{howpublished})]
>
> I hope it is clear now,
>
> Pablo
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-06 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-06 16:25 [NTG-context] How to typeset interactive, hyphenated URLs in a bibliography? Riviera Taylor
2025-04-06 16:40 ` [NTG-context] " Pablo Rodriguez via ntg-context
2025-04-06 16:49   ` Pablo Rodriguez via ntg-context
2025-04-06 17:02     ` Riviera Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).