Procházet zdrojové kódy

Bind content-text & add quotes to HTML attributes

Javier Olaechea před 10 roky
rodič
revize
a9d73e3b26
1 změnil soubory, kde provedl 8 přidání a 5 odebrání
  1. 8 5
      plugins/twitter-summary-card.lisp

+ 8 - 5
plugins/twitter-summary-card.lisp

@@ -1,5 +1,5 @@
1 1
 (defpackage :coleslaw-twitter-summary-card
2
-  (:use :cl)
2
+  (:use :cl :coleslaw)
3 3
   (:export #:enable))
4 4
 
5 5
 (in-package :coleslaw-twitter-summary-card)
@@ -7,12 +7,15 @@
7 7
 (defun summary-card (post twitter-handle)
8 8
   "TODO: Figure if and how to include twitter:url meta property."
9 9
   (format nil "<meta property=\"twitter:card\" content=\"summary\" />
10
-~@[<meta property=\"twitter:author\" content=~A />~]
11
-<meta property=\"twitter:title\" content=~A />
12
-<meta property=\"twitter:description\" content=~A />"
10
+~@[<meta property=\"twitter:author\" content=\"~A\" />~]
11
+<meta property=\"twitter:title\" content=\"~A\" />
12
+<meta property=\"twitter:description\" content=\"~A\" />"
13 13
           twitter-handle
14 14
           (title-of post)
15
-          (content-text post)))
15
+          (let ((text (content-text post)))
16
+            (if (< 200 (length text))
17
+                (subseq text 0 199)
18
+                text))))
16 19
 
17 20
 (defun enable (&key twitter-handle)
18 21
   (add-injection