another checkpoint, off to party
This commit is contained in:
parent
77509e4d3f
commit
bdc98f612b
6 changed files with 25 additions and 6 deletions
|
@ -77,6 +77,8 @@
|
|||
(cons (car in) (pclose p out))))))))
|
||||
|
||||
(define (wordpress->sxml text)
|
||||
(catch 'parser-error
|
||||
(lambda ()
|
||||
(let ((sxml (cadr (with-input-from-string (string-append "<div>" text "</div>")
|
||||
xml->sxml))))
|
||||
(pre-post-order
|
||||
|
@ -87,3 +89,8 @@
|
|||
(cons tag body))))
|
||||
(*text* . ,(lambda (tag text)
|
||||
text))))))
|
||||
(lambda (key . args)
|
||||
`(pre "parse error: "
|
||||
,(with-output-to-string (lambda () (write args)))
|
||||
"\n"
|
||||
,text))))
|
||||
|
|
|
@ -181,7 +181,13 @@
|
|||
(define page-new-comment not-implemented)
|
||||
(define page-delete-comment not-implemented)
|
||||
(define page-delete-post not-implemented)
|
||||
(define page-index not-implemented)
|
||||
|
||||
(define (page-index request index)
|
||||
(rcons* request
|
||||
'title "my bloggidy blog"
|
||||
'body (map (lambda (post)
|
||||
(show-post post #f))
|
||||
(take-max (assq-ref index 'posts) 10))))
|
||||
|
||||
(define (page-show-post request index year month day post)
|
||||
(let ((slug (make-post-key year month day post)))
|
||||
|
|
|
@ -150,8 +150,8 @@
|
|||
|
||||
(define (post-sxml-n-comments post)
|
||||
`(div (@ (class "feedback"))
|
||||
(a (@ (href ,(string-append *public-url-base* "/archives/"
|
||||
(assq-ref post 'encoded-name)
|
||||
(a (@ (href ,(string-append *public-url-base* "archives/"
|
||||
(url:decode (assq-ref post 'key))
|
||||
"#comments")))
|
||||
"(" ,(post-n-comments post) ")")))
|
||||
|
||||
|
|
|
@ -58,6 +58,6 @@
|
|||
(a (@ ,(href "")) "wingolog"))
|
||||
,(make-navbar)
|
||||
(div (@ (id "content"))
|
||||
,@(rref request 'body '(p "what")))
|
||||
,@(rref request 'body '((p "what"))))
|
||||
(div (@ (id "footer"))
|
||||
"powered by sxml")))))
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:export (expanduser match-lines dbg unwind-protect dbg dsu-sort
|
||||
hash-push! list-has-length? list-head-match mapn
|
||||
take-max
|
||||
list-intersperse with-backtrace define-memoized))
|
||||
|
||||
(define (expanduser path)
|
||||
|
@ -66,6 +67,11 @@
|
|||
(let ((handle (hash-create-handle! h key '())))
|
||||
(set-cdr! handle (cons value (cdr handle)))))
|
||||
|
||||
(define (take-max list n)
|
||||
(if (or (null? list) (zero? n))
|
||||
'()
|
||||
(cons (car list) (take-max (cdr list) (1- n)))))
|
||||
|
||||
(define (list-has-length? list len)
|
||||
(cond
|
||||
((zero? len) (null? list))
|
||||
|
|
|
@ -38,7 +38,7 @@ def post_comments(post):
|
|||
sql = ('select comment_ID, comment_author, comment_author_email,'
|
||||
' comment_author_url, comment_author_IP,'
|
||||
' comment_date, comment_date_gmt, comment_content, comment_approved'
|
||||
' from wp_comments where comment_post_ID=%s')
|
||||
' from wp_comments where comment_post_ID=%s where comment_approved!=\'spam\'')
|
||||
cur.execute(sql, (post['id'],))
|
||||
keys = ('id', 'author', 'author_email', 'author_url', 'author_ip',
|
||||
'date', 'date-gmt', 'content', 'approved')
|
||||
|
@ -70,7 +70,7 @@ def write_comment(comment, dir):
|
|||
def make_post_key(post):
|
||||
d = post['date']
|
||||
pre = '%d/%02d/%02d/%s' % (d.year, d.month, d.day, post['name'])
|
||||
return urllib.quote(pre, '')
|
||||
return urllib.quote(pre, '').tolower()
|
||||
|
||||
def write_post(post, categories, comments):
|
||||
def make_metadata():
|
||||
|
|
Loading…
Reference in a new issue