~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 4

[PATCH hare] haredoc: fix symbol links

Details
Message ID
<20240409200217.30580-1-vlad@vladh.net>
DKIM signature
pass
Download raw message
Patch: +1 -1
For example, a reference to [[time::date::]] previously pointed to
/time#date, but should point to /time/date.

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
---
 cmd/haredoc/doc/html.ha | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/haredoc/doc/html.ha b/cmd/haredoc/doc/html.ha
index d0aaed81..7d98cd37 100644
--- a/cmd/haredoc/doc/html.ha
+++ b/cmd/haredoc/doc/html.ha
@@ -265,7 +265,7 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
	case symkind::SYMBOL =>
		let ipath = strings::join("/", id[..len(id) - 1]...);
		defer free(ipath);
		fmt::fprintf(ctx.out, "<a href='/{}#{}' class='ref'>{}</a>",
		fmt::fprintf(ctx.out, "<a href='/{}/{}' class='ref'>{}</a>",
			ipath, id[len(id) - 1], ident)?;
	case symkind::ENUM_LOCAL =>
		fmt::fprintf(ctx.out, "<a href='#{}' class='ref'>{}</a>",
-- 
2.44.0

[hare/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D0FV01AUCBYQ.3JS6ZJ4EUJSSX@fra01>
In-Reply-To
<20240409200217.30580-1-vlad@vladh.net> (view parent)
DKIM signature
missing
Download raw message
hare/patches: SUCCESS in 59s

[haredoc: fix symbol links][0] from [Vlad-Stefan Harbuz][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/50863
[1]: vlad@vladh.net

✓ #1191333 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/1191333
✓ #1191335 SUCCESS hare/patches/openbsd.yml https://builds.sr.ht/~sircmpwn/job/1191335
✓ #1191334 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1191334
Details
Message ID
<D0FW3OKPDRSM.2QLETJKATA03M@disroot.org>
In-Reply-To
<20240409200217.30580-1-vlad@vladh.net> (view parent)
DKIM signature
pass
Download raw message
On Tue Apr 9, 2024 at 21:02 +0100, Vlad-Stefan Harbuz wrote:
> For example, a reference to [[time::date::]] previously pointed to
> /time#date, but should point to /time/date.

I can't reproduce it. Both [[time::date]] and [[time::date::]] produce
references to /time/date.

> diff --git a/cmd/haredoc/doc/html.ha b/cmd/haredoc/doc/html.ha
> index d0aaed81..7d98cd37 100644
> --- a/cmd/haredoc/doc/html.ha
> +++ b/cmd/haredoc/doc/html.ha
> @@ -265,7 +265,7 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
>  	case symkind::SYMBOL =>
>  		let ipath = strings::join("/", id[..len(id) - 1]...);
>  		defer free(ipath);
> -		fmt::fprintf(ctx.out, "<a href='/{}#{}' class='ref'>{}</a>",
> +		fmt::fprintf(ctx.out, "<a href='/{}/{}' class='ref'>{}</a>",
>  			ipath, id[len(id) - 1], ident)?;

time::date should be handled in ::MODULE branch, not ::SYMBOL one. If it's not
correctly classified for some reason, that would be the issue, not link output.

In addition, this change breaks symbol references like [[strings::freeall]] by
resolving them to /strings/freeall instead of /strings#freeall (example from
shlex).
Details
Message ID
<D0FW8ZZOGR85.WO5LTWYS1I1@sebsite.pw>
In-Reply-To
<D0FW3OKPDRSM.2QLETJKATA03M@disroot.org> (view parent)
DKIM signature
pass
Download raw message
On Tue Apr 9, 2024 at 4:55 PM EDT, Alexey Yerin wrote:
> > diff --git a/cmd/haredoc/doc/html.ha b/cmd/haredoc/doc/html.ha
> > index d0aaed81..7d98cd37 100644
> > --- a/cmd/haredoc/doc/html.ha
> > +++ b/cmd/haredoc/doc/html.ha
> > @@ -265,7 +265,7 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
> >  	case symkind::SYMBOL =>
> >  		let ipath = strings::join("/", id[..len(id) - 1]...);
> >  		defer free(ipath);
> > -		fmt::fprintf(ctx.out, "<a href='/{}#{}' class='ref'>{}</a>",
> > +		fmt::fprintf(ctx.out, "<a href='/{}/{}' class='ref'>{}</a>",
> >  			ipath, id[len(id) - 1], ident)?;
>
> time::date should be handled in ::MODULE branch, not ::SYMBOL one. If it's not
> correctly classified for some reason, that would be the issue, not link output.

No, time::date can be treated as a symbol. References which don't end
with :: are presumed to refer to declarations; module references must
end with ::. See haredoc(5)

I didn't really bother making any distinction within the html stuff in
haredoc, since I figured that we'll most likely eventually replace it
anyway. Hence why the code is such a mess rn
Details
Message ID
<D0FWKNJDY113.3Q9E7IJK90MSH@disroot.org>
In-Reply-To
<D0FW8ZZOGR85.WO5LTWYS1I1@sebsite.pw> (view parent)
DKIM signature
pass
Download raw message
On Tue Apr 9, 2024 at 17:02 -0400, Sebastian wrote:
> On Tue Apr 9, 2024 at 4:55 PM EDT, Alexey Yerin wrote:
> > > diff --git a/cmd/haredoc/doc/html.ha b/cmd/haredoc/doc/html.ha
> > > index d0aaed81..7d98cd37 100644
> > > --- a/cmd/haredoc/doc/html.ha
> > > +++ b/cmd/haredoc/doc/html.ha
> > > @@ -265,7 +265,7 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
> > >  	case symkind::SYMBOL =>
> > >  		let ipath = strings::join("/", id[..len(id) - 1]...);
> > >  		defer free(ipath);
> > > -		fmt::fprintf(ctx.out, "<a href='/{}#{}' class='ref'>{}</a>",
> > > +		fmt::fprintf(ctx.out, "<a href='/{}/{}' class='ref'>{}</a>",
> > >  			ipath, id[len(id) - 1], ident)?;
> >
> > time::date should be handled in ::MODULE branch, not ::SYMBOL one. If it's not
> > correctly classified for some reason, that would be the issue, not link output.
>
> No, time::date can be treated as a symbol. References which don't end
> with :: are presumed to refer to declarations; module references must
> end with ::. See haredoc(5)

That's true - my reasoning only reliably works for time::date::, which was
mentioned in the original patch. It just so happens that time::date without
trailing :: is also correctly resolved by haredoc, which confused me a bit.
Details
Message ID
<D0FXM5P4PK6G.2P7XJVUUJCABS@vladh.net>
In-Reply-To
<D0FW3OKPDRSM.2QLETJKATA03M@disroot.org> (view parent)
DKIM signature
pass
Download raw message
On Tue Apr 9, 2024 at 9:55 PM BST, Alexey Yerin wrote:
> On Tue Apr 9, 2024 at 21:02 +0100, Vlad-Stefan Harbuz wrote:
> > For example, a reference to [[time::date::]] previously pointed to
> > /time#date, but should point to /time/date.
>
> I can't reproduce it. Both [[time::date]] and [[time::date::]] produce
> references to /time/date.

See the first paragraph in https://docs.harelang.org/time
Details
Message ID
<D1FV8OGPXOA2.1IW22HH016ML6@sebsite.pw>
In-Reply-To
<20240409200217.30580-1-vlad@vladh.net> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To gitsrht:~sircmpwn/hare
   b49124cb..3f04b380  master -> master
Reply to thread Export thread (mbox)