9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] LN macro
@ 2024-10-03 12:40 mkf9
  2024-10-03 19:54 ` Jacob Moody
  2024-10-05 15:17 ` Lennart Jablonka
  0 siblings, 2 replies; 5+ messages in thread
From: mkf9 @ 2024-10-03 12:40 UTC (permalink / raw)
  To: 9front

Hello.
I have a patch for ms2html, which adds a new macro to insert hyperlinks
into documents, currently, the best solution we have currently is 
hard-coding html tags,
example in htmlroff:
.html a <a href="/link">
this is a link
.html a

or in ms2html:
._H <a href="/link">
this is a link
._H </a>

both of which are not very good. It'd be nice if we had a
common way to insert hyper links into html and pdf (and possibly ps) 
documents, without hard-coding any thing specific to those formats.

this is what .LN macro tries to solve, at least for ms2html, for now.
i'll send a patch for htmlroff and mhtml later on.

comments are welcome. :)

diff d8973bdc75d5e7c7a35855f78ade347c01f985f1 uncommitted
--- a/sys/src/cmd/ms2html.c
+++ b/sys/src/cmd/ms2html.c
@@ -87,13 +87,14 @@
  F g_br, g_ft, g_sp, g_de, g_lf, g_so, g_rm, g_in;
  F g_nr, g_ig, g_RT, g_BS, g_BE, g_LB, g_ta;

-/* macros to include ML in output */
-F g__H, g__T;
+/* macros to include HTML in output */
+F g__H, g__T, g_LN;

  Goobie gtab[] =
  {
  	{ "_T", g__T, },
  	{ "_H", g__H, },
+	{ "LN", g_LN, },
  	{ "1C",	g_ignore, },
  	{ "2C",	g_ignore, },
  	{ "AB", g_AB, },
@@ -2264,6 +2265,25 @@
  	printargs(argc, argv);
  	Bprint(&bout, "</title></head><body>\n");
  	titleseen = 1;
+}
+
+/* HTML <a> tag */
+void
+g_LN(int argc, char **argv)
+{
+	static int onlink = 0;
+	if(onlink)
+	{
+		Bprint(&bout, "</a>\n");
+		onlink = 0;
+	}
+	else
+	{
+		Bprint(&bout, "<a href=\"");
+		printargs(argc, argv);
+		Bprint(&bout, "\">\n");
+		onlink = 1;
+	}
  }

  void

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

end of thread, other threads:[~2024-10-05 22:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-03 12:40 [9front] LN macro mkf9
2024-10-03 19:54 ` Jacob Moody
2024-10-04 10:00   ` rgl
2024-10-05 15:17 ` Lennart Jablonka
2024-10-05 22:05   ` Lennart Jablonka

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).