Permalink
Browse files

added "package-link" markup extension

  • Loading branch information...
archimag committed Apr 2, 2011
1 parent 3d7834c commit b4b73a6ffac17d5ccfa6e4aa2f3152efae1aacbd
Showing with 33 additions and 13 deletions.
  1. +26 −1 src/markup.lisp
  2. +4 −12 static/css/style.css
  3. +3 −0 templates/markup.tmpl
View
@@ -39,6 +39,8 @@
;;; cliki2 markup extensions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; article-link
+
(define-rule article-link (and (and (? #\\) "_(") (+ (and (! #\)) character)) #\))
(:destructure (start article end)
(declare (ignore start end))
@@ -51,6 +53,8 @@
:href (restas:genurl 'cliki2:view-article :title title)))
stream))
+;;;; person-link
+
(define-rule person-link (and "_P(" (+ (and (! #\)) character)) #\))
(:destructure (start name end)
(declare (ignore start end))
@@ -62,6 +66,8 @@
:href (restas:genurl 'cliki2:view-person :name name)))
stream))
+;;;; hyperspec-link
+
(define-rule hyperspec-link (and "_H(" (+ (and (! #\)) character)) #\))
(:destructure (start symbol end)
(declare (ignore start end))
@@ -73,11 +79,15 @@
:href (clhs-lookup:spec-lookup symbol)))
stream))
+;;;; category-link
+
(define-rule category-link (and (and (? #\\) "*(") (+ (and (! #\)) character)) #\))
(:destructure (start category end)
(declare (ignore start end))
(cons :article-link (cliki2:normalize-name (concat category)))))
+;;;; code-block
+
(define-rule empty-lines
(* (and (* (or #\Space #\Tab)) (? #\Return) #\Newline)))
@@ -94,6 +104,8 @@
(write-string (cliki2.view:code-block
(list :code (colorize::html-colorization :common-lisp code)))
stream))
+
+;;;; category-list
(defun category-char-p (character)
(not (member character '(#\: #\" #\)))))
@@ -146,11 +158,24 @@
:title (cliki2::article-title article)))))))
stream))
+;;;; package-link
+
+(define-rule package-link (and ":(package" (+ (or #\Tab #\Space #\Newline #\Return)) "\"" (+ (and (! #\") character)) "\")")
+ (:destructure (start w1 quote link end)
+ (declare (ignore start w1 quote end))
+ (cons :package-link (concat link))))
+
+(defmethod 3bmd:print-tagged-element ((tag (eql :package-link)) stream link)
+ (write-string (cliki2.view:package-link (list :href link))
+ stream))
+
+;;;; cliki2 markup extensions
(define-rule 3bmd-grammar:inline-extensions
(or article-link
person-link
hyperspec-link
category-link
code-block
- category-list))
+ category-list
+ package-link))
View
@@ -156,18 +156,10 @@
margin: 15px 0;
}
-#content a.internal {
- color: #0077bb;
-}
-
-#content a.new {
- color: #BA0000;
-}
-
-
-#content a.hyperspec {
- color: #4040f2;
-}
+#content a.internal { color: #0077bb; }
+#content a.new { color: #BA0000; }
+#content a.hyperspec { color: #4040f2;}
+#content a.download { color: #00E; font-weight: bold; }
#footer {
height: 53px;
View
@@ -36,3 +36,6 @@
</ul>
{/template}
+{template package-link}
+ <a href="{$href |escapeUri}" class="download">Download ASDF package from {$href}</a>
+{/template}

0 comments on commit b4b73a6

Please sign in to comment.