summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2015-01-16 03:08:55 +0100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2015-01-16 03:08:55 +0100
commitb6b9d465cb81f5d35fb5c5432461ce7170759725 (patch)
treebb38ba7cfee6b92e90453c8a85615fdeaf0f35a9
parent22294ae511509ad86586eb5d054c95de38e87894 (diff)
* lisp/dom.el (dom-strings): New function.
-rw-r--r--doc/lispref/text.texi3
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/dom.el8
3 files changed, 13 insertions, 0 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 472aedb8ee..1b8897f59e 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.
+@item dom-strings @var{dom}
+Return all strings in @var{DOM}.
+
@end table
Utility functions:
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7ef0e6a274..6aa0c12963 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2015-01-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * 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 527b8e61f2..11357e8880 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))