Changeset 21126
- Timestamp:
- 10/11/08 16:57:22 (8 weeks ago)
- Location:
- lang/gauche/oldtype/trunk
- Files:
-
- 3 modified
-
Kahua/oldtype/oldtype/util.scm (modified) (2 diffs)
-
Kahua/oldtype/oldtype/version.kahua (modified) (1 diff)
-
command/blog (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/util.scm
r20419 r21126 56 56 oldtype:utc->ago-string 57 57 oldtype:grouping-blog-entries 58 oldtype:thumbnail-filter 58 59 pretty-print-sexp)) 59 60 (select-module oldtype.util) … … 307 308 308 309 310 ;; 311 ;; test pattern: 312 ;; (thumbnail-filter '("line 1" 313 ;; "line 2" 314 ;; "line 3" 315 ;; "line 4" 316 ;; "##(amazon 4873113482) ##(img-s ../img/abc.jpg)" 317 ;; "! ##(youtube 4873113482) ##(img-m ../img/abc.jpg)" 318 ;; )) 319 ;; result: 320 ;; "##(img-s ../img/abc.jpg) ##(amazon-s 4873113482) " 321 ;; 322 (define (oldtype:thumbnail-filter str-list) 323 (let1 ret '() 324 (for-each 325 (lambda (line) 326 (when (not (#/^[!]/ line)) 327 (regexp-replace-all 328 #/##\((img|img-s|img-m|youtube|youtube-s|youtube-m|amazon|amazon-s|amazon-m)[ ]+([^\)]+)\)/ 329 line 330 (lambda (m) 331 (push! ret (list 332 (rxmatch-substring m 1) 333 (rxmatch-substring m 2))))))) 334 str-list) 335 (string-join 336 (map 337 (lambda (x) 338 (let1 command-pair (string-split (car x) #\-) 339 (string-append 340 "##(" (car command-pair) "-s " (cadr x) ") "))) 341 (reverse ret))))) 342 343 309 344 (provide "oldtype/util") -
lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/version.kahua
r20400 r21126 7 7 8 8 ;;--------------------------------------------------------- 9 (define *oldtype-version* "0.3. 4")9 (define *oldtype-version* "0.3.5") -
lang/gauche/oldtype/trunk/command/blog
r20548 r21126 39 39 (for-each 40 40 (lambda (line) 41 (if ( #/##\(comment\)/ line)41 (if (and (#/##\(comment\)/ line) (not (#/^[!]/ line))) 42 42 (print (string-append "comment please => [[" (oldtype:otpath->wikiname filename) "]]")) 43 43 (print line))) … … 47 47 (newline)))) 48 48 49 ;;50 ;; test pattern:51 ;; (thumbnail-filter '("line 1"52 ;; "line 2"53 ;; "line 3"54 ;; "line 4"55 ;; "##(amazon 4873113482) ##(img-s ../img/abc.jpg)"56 ;; "! ##(youtube 4873113482) ##(img-m ../img/abc.jpg)"57 ;; ))58 ;; result:59 ;; "##(img-s ../img/abc.jpg) ##(amazon-s 4873113482) "60 ;;61 (define (thumbnail-filter str-list)62 (let1 ret '()63 (for-each64 (lambda (line)65 (when (not (#/^!/ line))66 (regexp-replace-all67 #/##\((img|img-s|img-m|youtube|youtube-s|youtube-m|amazon|amazon-s|amazon-m)[ ]+([^\)]+)\)/68 line69 (lambda (m)70 (push! ret (list71 (rxmatch-substring m 1)72 (rxmatch-substring m 2)))))))73 str-list)74 (string-join75 (map76 (lambda (x)77 (let1 command-pair (string-split (car x) #\-)78 (string-append79 "##(" (car command-pair) "-s " (cadr x) ") ")))80 (reverse ret)))))81 49 82 83 (define (output-blog-list save-filename entrylist) 50 (define (output-blog-list save-filename group-entries) 84 51 (with-output-to-file save-filename 85 52 (lambda () 53 (print " Past blog entries. ") 86 54 (for-each 87 (lambda (filename) 88 (with-input-from-file (string-append (oldtype:editpath) "/" filename) 89 (lambda () 90 (when (#/[.][0-9]+/ filename) 91 (display 92 (string-append "- [[" (oldtype:otpath->wikiname filename) "]]")) 93 (let* ((lst (port->string-list (current-input-port))) 94 (image-line (thumbnail-filter lst))) 95 (print (car lst)) ;; first line 96 (when (< 0 (string-length image-line)) 97 (print image-line))))))) 98 entrylist)))) 55 (lambda (group) 56 (let ((month_year (car group)) 57 (entries (cdr group))) 58 (print 59 (string-append "* [[!" (oldtype:user-local) ".blog." #?=month_year "]]")) 60 (for-each 61 (lambda (filename) 62 (with-input-from-file (string-append (oldtype:editpath) "/" filename) 63 (lambda () 64 (when (#/[.][0-9]+/ #?=filename) 65 (display 66 (string-append "- [[" (oldtype:otpath->wikiname filename) "]]")) 67 (let* ((lst (port->string-list (current-input-port))) 68 (image-line (oldtype:thumbnail-filter lst))) 69 (print (car lst)) ;; first line 70 (when (< 0 (string-length image-line)) 71 (print image-line))))))) 72 (reverse (sort entries))))) 73 group-entries)))) 99 74 100 75 … … 106 81 "") 107 82 (output-blog-list (string-append ot-blog ".list.ot") 108 (ot-blog-entrylist)) 83 (sort 84 (oldtype:grouping-blog-entries 85 (ot-blog-entrylist)) 86 (lambda (x y) (string>? (car x) (car y))))) 87 109 88 (for-each 110 89 (lambda (x) … … 118 97 (oldtype:grouping-blog-entries 119 98 (ot-blog-entrylist))) 120 99 121 100 (exit 0))
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)