~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
2 2

[PATCH hare] cmd/haredoc: Correctly display HTML module references

Details
Message ID
<20240412193330.1573-1-yyp@disroot.org>
DKIM signature
pass
Download raw message
Patch: +13 -3
Signed-off-by: Alexey Yerin <yyp@disroot.org>
---
This supersedes Vlad's patch.

P.S. That code is a bit of a complete mess

 cmd/haredoc/doc/html.ha | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/cmd/haredoc/doc/html.ha b/cmd/haredoc/doc/html.ha
index d0aaed81..75962587 100644
--- a/cmd/haredoc/doc/html.ha
+++ b/cmd/haredoc/doc/html.ha
@@ -235,7 +235,7 @@ fn details(ctx: *context, decl: *ast::decl) (void | error) = {
	return;
};

fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
fn html_decl_ref(ctx: *context, ref: ast::ident) (void | error) = {
	const ik =
		match (resolve(ctx, ref)?) {
		case let ik: (ast::ident, symkind) =>
@@ -279,6 +279,16 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | error) = {
	free(ident);
};

fn html_mod_ref(ctx: *context, ref: ast::ident) (void | error) = {
	const ident = unparse::identstr(ref);
	defer free(ident);
	let ipath = strings::join("/", ref...);
	defer free(ipath);
	fmt::fprintf(ctx.out, "<a href='/{}' class='ref'>{}::</a>",
		ipath, ident)?;
};


fn html_paragraph(ctx: *context, p: doc::paragraph) (void | error) = {
	for (let elem .. p) {
		match (elem) {
@@ -299,9 +309,9 @@ fn html_paragraph(ctx: *context, p: doc::paragraph) (void | error) = {
				html_escape(ctx.out, s)?;
			};
		case let d: doc::decl_ref =>
			htmlref(ctx, d)?;
			html_decl_ref(ctx, d)?;
		case let m: doc::mod_ref =>
			htmlref(ctx, m)?;
			html_mod_ref(ctx, m)?;
		};
	};
};
-- 
2.44.0

[hare/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D0IE9L8ASELE.34EQF19VULZUW@fra01>
In-Reply-To
<20240412193330.1573-1-yyp@disroot.org> (view parent)
DKIM signature
missing
Download raw message
hare/patches: SUCCESS in 1m0s

[cmd/haredoc: Correctly display HTML module references][0] from [Alexey Yerin][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/50953
[1]: yyp@disroot.org

✓ #1194220 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1194220
✓ #1194221 SUCCESS hare/patches/openbsd.yml https://builds.sr.ht/~sircmpwn/job/1194221
✓ #1194219 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/1194219
Details
Message ID
<D0JV6OZ9L16V.1R1U4MGR3IA7D@cmpwn.com>
In-Reply-To
<20240412193330.1573-1-yyp@disroot.org> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/hare
   10f02df0..28a63020  master -> master
Reply to thread Export thread (mbox)