Subject: Re: bug#73641: 30.0.90; Math in EWW/shr

From: Augusto Stoffel <[email-masked]>
Date: Sat, 12 Oct 2024 16:24:12 +0200

On Thu, 10 Oct 2024 at 21:24, Jeremy Bryant wrote:

> As this is related to shr and displaying svg images, this reminds me of
> a patch of Sacha earlier this year.
>
> Perhaps Sacha you have a suggestion on this?

Independent of that, I've attached a patch containing the "baseline"
action that can be later refined.

>From 8b772c709eb8527fd8e7ebfab65980d64dfa2f02 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <[email-masked]>
Date: Sat, 12 Oct 2024 16:20:47 +0200
Subject: [PATCH] shr.el: Define rendering rule for math tag

* lisp/net/shr.el (shr-tag-math): New function, see bug#73641.
---
 lisp/net/shr.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index f1062acf7e4..fff478a69c9 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -2264,6 +2264,15 @@ shr-tag-bdi
   (shr-generic dom)
   (insert ?\N{POP DIRECTIONAL ISOLATE}))
 
+(defun shr-tag-math (dom)
+  ;; Display an annotation (typically TeX notation) if available.
+  (shr-generic
+   (thread-first
+     dom
+     (dom-child-by-tag 'semantics)
+     (dom-child-by-tag 'annotation)
+     (or dom))))
+
 ;;; Outline Support
 (defun shr-outline-search (&optional bound move backward looking-at)
   "A function that can be used as `outline-search-function' for rendered html.
-- 
2.46.2