Show
Ignore:
Timestamp:
10/23/07 08:49:06 (6 years ago)
Author:
cho45
Message:

lang/vim/blosxom.vim.cgi/blosxom.vim.cgi,
lang/vim/blosxom.vim.cgi/head.html,
lang/vim/blosxom.vim.cgi:

PATH_INFO によるフィルタを実装

Location:
lang/vim/blosxom.vim.cgi
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/vim/blosxom.vim.cgi/blosxom.vim.cgi

    r622 r623  
    3232endfunction 
    3333 
    34 call Template("head.html", {"title": "This is Vim."}) 
     34call Template("head.html", {"title": "This is Vim.", "home": $SCRIPT_NAME}) 
    3535 
    3636 
     
    4343call Inspect($PATH_INFO) 
    4444call Inspect($SCRIPT_NAME) 
     45 
     46 
    4547call Out(strftime("%Y-%m-%d %H:%M:%S\n")) 
     48 
     49 
     50function FilteringByPathInfo(entries) 
     51        let pathinfo = split($PATH_INFO, "/") 
     52        call Inspect(pathinfo) 
     53        if len(pathinfo) > 0 
     54                call Inspect(str2nr(pathinfo[0])) 
     55                if str2nr(pathinfo[0]) == 0 
     56                        call Inspect("path") 
     57                        call filter(a:entries, '!match(v:val["name"], "^'.$PATH_INFO.'")') 
     58                else 
     59                        "call Inspect('strftime("%Y", v:val["time"]) == '.string(pathinfo[0])) 
     60                        call filter(a:entries, 'strftime("%Y", v:val["time"]) == '.string(pathinfo[0])) 
     61                        if len(pathinfo) > 1 
     62                                call filter(a:entries, 'strftime("%m", v:val["time"]) == '.string(pathinfo[1])) 
     63                                if len(pathinfo) > 2 
     64                                        call filter(a:entries, 'strftime("%d", v:val["time"]) == '.string(pathinfo[2])) 
     65                                end 
     66                        endif 
     67                endif 
     68        endif 
     69endfunction 
     70 
    4671let files = split(glob("data/**/*.txt"), "\n") 
    4772let entries = sort(map(files, '{"path": v:val, "time": getftime(v:val)}'), "CompareByTime") 
     
    5479        let ent["home"] = $SCRIPT_NAME 
    5580        let ent["path"] = join(split(ent["home"], "/")[0:-1], "/") 
    56         " call Out(ent["title"] . " " . ent["path"] . "\n") 
     81endfor 
     82 
     83call FilteringByPathInfo(entries) 
     84 
     85for ent in entries 
    5786        call Template("story.html", ent) 
    5887endfor 
  • lang/vim/blosxom.vim.cgi/head.html

    r621 r623  
    22<html xmlns="http://www.w3.org/1999/xhtml"> 
    33        <head> 
    4                 <title></title> 
     4                <title>#{title}</title> 
    55                <style type="text/css"> 
    66                        body { 
     
    6161        <body> 
    6262                <div id="whole"> 
    63                         <h1 id="top"><a href="/">#{title}</a></h1> 
     63                        <h1 id="top"><a href="#{home}/">#{title}</a></h1> 
    6464 
    6565                        <div id="content">