aboutsummaryrefslogtreecommitdiff
path: root/unhtml.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'unhtml.lisp')
-rw-r--r--unhtml.lisp7
1 files changed, 5 insertions, 2 deletions
diff --git a/unhtml.lisp b/unhtml.lisp
index 18bab64..6579203 100644
--- a/unhtml.lisp
+++ b/unhtml.lisp
@@ -10,6 +10,9 @@
(loop for c across (plump:child-elements dom)
if (node-has-text c) collect c ))
-(defun text-excerpt (content length)
+(defun text-excerpt (content excerpt-length)
(let ((text-nodes (text-children (plump:parse content))))
- (plump:text (first text-nodes))))
+ (if text-nodes
+ (let ((text (plump:text (first text-nodes))))
+ (subseq text 0 (min excerpt-length (length text))))
+ nil)))