Changeset 22071 for lang

Show
Ignore:
Timestamp:
10/24/08 21:49:41 (5 years ago)
Author:
kiyoka
Message:

sync from trunk.

Location:
lang/gauche/oldtype/branches/stable
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/format.scm

    r21138 r22071  
    7373            wikiname))) 
    7474 
    75 (define (oldtype:wiki-macro->plain expr) 
     75(define (oldtype:wiki-macro->plain expr rich-mode) 
    7676  (let ((command (car expr)) 
    7777        (arg  ;; symbol list to string list. 
     
    8484        (len (length (cdr expr)))) 
    8585    (case command 
    86       ((img)        "[img] ") 
     86      ((img img-s img-m) 
     87       (if (and (#/^http:/ (car arg)) rich-mode) 
     88           (string-append "<img src=\"" (car arg) "\"/>") 
     89           "[img] ")) 
    8790      ((todo)       "[TODO] ") 
    8891      ((done)       "[DONE] ") 
    89       ((youtube)    "[YouTube] ") 
     92      ((youtube youtube-s youtube-m) 
     93           (if (< 0 len) 
     94               (let ((_videoid (car arg))) 
     95                 (if (not rich-mode) 
     96                     (format #f "[YouTube ~a] " _videoid) 
     97                     (string-append "<img src=\"" (oldtype:youtube-thumbnail _videoid) "\"" 
     98                                    (case command 
     99                                      ((youtube)   " ") 
     100                                      ((youtube-s) (format #f " height=~a " oldtype:image-height-s)) 
     101                                      ((youtube-m) (format #f " height=~a " oldtype:image-height-m))) 
     102                                    "/>"))) 
     103               "!!Error : No argument ##(youtube VIDEOID) command")) 
    90104      ((thumb) 
    91105       (if (< 0 len) 
     
    93107                 (string-append "[Thumb " _url "] ")) 
    94108           "!!Error : No argument ##(thumb URL) command")) 
    95       ((amazon) 
     109      ((amazon amazon-s amazon-m) 
    96110       (if (< 0 len) 
    97111           (let* ((_asin (car arg)) 
     
    100114                             _asin))) 
    101115             (if (#/^[0-9a-zA-Z]+$/ _asin) 
    102                  (format "[Amazon ~a] " _asin) 
     116                 (if (not rich-mode) 
     117                     (format #f "[Amazon ~a]" _asin) 
     118                     (string-append "<img src=\"" (oldtype:amazon-thumbnail _asin) "\"" 
     119                                    (case command 
     120                                      ((amazon)   " ") 
     121                                      ((amazon-s) (format #f " height=~a " oldtype:image-height-s)) 
     122                                      ((amazon-m) (format #f " height=~a " oldtype:image-height-m))) 
     123                                    "/>")) 
    103124                 (format "!!Error : ASIN code format error for ##(amazon asin) command \"~a\"!!" _asin))) 
    104            "!!Error : No argument ##(amazon URL) command")) 
     125           "!!Error : No argument ##(amazon ASINCODE) command")) 
    105126      ;; timestamp 
    106127      ((timestamp)   "[timestamp] ") 
     
    165186;;   ) 
    166187;; 
    167 (define (oldtype:sxml->plain-text sxmls) 
     188(define (oldtype:sxml->plain-text sxmls rich-mode) 
    168189  (tree->string 
    169190   (let rec 
     
    191212                      ((pre-ol2)     (cons "## "    (rec arg))) 
    192213                      ((pre-ol3)     (cons "### "   (rec arg))) 
    193                       ((h1)          (cons "[] "    (rec arg))) 
    194                       ((h2)          (cons "* "     (rec arg))) 
    195                       ((h3)          (cons "** "    (rec arg))) 
    196                       ((h4)          (cons "*** "   (rec arg))) 
    197                       ((h5)          (cons "**** "  (rec arg))) 
    198                       ((h6)          (cons "***** " (rec arg))) 
    199                       ((wiki-macro)  (oldtype:wiki-macro->plain arg)) 
     214                      ((h1)          (if rich-mode 
     215                                         (list "<h1>"   (rec arg) "</h1>") 
     216                                         (cons "[] "    (rec arg)))) 
     217                      ((h2)          (if rich-mode 
     218                                         (list "<h2>"   (rec arg) "</h2>") 
     219                                         (cons "* "     (rec arg)))) 
     220                      ((h3)          (if rich-mode 
     221                                         (list "<h3>"   (rec arg) "</h3>") 
     222                                         (cons "** "    (rec arg)))) 
     223                      ((h4)          (if rich-mode 
     224                                         (list "<h4>"   (rec arg) "</h4>") 
     225                                         (cons "*** "   (rec arg)))) 
     226                      ((h5)          (if rich-mode 
     227                                         (list "<h5>"   (rec arg) "</h5>") 
     228                                         (cons "**** "  (rec arg)))) 
     229                      ((h6)          (if rich-mode 
     230                                         (list "<h6>"   (rec arg) "</h6>") 
     231                                         (cons "***** " (rec arg)))) 
     232                      ((wiki-macro)  (oldtype:wiki-macro->plain arg rich-mode)) 
    200233                      ((wiki-name)   (oldtype:wikiname->plain (car arg))) 
    201                       ((hr)          (list "----\n")) 
     234                      ((hr)          (if rich-mode 
     235                                         (list "<hr>") 
     236                                         (list "----\n"))) 
    202237                      ((@)           '()) 
    203238                      ((@@)          '()) 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/oldtype-mode.el

    r21138 r22071  
    2525;; 
    2626;; How to nstall and How to use: 
    27 ;;     http://oldtype.sumibi.org/ 
     27;;     http://oldtype.sumibi.org/show-page/oldtype-mode 
    2828;; 
    2929;; 
    3030;; ChangeLog: 
     31;;   [0.0.9] 
     32;;     1. Bugfix: 'Converting URL to ##(amazon ASIN) command' feature generates wrong ASIN code. 
     33;; 
    3134;;   [0.0.8] 
    3235;;     1. Fixed bug: illegal ASINCODE of amazon and VIDEOCODE of youtube use for image file creation. 
     
    5760;; 
    5861;; 
    59 (defconst oldtype-version "0.0.8") 
     62(defconst oldtype-version "0.0.9") 
    6063 
    6164(defconst oldtype-wikiname-face 'oldtype-wikiname-face) 
     
    645648      (shell-command  
    646649       (concat 
    647         (format "w3m -no-graph -halfdump -o ext_halfdump=1 -o strict_iso2022=0 -o fix_width_conv=1 \'%s\' |" url) 
     650        "w3m -no-graph -halfdump -o ext_halfdump=1 -o strict_iso2022=0 -o fix_width_conv=1 \'" url "\' |" 
    648651        "awk \'-F\<\' \'/title_alt/ { print $2; }\' |" 
    649652        "tail -1 |" 
     
    670673          (_url_amazon-pattern 
    671674           "\\(http://.*amazon[.]c.*\\)/\\([0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-]\\)[^0-9A-Z-]?\\(.*\\)") 
     675          (_url_amazon-pattern-part 
     676           "/dp/\\([0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-][0-9A-Z-]\\)") 
    672677          (_url_youtube-pattern 
    673678           "\\(http://.*youtube[.]com/watch\\?v=\\)\\([0-9A-Za-z_-]+\\)\\(.*\\)")) 
     
    734739                 (e     (match-end 3)) 
    735740                 (title (oldtype-fetch-html-title url))) 
     741            (when (string-match    _url_amazon-pattern-part  str) 
     742              (setq asin (match-string 1 str))) 
    736743            (delete-region s e) 
    737744            (goto-char s) 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/oldtype.kahua

    r21138 r22071  
    438438                (item/ 
    439439                 (title/            (string-append (name-of e) "::" (oldtype-first-line e))) 
    440                  (description/      (string-join (get-plain-list e) "\n")) 
     440                 (description/ 
     441                  (string-append 
     442                   "<pre>" 
     443                   (string-join (get-rich-list e) "\n") 
     444                   "</pre>")) 
    441445                 (link/             uri) 
    442446                 (guid/             uri) 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/page.scm

    r21138 r22071  
    5959          get-text-list 
    6060          get-plain-list 
     61          get-rich-list 
    6162          get-rss-entry-pages 
    6263          )) 
     
    7879   ;; vector of text in page 
    7980   (plain       :accessor plain-of       :init-keyword :plain 
     81                :init-value '()) 
     82   ;; vector of rich text in page 
     83   (rich        :accessor rich-of        :init-keyword :rich 
    8084                :init-value '()) 
    8185   )) 
     
    98102        (list->vector 
    99103         (string-split 
    100           (oldtype:sxml->plain-text (sxml-of self)) 
     104          (oldtype:sxml->plain-text (sxml-of self) #f) 
     105          #\newline))) 
     106  (set! (rich-of self) 
     107        (list->vector 
     108         (string-split 
     109          (oldtype:sxml->plain-text (sxml-of self) #t) 
    101110          #\newline))) 
    102111  self) 
     
    108117    (sxml     . ,(sxml-of     self)) 
    109118    (timeline . ,(serialize (timeline-of self))) 
    110     (plain    . ,(vector->list (plain-of self))))) 
     119    (plain    . ,(vector->list (plain-of self))) 
     120    (rich     . ,(vector->list (rich-of self))))) 
    111121 
    112122 
     
    116126    :sxml      (assq-ref internal-data 'sxml) 
    117127    :timeline  (deserialize (make <oldtype-timeline>) (assq-ref internal-data 'timeline)) 
    118     :plain     (list->vector (assq-ref internal-data 'plain)))) 
     128    :plain     (list->vector (assq-ref internal-data 'plain)) 
     129    :rich      (list->vector (assq-ref internal-data 'rich)))) 
    119130 
    120131 
     
    148159(define-method get-plain-list ((self <oldtype-page>)) 
    149160  (vector->list (plain-of self))) 
     161 
     162(define-method get-rich-list ((self <oldtype-page>)) 
     163  (vector->list (rich-of self))) 
    150164 
    151165 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/util.kahua

    r21138 r22071  
    252252       (if (< 0 len) 
    253253           (let1 _videoid (car arg) 
    254                  (a/ (@/ (href (format "http://www.youtube.com/v/~a" _videoid))) 
     254                 (a/ (@/ (href (oldtype:youtube-link _videoid))) 
    255255                     (img/ 
    256                       (@/ (src (format "http://img.youtube.com/vi/~a/1.jpg" _videoid)) 
     256                      (@/ (src (oldtype:youtube-thumbnail _videoid)) 
    257257                          (alt _videoid) 
    258258                          (class "help") 
     
    289289             (if (#/^[0-9a-zA-Z]+$/ _asin) 
    290290                 (a/ 
    291                   (@/ (href (format #f "http://amazon.co.jp/o/ASIN/~a/kiye-22/ref=nosim" _asin))) 
     291                  (@/ (href (oldtype:amazon-link _asin))) 
    292292                  (img/ 
    293                    (@/ (src (format #f "http://images.amazon.com/images/P/~a.09.MZZZZZZZ_.jpg" _asin)) 
     293                   (@/ (src (oldtype:amazon-thumbnail _asin)) 
    294294                       (alt _asin) 
    295295                       (class "help") 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/util.scm

    r21138 r22071  
    5757          oldtype:grouping-blog-entries 
    5858          oldtype:thumbnail-filter 
     59          oldtype:amazon-link 
     60          oldtype:amazon-thumbnail 
     61          oldtype:youtube-link 
     62          oldtype:youtube-thumbnail 
    5963          pretty-print-sexp)) 
    6064(select-module oldtype.util) 
     
    342346 
    343347 
     348(define (oldtype:amazon-link asin-code) 
     349  (format #f "http://amazon.co.jp/o/ASIN/~a/kiye-22/ref=nosim" asin-code)) 
     350 
     351(define (oldtype:amazon-thumbnail asin-code) 
     352  (format #f "http://images.amazon.com/images/P/~a.09.MZZZZZZZ_.jpg" asin-code)) 
     353 
     354(define (oldtype:youtube-link video-id) 
     355  (format #f "http://www.youtube.com/v/~a" video-id)) 
     356 
     357(define (oldtype:youtube-thumbnail video-id) 
     358  (format #f "http://img.youtube.com/vi/~a/1.jpg" video-id)) 
     359                                    
     360 
    344361(provide "oldtype/util") 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/version.kahua

    r21138 r22071  
    77 
    88;;--------------------------------------------------------- 
    9 (define *oldtype-version* "0.3.5") 
     9(define *oldtype-version* "0.3.6") 
  • lang/gauche/oldtype/branches/stable/Makefile

    r21138 r22071  
    99        cat ./config.sh | sed 's/OT_MASTER=nil/OT_MASTER=t/' | sed 's/site-unstable/site-stable/' | sed 's/newtype/oldtype/' > ../branches/stable/config.sh 
    1010        cat ./Kahua/oldtype/Makefile | sed 's/site-unstable/site-stable/' > ../branches/stable/Kahua/oldtype/Makefile 
     11 
     12merge: 
     13        bash -c "cd .. ; svn merge tags/0.3.5@ trunk@ branches/stable" 
     14        cat ./config.sh | sed 's/OT_MASTER=nil/OT_MASTER=t/' | sed 's/site-unstable/site-stable/' | sed 's/newtype/oldtype/' > ../branches/stable/config.sh 
     15        cat ./Kahua/oldtype/Makefile | sed 's/site-unstable/site-stable/' > ../branches/stable/Kahua/oldtype/Makefile 
  • lang/gauche/oldtype/branches/stable/src

    • Property svn:ignore
      •  

        old new  
        1717Sample2.txt 
        1818Test.no-timeline.sexp 
         19Sample1.rich.txt 
         20Sample2.rich.txt 
  • lang/gauche/oldtype/branches/stable/src/Makefile

    r21138 r22071  
    1212        gosh -I ../Kahua/oldtype ./oldtype_to plain     ../edit/Sample1.ot > Sample1.txt 
    1313        gosh -I ../Kahua/oldtype ./oldtype_to plain     ../edit/Sample2.ot > Sample2.txt 
     14        gosh -I ../Kahua/oldtype ./oldtype_to rich      ../edit/Sample1.ot > Sample1.rich.txt 
     15        gosh -I ../Kahua/oldtype ./oldtype_to rich      ../edit/Sample2.ot > Sample2.rich.txt 
    1416 
    1517test: log.txt Test.ann.txt 
  • lang/gauche/oldtype/branches/stable/src/Test.no-timeline.sexp.master

    r21138 r22071  
    2626  (text) 
    2727  (distribution)) 
    28  (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "")) 
     28 (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "") 
     29 (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>")) 
  • lang/gauche/oldtype/branches/stable/src/Test.sexp.master

    r21138 r22071  
    9999   (13317 6 5 4 3) 
    100100   (13304 2))) 
    101  (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "")) 
     101 (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "") 
     102 (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>")) 
  • lang/gauche/oldtype/branches/stable/src/oldtype_to

    r21138 r22071  
    161161       (let* ( 
    162162              (sxml           (oldtype-parse input-port)) 
    163               (sexp           (oldtype:sxml->plain-text sxml))) 
     163              (sexp           (oldtype:sxml->plain-text sxml #f))) 
     164         (print 
     165          (tree->string 
     166           sexp)))) 
     167      ('rich 
     168       (let* ( 
     169              (sxml           (oldtype-parse input-port)) 
     170              (sexp           (oldtype:sxml->plain-text sxml #t))) 
    164171         (print 
    165172          (tree->string 
  • lang/gauche/oldtype/branches/stable/src/test.scm

    r21138 r22071  
    9191 
    9292      (test "ago string of lineno 1 <oldtype-timeline>" 
    93             "  (4 months ago)"  
     93            "  (7 months ago)"  
    9494            (lambda () 
    9595              (get-ago (log-by-lineno oldtype-timeline 1)))) 
    9696      (test "ago string of lineno 1 <oldtype-page>" 
    97             "  (4 months ago)" 
     97            "  (7 months ago)" 
    9898            (lambda () 
    9999              (get-ago oldtype-page 1))) 
     
    119119      (test "date,ago,rank,committer of lineno 1 <oldtype-page>" 
    120120            '((date  . "2008-03-20 21:36 (+0900)") 
    121               (ago   . "  (4 months ago)") 
     121              (ago   . "  (7 months ago)") 
    122122              (rank  . 5) 
    123123              (committer . "kiyoka")) 
  • lang/gauche/oldtype/branches/stable/tool/tdiary2oldtype

    • Property svn:ignore
      •  

        old new  
        77out 
        88tdiary_data 
         9t.sh