Changeset 26408 for lang/gauche

Show
Ignore:
Timestamp:
12/11/08 21:33:27 (4 years ago)
Author:
kiyoka
Message:

Added feature : Dynamic CSS generation. (oldtype.css)

Location:
lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/oldtype-css.kahua

    r24661 r26408  
    2424 
    2525 
    26 ;; define elements for RSS 2.0 
    27 (define-elements channel rss description lastBuildDate docs generator item pubDate author guid atom:link) 
    28  
    29 ;; get-rss entry 
    30 (define (gen-rss/ base-url index-page entry-pages) 
    31   (let* ((wikiname       (name-of index-page)) 
    32          (entry-pages    (if (null? entry-pages) 
    33                              (list index-page) 
    34                              entry-pages)) 
    35          (build-date-utc 
    36           (last 
    37            (sort 
    38             (map 
    39              (lambda (e) 
    40                (utc-of 
    41                 (get-latest-log 
    42                  (timeline-of e)))) 
    43              entry-pages)))) 
    44          (build-date-utc 
    45           (- build-date-utc (* 60 5))))  ;; build date is 5 minutes ago from latest entry 
    46     (rss/ (@/ (version "2.0") 
    47               (xmlns:atom "http://www.w3.org/2005/Atom")) 
    48           (channel/ 
    49            (atom:link/ 
    50             (@/ (href (string-append base-url "get-rss/" wikiname)) 
    51                 (rel  "self") 
    52                 (type "application/rss+xml"))) 
    53            (title/                (string-append wikiname "::" (oldtype-first-line index-page))) 
    54            (link/                 (string-append base-url "show-page/" wikiname)) 
    55            (description/          (oldtype-first-line index-page)) 
    56            (lastBuildDate/        (oldtype:utc->RFC822-date-string build-date-utc)) 
    57            (docs/                 "http://blogs.law.harvard.edu/tech/rss") 
    58            (generator/            (string-append "OldType version " *oldtype-version*)) 
    59            (map/ 
    60             (lambda (e) 
    61               (let* ((timeline (timeline-of e)) 
    62                      (lineno   (- (last (get-latest-lines timeline)) 5)) 
    63                      (uri       
    64                       (string-append base-url "show-page/" (uri-encode-string (name-of e)) 
    65                                      (if (< 1 lineno) 
    66                                          (string-append "#" (number->string lineno)) 
    67                                          "")))) 
    68                 (item/ 
    69                  (title/            (string-append (name-of e) "::" (oldtype-first-line e))) 
    70                  (description/ 
    71                   (string-append 
    72                    "<pre>" 
    73                    (string-join (get-rich-list e) "\n") 
    74                    "</pre>")) 
    75                  (link/             uri) 
    76                  (guid/             uri) 
    77                  (pubDate/          (oldtype:utc->RFC822-date-string 
    78                                      (utc-of 
    79                                       (get-latest-log timeline)))) 
    80                  (author/       (committer-of (get-latest-log timeline)))))) 
    81             entry-pages) 
    82            )))) 
    83  
    84  
    85 (define-entry (get-rss wikiname) 
    86   (let1 oldtype-page (oldtype:load-page (kahua-site-root) wikiname) 
    87         (when/ oldtype-page 
    88                (gen-rss/  
    89                 (format "http://~a/" (oldtype:get-arguments 'fqdn)) 
    90                 oldtype-page 
    91                 (filter-map 
    92                  (lambda (x) 
    93                    (oldtype:load-page (kahua-site-root) (cdr x))) 
    94                  (get-rss-entry-pages oldtype-page)))))) 
     26;; 
     27;;   `((css 
     28;;      (:class status-completed 
     29;;       (background-color "rgb(231,231,231)")) 
     30;; 
     31;;      (:class status-open 
     32;;       (background-color "rgb(255, 225, 225)"))))) 
     33;; 
     34;; (head/ (link/ (@/ (rel "stylesheet") (type "text/css") 
     35;;        (href (kahua-self-uri-full "test.css"))))) 
     36(define-entry (oldtype.css) 
     37  `((css 
     38     (body 
     39      (font-family "Optima, Tahoma, arial, 'ヒラギノ角ゴ Pro W3', 'ヒラギノ角ゴ3', sans-serif") 
     40      (margin-right "1em") 
     41      (margin-left  "1em") 
     42      (line-height "150%") 
     43      (background-color "white") 
     44      (color "#111122")) 
     45      
     46     (p 
     47      (margin-left "2em")) 
     48      
     49     (:class small) 
     50 
     51     (p.short-note 
     52      (font-size "small")) 
     53      
     54     (p.foottext 
     55      (text-indent "0") 
     56      (font-size "small")) 
     57      
     58     (sup 
     59             (font-size "small")) 
     60 
     61     (small.gray 
     62             (color "#888888")) 
     63 
     64     ("submit, select, checkbox, input, textarea" 
     65      (text-indent "0") 
     66      (border "1px solid #aaaaaa")) 
     67 
     68     (address 
     69      (font-family "'Lucida Sans Unicode'") 
     70      (font-size "smaller") 
     71      (text-align "right")) 
     72 
     73     (dl 
     74             (margin-left "1.5em")) 
     75 
     76     (dt 
     77      (color "black") 
     78             (font-weight "medium")) 
     79 
     80     (p.noindent 
     81      (text-indent "0em")) 
     82 
     83     (p.center 
     84             (text-indent "0em") 
     85             (text-align "center")) 
     86 
     87     (p.right 
     88             (text-indent "0em") 
     89             (text-align "right")) 
     90 
     91     (p.last-modified  
     92             (text-align "center") 
     93             (color "#ee7600") 
     94             (text-indent "0em") 
     95             (font-size "smaller") 
     96             (font-weight "bold")) 
     97 
     98     (p.lang-navigator  
     99             (text-align "right") 
     100             (font-size "smaller")) 
     101 
     102     (strong  
     103             (color "black") 
     104             (font-weight "medium")) 
     105 
     106     (strong.new  
     107             (font-size "smaller") 
     108             (color "#aa4444") 
     109             (font-style "italic")) 
     110 
     111     (strong.caption  
     112             (font-size "smaller") 
     113             (padding "0.1em") 
     114             (font-weight "bold") 
     115             (border-style "solid") 
     116             (border-width "0 0 1px 0")) 
     117 
     118     ("strike, del" 
     119      (color "#aaaaaa")) 
     120      
     121     ("blockquote p" 
     122      (text-indent "0") 
     123      (margin "0") 
     124      (padding "0")) 
     125      
     126     ("pre, code" 
     127      (font-family "'ヒラギノ角ゴ3等幅', 'Lucida Console', 'Courier', 'Courier New', monospace")) 
     128      
     129     (pre  
     130             (font-size "small") 
     131             (line-height "115%") 
     132             (white-space "pre-wrap") 
     133             (width "100%") 
     134             (overflow "auto") 
     135             (margin-left "4em")) 
     136 
     137     (h1 
     138             (text-align "center") 
     139             (font-size "xx-large") 
     140             (font-weight "normal") 
     141             (font-family "Optima, Tahoma, 'ヒラギノ角ゴ Pro W3', 'ヒラギノ角ゴ3', arial, serif") 
     142             (padding "0.4em 0.4em") 
     143             (line-height "150%")) 
     144 
     145     (h2  
     146             (clear "both") 
     147             (font-size "x-large")) 
     148 
     149     (h3  
     150             (clear "both") 
     151             (font-size "large")) 
     152 
     153     ("h2, h3, h4, h5, h6" 
     154      (font-weight "normal") 
     155      (font-family "Optima, Tahoma, 'ヒラギノ角ゴ Pro W6', 'ヒラギノ角ゴ6', arial, serif")) 
     156 
     157     ("h1, h2, h3" 
     158             (border-style "solid") 
     159             (border-color "#8888bb") 
     160             (border-width "0 0 1px 0")) 
     161 
     162     ("h2, h3, h4, h5, h6" 
     163             (padding "0.15em") 
     164             (text-indent "0.25em") 
     165             (margin-top "    0.4em") 
     166             (margin-bottom " 1px")) 
     167 
     168     (a  
     169             (text-decoration "none")) 
     170 
     171     (a:link  
     172             (color "#4444ff")) 
     173 
     174 
     175 
     176     (a:visited  
     177             (color "#8848d8")) 
     178 
     179     ("a:active, a:focus, a:hover" 
     180             (text-decoration "underline")) 
     181 
     182     (li  
     183             (margin-left "0.75em") 
     184             (line-height "150%") 
     185             (padding-top "0.25em")) 
     186 
     187     ("ul li" 
     188             (list-style-type "disc")) 
     189 
     190     (hr  
     191             (margin-left "0") 
     192             (text-align "left") 
     193             (border-color "#8888bb") 
     194             (border-style "dotted none none none") 
     195             (border-width "thin") 
     196             (height "1em") 
     197             (width " 80%")) 
     198 
     199     (div.footer  
     200             (padding-top "1.5em") 
     201             (border-color "#8888bb") 
     202             (border-style "dotted none none none") 
     203             (border-width "1px") 
     204             (text-align "center") 
     205             (font-size "smaller") 
     206             (line-height "0em")) 
     207 
     208     (p.figure  
     209             (text-indent "0em") 
     210             (text-align "center") 
     211             (margin-top "0.25ex") 
     212             (margin-bottom "0")) 
     213 
     214     (kbd  
     215             (border-style "solid") 
     216             (border-width "1px 2px 2px 1px") 
     217             (border-color "gray") 
     218             (font-family "monospace") 
     219             (margin "2px") 
     220             (padding-left "4px") 
     221             (padding-right "4px") 
     222             (white-space "nowrap")) 
     223 
     224     (img  
     225             (border-style "none") 
     226             (border-width "0px")) 
     227 
     228     (img.icon  
     229             (vertical-align "text-bottom") 
     230             (width "1.3em") 
     231             (height "1.3em")) 
     232 
     233     (img.wideicon  
     234             (vertical-align "text-bottom") 
     235             (width "2.6em") 
     236             (height "1.3em")) 
     237      
     238     (img.logo  
     239             (float "left") 
     240             (padding-left " 0em") 
     241             (padding-right "1em")) 
     242      
     243     (img.barcode  
     244             (border-style "solid") 
     245             (border-width "0px 0px 2px 0px")) 
     246     (img.figure  
     247             (margin "1em")) 
     248 
     249     (img.art  
     250             (padding "1em")) 
     251 
     252     (img.mini  
     253             (border-style "solid") 
     254             (border-width "1px") 
     255             (width "256px") 
     256             (padding "0.5em")) 
     257 
     258     (a.navi   
     259             (font-size "small") 
     260             (border-style "solid") 
     261             (border-width " 1px 2px 2px 1px") 
     262             (padding "1px 4px 1px 4px") 
     263             (border-color "#6666ff") 
     264             (font-weight "bold") 
     265             (text-decoration "none")) 
     266      
     267     (a.navi:hover  
     268             (background-color "#ddddff")) 
     269 
     270     (a.navi:visited  
     271             (color "#aa55cc")) 
     272 
     273     (img.frame  
     274             (margin " 4px") 
     275             (padding "4px") 
     276             (border-style "none") 
     277             (background-color "white") 
     278             (border-width "0") 
     279             (border-color "#444488") 
     280             (border-style "solid") 
     281             (border-width "1px 1px 1px 1px")) 
     282      
     283     (p.art  
     284             (border-style "solid") 
     285             (text-align "center") 
     286             (padding "2em") 
     287             (border-color "#888888") 
     288             (border-width "1px") 
     289             (margin-left "15%") 
     290             (margin-right "15%")) 
     291 
     292     (strong.art  
     293             (padding "0.2em") 
     294             (font-weight "bold") 
     295             (border-style "solid") 
     296             (color "#222222") 
     297             (border-color "black") 
     298             (border-width "0 0 1px 0")) 
     299      
     300     (table  
     301             (font-size "smaller") 
     302             (border-color "#cccccc") 
     303             (border-width "1px") 
     304             (margin-left "4em") 
     305             (margin-bottom "0.5em") 
     306             (margin-top "0.5em") 
     307             (border-collapse "collapse")) 
     308 
     309     (table.searchbox  
     310             (background-color "#cccccc")) 
     311 
     312 
     313     ("th, tr, td" 
     314             (border-style "solid") 
     315             (border-color "#cccccc") 
     316             (border-width "1px") 
     317             (padding "4px") 
     318             (line-height "120%")) 
     319 
     320     (th  
     321             (background-color "#e2e2e2")) 
     322 
     323     (tr.odd  
     324             (background-color "#ffffff")) 
     325 
     326     (tr.even  
     327             (background-color "#f7f7f7")) 
     328 
     329     (div.comment  
     330             (margin-left "15%") 
     331             (text-align "left") 
     332             (font-size "smaller")) 
     333 
     334     (div.calendar  
     335             (font-size "smaller")) 
     336 
     337     (div.adminmenu  
     338             (text-align "right") 
     339             (font-size "smaller")) 
     340      
     341     (div.referer  
     342             (text-align "right") 
     343             (font-size "smaller")) 
     344 
     345     (hr.sep  
     346             (border-style "none") 
     347             (height "0px") 
     348             (clear "none")) 
     349 
     350     ("div.day h2, h3" 
     351             (font-size "medium")) 
     352 
     353     ("div.day h4" 
     354             (font-size "small")) 
     355      
     356     (p.rss  
     357             (text-indent "0em") 
     358             (text-align "right")) 
     359     ("p.rss a" 
     360             (color "#333344") 
     361             (font-weight "bold")) 
     362     ("span.date a" 
     363             (color "#333344")) 
     364     ("span.label" 
     365             (color "white") 
     366             (background-color "#3875d7")) 
     367 
     368     (span.you  
     369             (background-color "#e6e6fa") 
     370             (padding-left "3px") 
     371             (padding-right "3px") 
     372             (margin "2px")) 
     373 
     374     (span.prev  
     375             (text-align "left")) 
     376 
     377     (span.next  
     378             (text-align "right")) 
     379 
     380     (div.ad  
     381             (border "0px") 
     382             (margin-left "2em") 
     383             (margin-top "1em")) 
     384      
     385     (div.day  
     386             (margin-right "25%")) 
     387 
     388     (hr.sep  
     389             (margin-right "25%")) 
     390      
     391     (div.body pre  
     392             (margin-right "25%")) 
     393 
     394     (div.footer  
     395             (clear "both")) 
     396 
     397     ("div.sidebar form" 
     398             (margin-left "0.5em")) 
     399     ("div.sidebar input" 
     400             (margin "0.1em")) 
     401     ("div.sidebar p" 
     402                  (text-indent "0.25em")) 
     403     ("div.sidebar ul" 
     404             (margin-left "1em") 
     405             (padding "0")) 
     406     ("div.sidebar ol" 
     407             (margin-left "1em") 
     408             (padding "0.5em")) 
     409     ("div.sidebar h2, div.sidebar h3" 
     410             (font-size "small")) 
     411     ("div.sidebar" 
     412             (background-color "white") 
     413             (width "25%") 
     414             (font-size "smaller") 
     415             (border-style "solid") 
     416             (border-color "#dddddd") 
     417             (border-width "0 0 0 1px") 
     418             (margin-right "2%") 
     419             (float "right")) 
     420 
     421     (div.main  
     422             (width "70%") 
     423             (margin-right "2%") 
     424             (float "left") 
     425             (clear "both")) 
     426 
     427     ("div.break p" 
     428             (margin "0.5em 0.5em 0em 1em") 
     429             (line-height "1.5em")) 
     430 
     431     ("div.break strong" 
     432             (color "#27408b")) 
     433 
     434     (div.break  
     435             (margin "1em 1em 1em 8em") 
     436             (padding "0.5em") 
     437             (border-style "solid") 
     438             (border-width "1px") 
     439             (border-color "#104e8b") 
     440             (margin-right "2%") 
     441             (font-size "smaller") 
     442             (color "#333333") 
     443             (background-color "#ddddff")) 
     444 
     445     (p.oldtype  
     446             (margin-left "0.5em") 
     447             (margin-top "1px") 
     448             (margin-bottom "1px")) 
     449 
     450     (pre.verb  
     451             (color "#333333") 
     452             (background-color "#c6c7d3") 
     453             (padding-top "0.0em") 
     454             (padding-bottom "0.0em") 
     455             (padding "0.0em") 
     456             (border "0px inset #885") 
     457             (white-space "pre-wrap") 
     458             (margin-top "0px") 
     459             (margin-bottom "0px") 
     460             (margin-left "2em")) 
     461 
     462     (pre.quote  
     463             (margin-top "0.0em") 
     464             (margin-bottom "0.0em") 
     465             (margin "0.0em") 
     466             (border "0px inset #885") 
     467             (white-space "pre-wrap") 
     468             (margin-top "1px") 
     469             (margin-bottom "1px") 
     470             (margin-left "2em") 
     471             (text-indent "1em")) 
     472 
     473     ("pre.ul1 pre.ul2 pre.ul3   pre.ol1 pre.ol2 pre.ol3" 
     474             (font-size "medium") 
     475             (padding-left "  1.5em") 
     476             (margin-top "    1px") 
     477             (margin-bottom " 1px")) 
     478 
     479     (pre.ul1  
     480             (margin-left "0.5em") 
     481             (background-image "url(staticimg/dot18.png)") 
     482             (background-repeat "no-repeat") 
     483             (font-size "medium") 
     484             (padding-left  "1.5em") 
     485             (margin-top    "1px") 
     486             (margin-bottom "1px")) 
     487      
     488     (pre.ul2  
     489             (margin-left "2.0em") 
     490             (background-image "url(staticimg/dot14.png)") 
     491             (background-repeat "no-repeat") 
     492             (font-size "medium") 
     493             (padding-left  "1.5em") 
     494             (margin-top    "1px") 
     495             (margin-bottom "1px")) 
     496      
     497     (pre.ul3  
     498             (margin-left "3.5em") 
     499             (background-image "url(staticimg/dot12.png)") 
     500             (background-repeat "no-repeat") 
     501             (font-size "medium") 
     502             (padding-left "1.5em") 
     503             (margin-top "1px") 
     504             (margin-bottom "1px")) 
     505 
     506     (pre.ol1  
     507             (margin-left "0.5em") 
     508             (background-image "url(staticimg/triangle18.png)") 
     509             (background-repeat "no-repeat") 
     510             (font-size "medium") 
     511             (padding-left "1.5em") 
     512             (margin-top "1px") 
     513             (margin-bottom "1px")) 
     514      
     515     (pre.ol2  
     516             (margin-left "2.0em") 
     517             (background-image "url(staticimg/triangle14.png)") 
     518             (background-repeat "no-repeat") 
     519             (font-size "medium") 
     520             (padding-left "1.5em") 
     521             (margin-top "1px") 
     522             (margin-bottom "1px")) 
     523      
     524     (pre.ol3  
     525             (margin-left "3.5em") 
     526             (background-image "url(staticimg/triangle12.png)") 
     527             (background-repeat "no-repeat") 
     528             (font-size "medium") 
     529             (padding-left "1.5em") 
     530             (margin-top "1px") 
     531             (margin-bottom "1px")) 
     532      
     533 
     534     ;; [red] 
     535     ;; ff0000; 
     536     ;; ff1919; 
     537     ;; ff3333; 
     538     ;; ff4d4d; 
     539     ;; ff6666; 
     540     ;; ff8080; 
     541     ;; ff9999; 
     542     ;; ffb2b2; 
     543     ;; ffcccc; 
     544     (b.here  
     545             (color "#FFFFFF") 
     546             (background-color "#000000")) 
     547 
     548     (strong.notice  
     549             (background-color "#3875d7") 
     550             (color "white")) 
     551 
     552     (pre.comment  
     553             (margin-left  "0.5em") 
     554             (font-size     "medium") 
     555             (padding-left  "0.5em") 
     556             (margin-top    "1px") 
     557             (margin-bottom "1px")) 
     558 
     559     (p.comment  
     560             (margin-left "0.5em") 
     561             (font-size "medium") 
     562             (padding-left "0.5em") 
     563             (margin-top "1px") 
     564             (margin-bottom "1px")) 
     565 
     566     (table.comment  
     567             (width "70%") 
     568             (text-align "left")) 
     569 
     570 
     571     (td.header_L  
     572             (border-style "solid") 
     573             (border-color "#ffffff") 
     574             (border-width "1px") 
     575             (align "left")) 
     576 
     577 
     578     (td.header_R  
     579             (border-style "solid") 
     580             (border-color "#ffffff") 
     581             (border-width "1px") 
     582             (align "right")) 
     583 
     584 
     585     (a.large  
     586             (font-size "large")) 
     587 
     588     (a.normal  
     589             (font-size "normal")) 
     590 
     591     (a.small  
     592             (font-size "small"))))) 
  • lang/gauche/oldtype/trunk/Kahua/oldtype/oldtype/oldtype.kahua

    r24660 r26408  
    2121(load "oldtype/util.kahua") 
    2222(load "oldtype/oldtype-rss.kahua") 
     23(load "oldtype/oldtype-css.kahua") 
    2324(use util.list) 
    2425(use util.match) 
     
    280281  (html/ (head/ (title/ (string-append wikiname " / " first-line)) 
    281282                (link/ (@/ (rel "stylesheet") (type "text/css") 
    282                            (href (string-append "/kahua/" (kahua-worker-type) "/oldtype.css")))) 
     283                           (href "/oldtype.css"))) 
    283284                (link/ (@/ (rel "stylesheet") (type "text/css") 
    284285                           (href (string-append "/kahua/" (kahua-worker-type) "/import/tooltips.css"))))