shithub: riscv

Download patch

ref: d1cebf608b05e45b148108ac6c16ae94f6862097
parent: 5655f2e28e077e38c64425a61b2394cdfbbe8af8
author: mia soweli <inbox@tachibana-labs.org>
date: Sat May 27 16:45:05 EDT 2023

mothra: support article and figure tags

rendering of these was really broken, add line breaks
and spacing to make pages with them readable.

--- a/sys/src/cmd/mothra/html.h
+++ b/sys/src/cmd/mothra/html.h
@@ -136,6 +136,7 @@
 	Tag_acronym,
 	Tag_address,
 	Tag_applet,
+	Tag_article,
 	Tag_audio,
 	Tag_b,
 	Tag_base,
@@ -155,6 +156,8 @@
 	Tag_dt,
 	Tag_em,
 	Tag_embed,
+	Tag_figure,
+	Tag_figcaption,
 	Tag_font,
 	Tag_form,
 	Tag_frame,	/* rm 5.8.97 */
--- a/sys/src/cmd/mothra/html.syntax.c
+++ b/sys/src/cmd/mothra/html.syntax.c
@@ -11,6 +11,7 @@
 [Tag_acronym]	"acronym",	END,
 [Tag_address]	"address",	END,
 [Tag_applet]	"applet",	NOEND,
+[Tag_article]	"article",	END,
 [Tag_audio]	"audio",	OPTEND,
 [Tag_b]		"b",		END,
 [Tag_base]	"base",		NOEND,
@@ -32,6 +33,8 @@
 [Tag_em]	"em",		END,
 [Tag_embed]	"embed",	NOEND,
 [Tag_end]	0,		ERR,
+[Tag_figure]	"figure",	END,
+[Tag_figcaption]	"figcaption",	NOEND,
 [Tag_font]	"font",		END,
 [Tag_form]	"form",		END,
 [Tag_frame]	"frame",	NOEND,
--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -1013,6 +1013,9 @@
 			g.state->font=BOLD;
 			g.spacc=0;
 			break;
+		case Tag_figcaption:
+			g.linebrk=1;
+			break;
 		case Tag_font:
 			/* more to come */
 			break;
@@ -1212,6 +1215,7 @@
 		case Tag_table:
 			g.linebrk=1;
 			break;
+		case Tag_article:
 		case Tag_pre:
 			pl_linespace(&g);
 			break;