unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50223: Add new shr faces and rendering functions
@ 2021-08-27  1:58 Jeremy Friesen
  2021-11-06  1:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Friesen @ 2021-08-27  1:58 UTC (permalink / raw)
  To: 50223


[-- Attachment #1.1: Type: text/plain, Size: 541 bytes --]

Per conversations with larsi@gnus.org, I'm submitting a patch for adding
the following to SHR:

    * lisp/net/shr.el (shr-tag-cite): Add <CITE> tag
    * lisp/net/shr.el (shr-tag-dfn): Add <DFN> tag
    * lisp/net/shr.el (shr-tag-small): Add <SMALL> tag
    * lisp/net/shr.el (shr-tag-time): Add <TIME> tag
    * lisp/net/shr.el (shr-tag-q): Add <Q> tag
    * lisp/net/shr.el (shr-around-q-tag): New defcustom
    * lisp/net/shr.el (shr-time): New defface
    * lisp/net/shr.el (shr-small): New defface

-- 

Jeremy Friesen
takeonrules.com

[-- Attachment #1.2: Type: text/html, Size: 1357 bytes --]

[-- Attachment #2: 0002-Add-new-shr-faces-and-rendering-functions.patch --]
[-- Type: application/octet-stream, Size: 3453 bytes --]

From f73824a175ef6067d3bc5ee5930b552bbf25da25 Mon Sep 17 00:00:00 2001
From: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Date: Thu, 26 Aug 2021 17:05:52 -0400
Subject: [PATCH] Add new shr faces and rendering functions

* lisp/net/shr.el (shr-tag-cite): Add <CITE> tag
* lisp/net/shr.el (shr-tag-dfn): Add <DFN> tag
* lisp/net/shr.el (shr-tag-small): Add <SMALL> tag
* lisp/net/shr.el (shr-tag-time): Add <TIME> tag
* lisp/net/shr.el (shr-tag-q): Add <Q> tag
* lisp/net/shr.el (shr-around-q-tag): New defcustom
* lisp/net/shr.el (shr-time): New defface
* lisp/net/shr.el (shr-small): New defface
---
 lisp/net/shr.el                    | 45 ++++++++++++++++++++++++++++++
 test/lisp/net/shr-resources/q.html |  1 +
 test/lisp/net/shr-resources/q.txt  |  1 +
 3 files changed, 47 insertions(+)
 create mode 100644 test/lisp/net/shr-resources/q.html
 create mode 100644 test/lisp/net/shr-resources/q.txt

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 85d81b6bbc..dbb45c3ff1 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -128,6 +128,14 @@ Alternative suggestions are:
   :version "24.4"
   :type 'string)
 
+(defcustom shr-around-q-tag '("\"" . "\"")
+  "The before and after quotes for a Q-tag.
+- `car' is inserted before the Q-tag
+- `cdr' is inserted after the Q-tag.
+Alternative suggestions are: - '(\"“\" . \"”\")"
+  :version "28.1"
+  :type (cons 'string 'string))
+
 (defcustom shr-cookie-policy 'same-origin
   "When to use cookies when fetching dependent data like images.
 If t, always use cookies.  If nil, never use cookies.  If
@@ -183,6 +191,16 @@ temporarily blinks with this face."
   "Face for <abbr> elements."
   :version "27.1")
 
+(defface shr-time
+  '((t :inherit underline :underline (:style wave)))
+  "Face for <time> elements."
+  :version "28.1")
+
+(defface shr-small
+  '((t :height 0.8))
+  "Face for <small> elements."
+  :version "28.1")
+
 (defface shr-h1
   '((t :height 1.3 :weight bold))
   "Face for <h1> elements."
@@ -1498,9 +1516,36 @@ ones, in case fg and bg are nil."
 (defun shr-tag-em (dom)
   (shr-fontize-dom dom 'italic))
 
+(defun shr-tag-cite (dom)
+  (shr-fontize-dom dom 'italic))
+
+(defun shr-tag-dfn (dom)
+  (shr-fontize-dom dom 'italic))
+
 (defun shr-tag-strong (dom)
   (shr-fontize-dom dom 'bold))
 
+(defun shr-tag-small (dom)
+  (shr-fontize-dom dom (if shr-use-fonts 'shr-small)))
+
+(defun shr-tag-q (dom)
+  (shr-insert (car shr-around-q-tag))
+  (shr-generic dom)
+  (shr-insert (cdr shr-around-q-tag)))
+
+(defun shr-tag-time (dom)
+    (when-let* ((datetime (or
+                           (dom-attr dom 'title)
+                           (dom-attr dom 'datetime)))
+	        (start (point)))
+      (shr-generic dom)
+      (shr-add-font start (point) 'shr-time)
+      (add-text-properties
+       start (point)
+       (list
+        'help-echo datetime
+        'mouse-face 'highlight))))
+
 (defun shr-tag-u (dom)
   (shr-fontize-dom dom 'underline))
 
diff --git a/test/lisp/net/shr-resources/q.html b/test/lisp/net/shr-resources/q.html
new file mode 100644
index 0000000000..e60e8e39a6
--- /dev/null
+++ b/test/lisp/net/shr-resources/q.html
@@ -0,0 +1 @@
+<q>Hello World</q>
\ No newline at end of file
diff --git a/test/lisp/net/shr-resources/q.txt b/test/lisp/net/shr-resources/q.txt
new file mode 100644
index 0000000000..be5d95a193
--- /dev/null
+++ b/test/lisp/net/shr-resources/q.txt
@@ -0,0 +1 @@
+"Hello World"
\ No newline at end of file
-- 
2.31.1


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

* bug#50223: Add new shr faces and rendering functions
  2021-08-27  1:58 bug#50223: Add new shr faces and rendering functions Jeremy Friesen
@ 2021-11-06  1:08 ` Lars Ingebrigtsen
  2022-03-22 22:58   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-06  1:08 UTC (permalink / raw)
  To: Jeremy Friesen; +Cc: 50223

Jeremy Friesen <jeremy.n.friesen@gmail.com> writes:

> Per conversations with larsi@gnus.org, I'm submitting a patch for adding the
> following to SHR:
>
>     * lisp/net/shr.el (shr-tag-cite): Add <CITE> tag
>     * lisp/net/shr.el (shr-tag-dfn): Add <DFN> tag
>     * lisp/net/shr.el (shr-tag-small): Add <SMALL> tag
>     * lisp/net/shr.el (shr-tag-time): Add <TIME> tag
>     * lisp/net/shr.el (shr-tag-q): Add <Q> tag
>     * lisp/net/shr.el (shr-around-q-tag): New defcustom
>     * lisp/net/shr.el (shr-time): New defface
>     * lisp/net/shr.el (shr-small): New defface

This was ten weeks ago and I forget whether I asked this or not -- is
the copyright assignment process ongoing?  (I can't find an assignment
on file.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50223: Add new shr faces and rendering functions
  2021-11-06  1:08 ` Lars Ingebrigtsen
@ 2022-03-22 22:58   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-22 22:58 UTC (permalink / raw)
  To: Jeremy Friesen; +Cc: 50223

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This was ten weeks ago and I forget whether I asked this or not -- is
> the copyright assignment process ongoing?  (I can't find an assignment
> on file.)

And this was several months ago, and there's been no response, so I
guess this isn't going to happen, and I'm therefore closing this bug
report.  If progress can be made, please respond to the debbugs address
and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-03-22 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27  1:58 bug#50223: Add new shr faces and rendering functions Jeremy Friesen
2021-11-06  1:08 ` Lars Ingebrigtsen
2022-03-22 22:58   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).