|
Revision 10149, 1.9 kB
(checked in by kiyoka, 5 years ago)
|
|
Supported blog title list page "USERNAME.blog.list.ot".
|
-
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 (output-blog-list save-filename entrylist) |
|---|
| 40 | (with-output-to-file save-filename |
|---|
| 41 | (lambda () |
|---|
| 42 | (for-each |
|---|
| 43 | (lambda (filename) |
|---|
| 44 | (with-input-from-file (string-append (oldtype:editpath) "/" filename) |
|---|
| 45 | (lambda () |
|---|
| 46 | (when (#/[.][0-9]+/ filename) |
|---|
| 47 | (display |
|---|
| 48 | (string-append "- [[" (oldtype:otpath->wikiname filename) "]]")) |
|---|
| 49 | (print (car (port->string-list (current-input-port)))))))) |
|---|
| 50 | entrylist)))) |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | (define (main argv) |
|---|
| 54 | (output-blog (string-append ot-blog ".ot") |
|---|
| 55 | (cons |
|---|
| 56 | ot-blog-header |
|---|
| 57 | (take (ot-blog-entrylist) ot-new-entry-limit))) |
|---|
| 58 | (output-blog (string-append ot-blog ".past.ot") |
|---|
| 59 | (cons |
|---|
| 60 | ot-blog-header |
|---|
| 61 | (drop (ot-blog-entrylist) ot-new-entry-limit))) |
|---|
| 62 | (output-blog-list (string-append ot-blog ".list.ot") |
|---|
| 63 | (ot-blog-entrylist))) |
|---|