]> code.delx.au - gnu-emacs/commitdiff
Support <bdo> and <bdi>
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Mar 2016 00:19:52 +0000 (11:19 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 1 Mar 2016 00:19:52 +0000 (11:19 +1100)
* lisp/net/shr.el (shr-tag-bdo): New function.
(shr-tag-bdi): Ditto.

lisp/net/shr.el

index ab04b9a065aa4e7ebe393f59910600925d295224..c469e699ae8c783e5ff2684fc62d2b57041889d2 100644 (file)
@@ -1681,6 +1681,24 @@ The preference is a float determined from `shr-prefer-media-type'."
       (shr-colorize-region start (point) color
                           (cdr (assq 'background-color shr-stylesheet))))))
 
+(defun shr-tag-bdo (dom)
+  (let* ((direction (dom-attr dom 'dir))
+         (char (cond
+                ((equal direction "ltr")
+                 #x202d)                ; LRO
+                ((equal direction "rtl")
+                 #x202e))))             ; RLO
+    (when char
+      (insert char))
+    (shr-generic dom)
+    (when char
+      (insert #x202c))))                ; PDF
+
+(defun shr-tag-bdi (dom)
+  (insert #x2068)                       ; FSI
+  (shr-generic dom)
+  (insert #x2069))                      ; PDI
+
 ;;; Table rendering algorithm.
 
 ;; Table rendering is the only complicated thing here.  We do this by