Changeset 20797

Show
Ignore:
Timestamp:
10/05/08 16:33:05 (5 years ago)
Author:
kiyoka
Message:

Supported <%=a %> and <%isbn_image %> command.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/trunk/tool/tdiary2oldtype/convertToOT.scm

    r20760 r20797  
    1414    (string-append y "_" m "_" d))) 
    1515 
     16 
     17;; 
     18;; "<%=a 'link|str' %>          =>  [[link|str]] 
     19;; "<%=isbn_image 'id' %>       =>  ##(amazon id) 
     20;; 
     21(define (convert-command str) 
     22  (let* ((str 
     23          (regexp-replace-all #/<%=[ ]?a[ ]+'([^|]+)[|]([^']+)'[ ]+%>/ #?=str 
     24                              (lambda (m) 
     25                                (string-append "[[" 
     26                                               #?=(rxmatch-substring m 2) 
     27                                               "|" 
     28                                               #?=(rxmatch-substring m 1) 
     29                                               "]]")))) 
     30         (str 
     31          (regexp-replace-all #/<%=[ ]?isbn_image[ ]+'([^']+)'[ ]+%>/ #?=str 
     32                              (lambda (m) 
     33                                (string-append "##(amazon " 
     34                                               (rxmatch-substring m 1) 
     35                                               ")"))))) 
     36    #?=str)) 
     37 
     38   
    1639(define (output-oldtype-file username date entry-data) 
    1740 
     
    2144       (when (string? (car lst)) 
    2245         (begin 
    23             (display (car lst) port) 
    24             (newline port) 
    25             (newline port)))) 
     46           (display (convert-command (car lst)) port) 
     47           (newline port) 
     48           (newline port)))) 
    2649     entry)) 
    2750