Permalink
Browse files

added to markup: hyperspec-ref and code-block

  • Loading branch information...
1 parent c1cdd1a commit 5606e436da2f61d180408b53482783710e315066 @archimag archimag committed Mar 6, 2011
Showing with 71 additions and 1 deletion.
  1. +1 −0 cliki2.asd
  2. +2 −1 src/defmodule.lisp
  3. +41 −0 src/markup.lisp
  4. +26 −0 static/css/colorize.css
  5. +1 −0 templates/core.tmpl
View
@@ -5,6 +5,7 @@
#:bknr.datastore
#:ironclad
#:docutils
+ #:colorize
#:cl-recaptcha)
:components
((:module "src"
View
@@ -1,7 +1,8 @@
;;;; defmodule.lisp
(restas:define-module #:cliki2
- (:use #:cl #:iter #:bknr.datastore #:bknr.indices))
+ (:use #:cl #:iter #:bknr.datastore #:bknr.indices)
+ (:import-from #:docutils.parser.rst #:&option #:&content #:&content-parser))
(in-package #:cliki2)
View
@@ -13,3 +13,44 @@
docutils.writer.html:body))
(docutils:write-part writer part out))
(format out "</div>"))))
+
+;;;; hypespec-ref
+
+(defclass hyperspec-ref (docutils.nodes:raw)
+ ((spec :initarg :spec :reader hyperspec-ref-spec)))
+
+(defmethod docutils:visit-node ((write docutils.writer.html:html-writer) (node hyperspec-ref))
+ (docutils:part-append
+ (docutils.writer.html::start-tag node
+ "a"
+ (list :href (clhs-lookup:spec-lookup (hyperspec-ref-spec node))
+ :class "common-lisp-entity"))
+ (hyperspec-ref-spec node)
+ "</a>"))
+
+(docutils.parser.rst:def-role hs (spec)
+ (make-instance 'hyperspec-ref
+ :spec spec))
+
+
+;;;; code-block
+
+(defclass code-block (docutils.nodes:raw)
+ ((lang :initarg :lang :initform nil :reader code-block-lang)
+ (code :initarg :code :initform nil :reader code-block-code)))
+
+(defmethod docutils:visit-node ((writer docutils.writer.html:html-writer) (node code-block))
+ (docutils:part-append (docutils.writer.html::start-tag node
+ "div"
+ '(:class "code")))
+ (docutils:part-append (colorize::html-colorization :common-lisp
+ (code-block-code node)))
+ (docutils:part-append "</div>"))
+
+(docutils.parser.rst:def-directive code-block (parent lang &content content)
+ (let ((node (docutils:make-node 'docutils.nodes:paragraph)))
+ (docutils:add-child node
+ (make-instance 'code-block
+ :lang lang
+ :code (docutils::join-strings content #\Newline)))
+ (docutils:add-child parent node)))
View
@@ -0,0 +1,26 @@
+.symbol { color : #770055; background-color : transparent; border: 0px; margin: 0px;}
+a.symbol:link { color : #229955; background-color : transparent; text-decoration: none; border: 0px; margin: 0px; }
+a.symbol:active { color : #229955; background-color : transparent; text-decoration: none; border: 0px; margin: 0px; }
+a.symbol:visited { color : #229955; background-color : transparent; text-decoration: none; border: 0px; margin: 0px; }
+a.symbol:hover { color : #229955; background-color : transparent; text-decoration: none; border: 0px; margin: 0px; }
+.special { color : #FF5000; background-color : inherit; }
+.keyword { color : #770000; background-color : inherit; }
+.comment { color : #007777; background-color : inherit; }
+.string { color : #777777; background-color : inherit; }
+.character { color : #0055AA; background-color : inherit; }
+.syntaxerror { color : #FF0000; background-color : inherit; }
+/* span.paren1:hover { color : inherit; background-color : #BAFFFF; } */
+/* span.paren2:hover { color : inherit; background-color : #FFCACA; } */
+/* span.paren3:hover { color : inherit; background-color : #FFFFBA; } */
+/* span.paren4:hover { color : inherit; background-color : #CACAFF; } */
+/* span.paren5:hover { color : inherit; background-color : #CAFFCA; } */
+/* span.paren6:hover { color : inherit; background-color : #FFBAFF; } */
+
+
+pre, .code {
+ background-color: #f7fbfd;
+ border-top: 1px solid #AC9; border-bottom: 1px solid #AC9;
+ margin: 0.2em; padding: 0.5em;
+ font-family: "Courier New", monospace; font-size: 90%;
+ overflow: auto;
+}
View
@@ -8,6 +8,7 @@
<title>{$title}</title>
<link rel="stylesheet" href="/css/style.css">
+ <link rel="stylesheet" href="/css/colorize.css">
</head>
<body>

0 comments on commit 5606e43

Please sign in to comment.