Changeset 22567 for lang/gauche

Show
Ignore:
Timestamp:
11/02/08 17:14:43 (5 years ago)
Author:
kiyoka
Message:

Supported 'Related pages:' feature.

Location:
lang/gauche/oldtype/trunk
Files:
1 added
12 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/core.scm

    r13593 r22567  
    3636  (export  
    3737   oldtype:load-page 
     38   oldtype:load-command-list 
    3839   )) 
    3940(select-module oldtype.core) 
     
    6364 
    6465 
     66(define (oldtype:load-command-list _site-root) 
     67  (define (gen-sexp-filename1) 
     68    (string-append _site-root "/tmp/oldtype/_out/__commands.sexp")) 
     69  (define (gen-sexp-filename2) 
     70    (string-append "./__commands.sexp")) 
     71  (let1 filename (cond 
     72                  ((file-exists? (gen-sexp-filename1)) 
     73                   (gen-sexp-filename1)) 
     74                  ((file-exists? (gen-sexp-filename2)) 
     75                   (gen-sexp-filename2)) 
     76                  (else 
     77                   #f)) 
     78        (if filename 
     79            (with-input-from-file filename 
     80              (lambda () 
     81                (apply 
     82                 append 
     83                 (read (current-input-port))))) 
     84            #f))) 
     85 
     86 
    6587(provide "oldtype/core") 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/format.scm

    r22411 r22567  
    150150;; SXML to wiki-command list in the page. 
    151151;; 
    152 (define (oldtype:sxml->command-list sxmls) 
     152;;  data format is : 
     153;;    '( 
     154;;       ("string")                  ;; means [[string]] wiki name 
     155;;       (reference "B" "A")         ;; means `page A has reference to page B.' ( A->B ) 
     156;;       (command arg1 arg2...)      ;; means ##(command arg1 arg2...) 
     157;;        . 
     158;;        . 
     159;;     ) 
     160;; 
     161(define (oldtype:sxml->command-list sxmls wikiname) 
    153162  (let1 commands '() 
    154163        (let rec 
     
    172181                            (push! commands arg)) 
    173182                           ((wiki-name) 
     183                            (if (string? (car arg)) 
     184                                (if (not (#/[|]/ (car arg))) 
     185                                    (push! commands (list 'reference (car arg) wikiname)))) 
    174186                            (push! commands arg)) 
    175187                           (else 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/oldtype.kahua

    r22008 r22567  
    113113                (get-text-list oldtype-page))))) 
    114114            "" 
     115            '() ;; command-list 
    115116            lineno 
    116117            )))) 
     
    275276 
    276277 
    277 (define (standard-page wikiname barcode nodes first-line . rest-arg) 
     278(define (standard-page wikiname barcode nodes first-line command-list . rest-arg) 
    278279  (html/ (head/ (title/ (string-append wikiname " / " first-line)) 
    279280                (link/ (@/ (rel "stylesheet") (type "text/css") 
     
    334335                   (oldtype:icon-image 'plain)) 
    335336               (oldtype:hatena-bookmarks wikiname)) 
     337          (text/ "Related pages:")(oldtype:reference-pages/ wikiname command-list) 
     338          (br/) 
    336339          barcode 
    337340          (hr/) 
     
    357360 
    358361(define (show-page/page wikiname) 
    359   (let1 oldtype-page (oldtype:load-page (kahua-site-root) wikiname) 
    360         (standard-page 
    361          wikiname 
    362          (if oldtype-page 
    363              (oldtype-page->barcode oldtype-page) 
    364              (br/)) 
    365          (if oldtype-page 
    366              (oldtype-page->higher-order-tag oldtype-page) 
    367              (div/ 
    368               (p/ 
    369                (@/ (class "center")) 
    370                (strong/ 
    371                 (@/ (class "caption")) 
    372                 "This wikipage was not found.")))) 
    373          (if oldtype-page 
    374              (oldtype-first-line oldtype-page) 
    375              "")))) 
     362  (let ((oldtype-page (oldtype:load-page (kahua-site-root) wikiname)) 
     363        (command-list (oldtype:load-command-list (kahua-site-root)))) 
     364    (standard-page 
     365     wikiname 
     366     (if oldtype-page 
     367         (oldtype-page->barcode oldtype-page) 
     368         (br/)) 
     369     (if oldtype-page 
     370         (oldtype-page->higher-order-tag oldtype-page) 
     371         (div/ 
     372          (p/ 
     373           (@/ (class "center")) 
     374           (strong/ 
     375            (@/ (class "caption")) 
     376            "This wikipage was not found.")))) 
     377     (if oldtype-page 
     378         (oldtype-first-line oldtype-page) 
     379         "") 
     380     command-list))) 
    376381 
    377382 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/page.scm

    r22008 r22567  
    6060          get-plain-list 
    6161          get-rich-list 
     62          get-command-list 
    6263          get-rss-entry-pages 
    6364          )) 
     
    8283   ;; vector of rich text in page 
    8384   (rich        :accessor rich-of        :init-keyword :rich 
     85                :init-value '()) 
     86   ;; list of commands in page 
     87   (commands    :accessor commands-of    :init-keyword :commands 
    8488                :init-value '()) 
    8589   )) 
     
    109113          (oldtype:sxml->plain-text (sxml-of self) #t) 
    110114          #\newline))) 
     115  (set! (commands-of self) 
     116        (oldtype:sxml->command-list (sxml-of self) (name-of self))) 
    111117  self) 
    112118 
     
    118124    (timeline . ,(serialize (timeline-of self))) 
    119125    (plain    . ,(vector->list (plain-of self))) 
    120     (rich     . ,(vector->list (rich-of self))))) 
     126    (rich     . ,(vector->list (rich-of self))) 
     127    (commands . ,(commands-of self)))) 
    121128 
    122129 
     
    127134    :timeline  (deserialize (make <oldtype-timeline>) (assq-ref internal-data 'timeline)) 
    128135    :plain     (list->vector (assq-ref internal-data 'plain)) 
    129     :rich      (list->vector (assq-ref internal-data 'rich)))) 
     136    :rich      (list->vector (assq-ref internal-data 'rich)) 
     137    :commands  (assq-ref internal-data 'commands))) 
    130138 
    131139 
     
    162170(define-method get-rich-list ((self <oldtype-page>)) 
    163171  (vector->list (rich-of self))) 
     172 
     173(define-method get-command-list ((self <oldtype-page>)) 
     174  (commands-of self)) 
    164175 
    165176 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/util.kahua

    r22008 r22567  
    471471             (img/ (@/ (src "http://d.hatena.ne.jp/images/b_entry_de.gif")))) 
    472472         (img/ (@/ (src (string-append "http://b.hatena.ne.jp/entry/image/http://" (oldtype:get-arguments 'fqdn) path))))))) 
     473 
     474 
     475(define (oldtype:reference-pages/ wikiname command-list) 
     476  (let1 ret  
     477        (map/ 
     478         (lambda (name) 
     479           (node-set/ 
     480            (text/ " ") 
     481            (a/ (@/ (href name)) 
     482                name))) 
     483         (reverse 
     484          (sort 
     485           (delete-duplicates 
     486            (filter-map 
     487             (lambda (x) 
     488               (if (eq? 'reference (car x)) 
     489                   (let ((from (caddr x)) 
     490                         (to   (cadr x))) 
     491                     (if (and (string=? wikiname to) 
     492                              (not (string=? from wikiname)) 
     493                              (not (string=? from "!RecentChanges")) 
     494                              (not (string=? from "!AllPages"))) 
     495                         from 
     496                         #f)) 
     497                   #f)) 
     498             command-list))))) 
     499        (if (null? ret) 
     500            (text/ "") 
     501            ret))) 
     502        
     503        
     504 
     505 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/version.kahua

    r21624 r22567  
    77 
    88;;--------------------------------------------------------- 
    9 (define *oldtype-version* "0.3.6") 
     9(define *oldtype-version* "0.3.7") 
  • lang/gauche/oldtype/trunk/bin/convert.sh

    r16043 r22567  
    66 
    77_oldtype_to() { 
    8     t=$1 
    9     src=$2 
    10     dst=$3 
    11     log=$4 
    12     ann=$5 
    13     ${OT_HOME}/src/oldtype_to ${t} ${src} ${log} ${ann} > ../_out/${base}.sexp.tmp 
     8    src=$1 
     9    log=$2 
     10    ann=$3 
     11    ${OT_HOME}/src/oldtype_to internal ${src} ${log} ${ann} > ../_out/${base}.sexp.tmp 
     12    ${OT_HOME}/src/oldtype_to commands ${src} ${log} ${ann} > ../_out/${base}.commands 
    1413 
    1514    if [ "$?" = "0" ] ; then 
     
    4241  base=`basename ${f} .ot` 
    4342  echo "[" ${base} "]" 
    44   _oldtype_to internal "${base}.ot" ../_out/${base}.sexp 
     43  _oldtype_to "${base}.ot" 
    4544done 
    4645 
     
    7473          logger "OldType: ${msg}" 
    7574      fi 
    76       _oldtype_to internal "${base}.ot" ../_out/${base}.sexp     ../_tmp/tmp.log ../_tmp/tmp.ann 
     75      _oldtype_to "${base}.ot"   ../_tmp/tmp.log ../_tmp/tmp.ann 
    7776  fi 
    7877done 
    7978 
     79# create _commands.sexp 
     80echo "(" > ../_out/__commands.sexp 
     81cat ../_out/*.commands >> ../_out/__commands.sexp 
     82echo ")" >> ../_out/__commands.sexp 
     83 
    8084popd 
  • lang/gauche/oldtype/trunk/command/blog

    r21133 r22567  
    11#!/usr/local/bin/gosh 
     2;;; 
     3;;; blog - generating blog aggregate page. 
     4;;; 
     5;;;  Copyright (c) 2008 Kiyoka Nishiyama, All rights reserved. 
     6;;; 
     7;;;  Permission is hereby granted, free of charge, to any person 
     8;;;  obtaining a copy of this software and associated documentation 
     9;;;  files (the "Software"), to deal in the Software without restriction, 
     10;;;  including without limitation the rights to use, copy, modify, 
     11;;;  merge, publish, distribute, sublicense, and/or sell copies of 
     12;;;  the Software, and to permit persons to whom the Software is 
     13;;;  furnished to do so, subject to the following conditions: 
     14;;; 
     15;;;  The above copyright notice and this permission notice shall be 
     16;;;  included in all copies or substantial portions of the Software. 
     17;;; 
     18;;;  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
     19;;;  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
     20;;;  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
     21;;;  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
     22;;;  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
     23;;;  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
     24;;;  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
     25;;;  IN THE SOFTWARE. 
    226 
    327(use srfi-1) 
  • lang/gauche/oldtype/trunk/src/Makefile

    r22411 r22567  
    3232        svn ann ../edit/Entry2.ot  > Entry2.ann.txt 
    3333 
     34reftest: 
     35        gosh -I ../Kahua/oldtype ../command/genref /Users/kiyoka/work/site-unstable 
    3436 
    3537svninfo: 
  • lang/gauche/oldtype/trunk/src/Test.no-timeline.sexp.master

    r22008 r22567  
    2727  (distribution)) 
    2828 (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "") 
    29  (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>")) 
     29 (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>") 
     30 (commands 
     31  (reference "Entry1" "Test") 
     32  ("Entry1") 
     33  (reference "Entry2" "Test") 
     34  ("Entry2"))) 
  • lang/gauche/oldtype/trunk/src/Test.sexp.master

    r22008 r22567  
    100100   (13304 2))) 
    101101 (plain "* UnitTest用のサンプルファイル" "----" "*** start" "*** Entry1" "*** Entry2" "*** end" "") 
    102  (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>")) 
     102 (rich "<h2>UnitTest用のサンプルファイル" "</h2><hr><h4>start" "</h4><h4>Entry1" "</h4><h4>Entry2" "</h4><h4>end" "</h4>") 
     103 (commands 
     104  (reference "Entry1" "Test") 
     105  ("Entry1") 
     106  (reference "Entry2" "Test") 
     107  ("Entry2"))) 
  • lang/gauche/oldtype/trunk/src/oldtype_to

    r22411 r22567  
    175175       (let* ( 
    176176              (sxml           (oldtype-parse input-port)) 
    177               (sexp           (oldtype:sxml->command-list sxml))) 
     177              (sexp           (oldtype:sxml->command-list sxml wikiname))) 
    178178         (pretty-print-sexp sexp))) 
    179179      (else