Changeset 15941 for lang/gauche

Show
Ignore:
Timestamp:
07/17/08 21:12:06 (4 months ago)
Author:
kiyoka
Message:

Pretest of 0.3.1

Location:
lang/gauche/oldtype/branches/stable
Files:
2 added
17 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/Makefile

    r13637 r15941  
    3636 
    3737TEST_DIR    = $(PWD) 
    38 SCRIPTFILES = $(package)/$(package).kahua $(package)/version.kahua $(package)/util.kahua $(package)/format.scm $(package)/core.scm $(package)/parse.scm $(package)/util.scm $(package)/pasttime.scm $(package)/page.scm $(package)/timeline.scm $(package)/log.scm 
     38SCRIPTFILES = \ 
     39        $(package)/$(package).kahua $(package)/version.kahua $(package)/util.kahua $(package)/format.scm $(package)/core.scm \ 
     40        $(package)/parse.scm $(package)/util.scm $(package)/pasttime.scm $(package)/page.scm $(package)/timeline.scm \ 
     41        $(package)/log.scm $(package)/svn.scm 
    3942STATICFILES = $(package)/$(package).css $(package)/staticimg/*.png $(package)/*.el $(package)/import/*.js $(package)/import/*.css $(package)/$(package).js 
    4043 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/format.scm

    r14312 r15941  
    109109      ;; download link oldtype-mode.el source code 
    110110      ((download-el) "[Download oldtype-mode.el now]") 
     111      ;; comment-data 
     112      ((comment-data) 
     113       (if (< 1 len) 
     114           (string-append (format "----< ~a >----" (uri-decode-string (car arg))) 
     115                          "\n" 
     116                          (uri-decode-string (cadr arg))) 
     117           (format "!!Error : comment-data format error for ##(comment-data user string) command"))) 
     118      ;; else 
    111119      (else 
    112        (format "!!Error : no such macro \"~a\"!!" command))))) 
     120       (format "[~a]" command))))) 
    113121 
    114122 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/oldtype.css

    r14934 r15941  
    681681    color: white; 
    682682} 
     683 
     684pre.comment { 
     685        margin-left:    0.5em; 
     686        font-size:      medium; 
     687        padding-left:   0.5em; 
     688        margin-top:     1px; 
     689        margin-bottom:  1px; 
     690} 
     691 
     692table.comment { 
     693        width: 70%; 
     694        text-align: left; 
     695} 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/oldtype.kahua

    r14934 r15941  
    1414(use oldtype.timeline) 
    1515(use oldtype.page) 
     16(use oldtype.svn) 
    1617(use srfi-1) 
    1718(use srfi-19) 
     19(use srfi-27) 
    1820(load "oldtype/version.kahua") 
    1921(load "oldtype/util.kahua") 
     
    259261                                ((h5)          `(,@(h5/  (@/ (id "h5"))                  (node-set (rec arg))))) 
    260262                                ((h6)          `(,@(h6/  (@/ (id "h6"))                  (node-set (rec arg)))))))) 
    261                          ((wiki-macro)  `(,@(oldtype:format-macro arg))) 
     263                         ((wiki-macro)  `(,@(oldtype:format-macro arg oldtype-page))) 
    262264                         ((wiki-name)   `(,@(oldtype:expand-wiki-name (car arg)))) 
    263265                         ((hr)          (hr/)) 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/page.scm

    r14370 r15941  
    8282 
    8383 
     84;; Parsing wiki format 
     85;; 
     86;;   In case of log-file or ann-file is #f, this function takes only parse action. 
     87;; 
    8488(define-method parse ((self <oldtype-page>) wiki-port log-file ann-file) 
    8589  (let1 timeline (make <oldtype-timeline> :name (name-of self)) 
    8690        (set! (timeline-of self) 
    87               (parse timeline log-file ann-file))) 
     91              (if (and log-file ann-file) 
     92                  (parse timeline log-file ann-file) 
     93                  timeline))) 
    8894  (set! (sxml-of self) 
    8995        (oldtype:sxml->internal 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/timeline.scm

    r13637 r15941  
    7070   ;; vector of <oldtype-log> in page 
    7171   (annotation    :accessor annotation-of    :init-keyword :annotation 
    72                   :init-value '()) 
     72                  :init-value '#()) 
    7373   ;; vector of text in page 
    7474   (text          :accessor text-of          :init-keyword :text 
    75                   :init-value '()) 
     75                  :init-value '#()) 
    7676   ;; distribution of revision 
    7777   (distribution  :accessor distribution-of  :init-keyword :distribution 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/util.kahua

    r15392 r15941  
    230230     (img/ (@/ (src (string-append (oldtype:static-image-path) "icon.article_text.png")) 
    231231               (alt "PLAIN")))) 
     232    ((comment) 
     233     (img/ (@/ (src (string-append (oldtype:static-image-path) "icon.comment_blue.png")) 
     234               (alt "COMMENT")))) 
     235    ((double-comment) 
     236     (img/ (@/ (src (string-append (oldtype:static-image-path) "icon.double_comment.png")) 
     237               (alt "DCOMMENT")))) 
     238    ((alert) 
     239     (img/ (@/ (src (string-append (oldtype:static-image-path) "icon.stop_round.png")) 
     240               (alt "ALERT")))) 
    232241    (else 
    233242     `(p/ ,(format "!!Error : no such icon-image \"~a\"!!" sym))))) 
    234      
    235  
    236 (define (oldtype:format-macro expr) 
     243 
     244 
     245(define (oldtype:add-comment oldtype-page name comment) 
     246  (apply append 
     247         (map 
     248          (lambda (str) 
     249            (if (#/##\(comment\)/ str) 
     250                `( 
     251                  ,(format "##(comment-data ~a ~a)" 
     252                           (uri-encode-string name) 
     253                           (uri-encode-string comment)) 
     254                  ,str) 
     255                `(,str))) 
     256          (get-text-list oldtype-page)))) 
     257 
     258 
     259(define (oldtype:format-macro expr oldtype-page) 
    237260  (let ((command (car expr)) 
    238261        (arg  ;; symbol list to string list. 
     
    337360      ;; input comment 
    338361      ((comment) 
    339        (form/ (@/ (action ".")) 
    340               (table/ 
    341                (tr/ (th/ "Post a comment")) 
    342                (tr/ (td/ 
    343                      "Name:" 
    344                      (input/ 
    345                       (@/ (type "text") (value "") (size 20))))) 
    346                (tr/ (td/ 
    347                      (textarea/ 
    348                       (@/ (cols 120) (rows 3))))) 
    349                (tr/ (td/ 
    350                      (input/ (@/ (type "submit") (value "Submit comment")))))))) 
     362       (form/cont/ 
     363        (@@/ (cont 
     364              (entry-lambda (:keyword name comment) 
     365                (let1 nodes  
     366                      (p/ 
     367                       (oldtype:icon-image 'alert) 
     368                       "Error: commit action missed.") 
     369                      (if (or (> 1 (string-length name)) 
     370                              (> 1 (string-length comment))) 
     371                          (set! nodes (p/ 
     372                                       (oldtype:icon-image 'alert) 
     373                                       "Please input name and comment.")) 
     374                          (let1 work (make <svn-work> 
     375                                       :url      (oldtype:get-arguments 'svn) 
     376                                       :user     (oldtype:get-arguments 'anon-user) 
     377                                       :pass     (oldtype:get-arguments 'anon-pass) 
     378                                       :basepath (oldtype:workpath)) 
     379                                (init work (string-append 
     380                                            (number->string (sys-time)) 
     381                                            "." 
     382                                            (number->string (random-integer 100)))) 
     383                                (save-text-list work (name-of oldtype-page) 
     384                                                (oldtype:add-comment oldtype-page name comment)) 
     385                                (let1 result (status work (name-of oldtype-page)) 
     386                                      (when (string=? "M" (car result)) 
     387                                        (begin 
     388                                          (commit work) 
     389                                          (set! nodes 
     390                                                (p/ 
     391                                                 (oldtype:icon-image 'info) 
     392                                                 "Thank you! Your comment was registered."))))))) 
     393                      (standard-page 
     394                       (name-of oldtype-page) 
     395                       (br/) 
     396                       (div/ 
     397                        nodes 
     398                        (p/ "Back to " (oldtype:expand-wiki-name (name-of oldtype-page)))) 
     399                       "" 
     400                       1))))) 
     401        (table/ (@/ (class "comment")) 
     402                (tr/ (th/ 
     403                      (oldtype:icon-image 'double-comment) 
     404                      "Post a comment")) 
     405                (tr/ (td/ 
     406                      "Name:" 
     407                      (input/ 
     408                       (@/ (type "text") (name "name") (value "") (size 20))))) 
     409                (tr/ (td/ 
     410                      (textarea/ 
     411                       (@/ (cols 120) (rows 3) (name "comment"))))) 
     412                (tr/ (td/ 
     413                      (input/ (@/ (type "submit") (value "Submit comment")))))))) 
     414       
     415      ;; display comment 
     416      ((comment-data) 
     417       (if (> 2 len) 
     418           (p/ "!!Error : No argument ##(comment-data user str) command") 
     419           (table/ (@/ (class "comment")) 
     420                   (tr/ (th/ 
     421                         (oldtype:icon-image 'comment) 
     422                         (uri-decode-string (car arg)))) 
     423                   (tr/ (td/ 
     424                         (pre/ (@/ (class "comment")) 
     425                               (uri-decode-string (cadr arg)))))))) 
    351426 
    352427      ;; no listing to !RecentChanges 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/util.scm

    r14370 r15941  
    4444          oldtype:get-string-of-today 
    4545          oldtype:editpath 
     46          oldtype:workpath 
    4647          oldtype:user-local 
    4748          oldtype:user-backend 
     
    8485   (sys-getenv "OT_SITE") 
    8586   "/tmp/oldtype/edit")) 
     87 
     88(define (oldtype:workpath) 
     89  (string-append 
     90   (sys-getenv "OT_SITE") 
     91   "/tmp/work")) 
    8692 
    8793(define (oldtype:user-local) 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/oldtype/version.kahua

    r15392 r15941  
    77 
    88;;--------------------------------------------------------- 
    9 (define *oldtype-version* "0.3.0") 
     9(define *oldtype-version* "0.3.1") 
  • lang/gauche/oldtype/branches/stable/Kahua/oldtype/plugins/oldtype.scm

    r13637 r15941  
    1818(allow-module oldtype.timeline) 
    1919(allow-module oldtype.page) 
     20(allow-module oldtype.svn) 
    2021(allow-module rfc.uri) 
  • lang/gauche/oldtype/branches/stable/Makefile

    r8263 r15941  
    77        tar xfC ../stable.tar ../branches/stable 
    88        /bin/rm -f ../stable.tar 
    9         cat ./config.sh | sed 's/OT_MASTER=nil/OT_MASTER=t/' | sed 's/site-unstable/site-stable/' > ../branches/stable/config.sh 
     9        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 
  • lang/gauche/oldtype/branches/stable/bin/batch.sh

    r15392 r15941  
    3838  #run-parts ${OT_HOME}/hook 
    3939  echo -n [info] sleep... 
    40   sleep 5 
     40  sleep 1 
    4141  echo wakeup 
    4242} 
  • lang/gauche/oldtype/branches/stable/bin/convert.sh

    r15392 r15941  
    4949  echo ${base} | grep "!" > /dev/null 
    5050  generated=$? 
    51   if [ "0" = $generated ] ; then 
     51  if [ "0" = "$generated" ] ; then 
    5252    diffs=`_svn t diff ${base}.ot | wc -l | awk '{ print $1; }'` 
    5353#    echo diffs : ${diffs} 
    5454    [ "0" != "${diffs}" -o ! -f ../_out/${base}.sexp ] 
    5555    status=$? 
     56 
     57    ## TODO: fix me ( Must implement !xxxxx.ot contents converttion check ) 
     58    status=0 
     59 
    5660#    echo status : ${status} 
    5761  else  
  • lang/gauche/oldtype/branches/stable/command/blog

    r15392 r15941  
    22 
    33(use srfi-1) 
     4(use util.list) 
    45(use oldtype.util) 
    56 
     
    3637                 (display  
    3738                  (string-append "* [[" (oldtype:otpath->wikiname filename) "]]")))) 
    38              (for-each print (port->string-list (current-input-port)))))) 
     39             (for-each 
     40              (lambda (line) 
     41                (if (#/##\(comment\)/ line) 
     42                    (print (string-append "comment please => [[" (oldtype:otpath->wikiname filename) "]]")) 
     43                    (print line))) 
     44              (port->string-list (current-input-port)))))) 
    3945       entrylist) 
    4046      (display appendix) 
     
    6066               (cons 
    6167                ot-blog-header 
    62                 (take (ot-blog-entrylist) ot-new-entry-limit)) 
     68                (take* (ot-blog-entrylist) ot-new-entry-limit)) 
    6369               "") 
    6470  (output-blog-list (string-append ot-blog ".list.ot") 
  • lang/gauche/oldtype/branches/stable/src/Makefile

    r14312 r15941  
    55all: log.txt  Test.ann.txt  Entry1.ann.txt  Entry2.ann.txt 
    66        gosh -I ../Kahua/oldtype ./oldtype_to internal  ../edit/Test.ot    log.txt Test.ann.txt    > Test.sexp 
     7        gosh -I ../Kahua/oldtype ./oldtype_to internal  ../edit/Test.ot                            > Test.no-timeline.sexp 
    78        gosh -I ../Kahua/oldtype ./oldtype_to internal  ../edit/Entry1.ot  log.txt Entry1.ann.txt  > Entry1.sexp 
    89        gosh -I ../Kahua/oldtype ./oldtype_to internal  ../edit/Entry2.ot  log.txt Entry2.ann.txt  > Entry2.sexp 
  • lang/gauche/oldtype/branches/stable/src/oldtype_to

    r14312 r15941  
    145145    (case type 
    146146      ('internal 
    147        (when (< 1 (length rest)) 
    148          (let1 oldtype-page   (parse (make <oldtype-page> :name wikiname) input-port (car rest) (cadr rest)) 
    149                (pretty-print-sexp (serialize oldtype-page))))) 
     147       (if (< 1 (length rest)) 
     148           (let1 oldtype-page   (parse (make <oldtype-page> :name wikiname) input-port (car rest) (cadr rest)) 
     149                 (pretty-print-sexp (serialize oldtype-page))) 
     150           (let1 oldtype-page   (parse (make <oldtype-page> :name wikiname) input-port #f #f) 
     151                 (pretty-print-sexp (serialize oldtype-page))))) 
    150152      ('sxml 
    151153       (let1 sxml (oldtype-parse input-port) 
  • lang/gauche/oldtype/branches/stable/src/test.scm

    r14312 r15941  
    1313(use oldtype.page) 
    1414(use oldtype.core) 
     15(use oldtype.svn) 
    1516(use gauche.test)                                                      
    1617(use util.list) 
     
    3536          (open-input-string converted-str))) 
    3637    (let ((oldtype-page #f) 
     38          (oldtype-page-no-timeline #f) 
    3739          (oldtype-timeline #f) 
    38           (loaded        (with-input-from-file "Test.sexp.master" 
    39                            (lambda () 
    40                              (read))))) 
    41  
     40          (loaded 
     41           (with-input-from-file "Test.sexp.master" 
     42             (lambda () 
     43               (read)))) 
     44          (loaded-no-timeline 
     45           (with-input-from-file "Test.no-timeline.sexp.master" 
     46             (lambda () 
     47               (read))))) 
    4248      (test-start "serialize,deserialize") 
    4349 
     
    5359 
    5460      (test-section "oldtype-page") 
    55       (set! oldtype-page (parse (make <oldtype-page> :name "Test") input-port log-file ann-file)) 
     61      (set! oldtype-page 
     62            (parse (make <oldtype-page> :name "Test") input-port log-file ann-file)) 
     63      (port-seek input-port 0) 
     64      (set! oldtype-page-no-timeline 
     65            (parse (make <oldtype-page> :name "Test") input-port #f #f)) 
     66 
    5667      (let1 serialized     (serialize oldtype-page) 
    57             (test "serialized == DATA        " 
     68            (test "serialized == DATA (1)  " 
    5869                  loaded 
    5970                  (lambda () (serialize oldtype-page))) 
    60  
     71             
    6172            (test "serialized == deserialized" serialized (lambda ()  
    6273                                                            (serialize 
    6374                                                             (deserialize 
    6475                                                              (make <oldtype-page>) 
    65                                                               serialized))))) 
     76                                                              serialized)))) 
     77            (test "serialized == DATA (2)  " 
     78                  loaded-no-timeline 
     79                  (lambda () (serialize oldtype-page-no-timeline)))) 
    6680      (test-end) 
    6781 
     
    168182      (test-end) 
    169183 
     184      (test-start "svn commit") 
     185 
     186      (let1 work 
     187            (make <svn-work> :url "http://genkan.sumibi.org/svn/newtype" :user "anonymous" :pass "anonymous" :basepath "/Users/kiyoka/work/tmp") 
     188             
     189            (test "Initialize svn work directory" 
     190                  #t 
     191                  (lambda () 
     192                    (string? (init work (number->string (sys-time)))))) 
     193 
     194            (test "status of wikiname (no changes)" 
     195                  '("" "") 
     196                  (lambda () 
     197                    (status work "_kiyoka"))) 
     198 
     199            (test "status of wikiname (some changes)" 
     200                  "M" 
     201                  (lambda () 
     202                    (save-text-list work 
     203                                    "test" 
     204                                    '("UnitTest用ページ。" "----" "##(comment)")) 
     205                    (car (status work "test")))) 
     206             
     207            (when 
     208                #t 
     209              (test "commit from work" 
     210                    #t 
     211                    (lambda () 
     212                      (commit work))))) 
     213       
     214      (test-end) 
     215       
    170216      )))