emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b6b9d46: * lisp/dom.el (dom-strings): New function.


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master b6b9d46: * lisp/dom.el (dom-strings): New function.
Date: Fri, 16 Jan 2015 02:09:18 +0000

branch: master
commit b6b9d465cb81f5d35fb5c5432461ce7170759725
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    * lisp/dom.el (dom-strings): New function.
---
 doc/lispref/text.texi |    3 +++
 lisp/ChangeLog        |    2 ++
 lisp/dom.el           |    8 ++++++++
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 472aedb..1b8897f 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -4507,6 +4507,9 @@ which is a regular expression.
 Return all nodes in @var{dom} that have IDs that match @var{match},
 which is a regular expression.
 
address@hidden dom-strings @var{dom}
+Return all strings in @var{DOM}.
+
 @end table
 
 Utility functions:
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7ef0e6a..6aa0c12 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
 2015-01-16  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * dom.el (dom-strings): New function.
+
        * files.el (directory-files-recursively): Don't use the word
        "path" for a file name.
 
diff --git a/lisp/dom.el b/lisp/dom.el
index 527b8e6..11357e8 100644
--- a/lisp/dom.el
+++ b/lisp/dom.el
@@ -103,6 +103,14 @@ A name is a symbol like `td'."
        (cons dom matches)
       matches)))
 
+(defun dom-strings (dom)
+  "Return elements in DOM that are strings."
+  (cl-loop for child in (dom-children dom)
+          if (stringp child)
+          collect child
+          else
+          append (dom-strings child)))
+
 (defun dom-by-class (dom match)
   "Return elements in DOM that have a class name that matches regexp MATCH."
   (dom-elements dom 'class match))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]