root/lang/gauche/oldtype/trunk/command/blog @ 7811

Revision 7811, 1.4 kB (checked in by kiyoka, 7 years ago)

Added all project files of OldType?. (ported from sourceforge.jp)

  • Property svn:executable set to *
Line 
1#!/usr/local/bin/gosh
2
3(use srfi-1)
4(use oldtype.util)
5
6
7(define ot-new-entry-limit 10)
8
9
10(define ot-blog (format "~a/!~a.blog"
11                        (oldtype:editpath)
12                        (oldtype:user-local)))
13
14(define ot-blog-header (format "~a.blog_header.ot"
15                               (oldtype:user-local)))
16
17(define (ot-blog-entrylist)
18  (reverse
19   (sort
20    (oldtype:get-pagelist (string-append
21                           (oldtype:user-local)
22                           "[.]([0-9]+)")))))
23
24(define (output-blog save-filename entrylist)
25  (with-output-to-file save-filename
26    (lambda ()
27      (for-each
28       (lambda (filename)
29         (with-input-from-file (string-append (oldtype:editpath) "/" filename)
30           (lambda ()
31             (when (#/[.][0-9]+/ filename)
32               (display "----") (newline)
33               (display
34                (string-append "* [[" (oldtype:otpath->wikiname filename) "]]")))
35             (for-each print (port->string-list (current-input-port))))))
36       entrylist))))
37
38
39(define (main argv)
40  (output-blog (string-append ot-blog ".ot")
41               (cons
42                ot-blog-header
43                (take (ot-blog-entrylist) ot-new-entry-limit)))
44  (output-blog (string-append ot-blog ".past.ot")
45               (cons
46                ot-blog-header
47                (drop (ot-blog-entrylist) ot-new-entry-limit))))
Note: See TracBrowser for help on using the browser.