" vim:set ts=8 sts=2 sw=2 tw=0: " " itmedia.vim - ITmedia plugin for headline.vim " " Maintainer: MURAOKA Taro " Last Change: 12-Apr-2004. scriptencoding cp932 " for ITmedia let g:headlineList = g:headlineList."\ITmedia" let g:headlineUrl_ITmedia = 'http://www.itmedia.co.jp/news/bursts/' let g:headlineName_ITmedia = 'ITmedia' function! s:TimeConvert(time) let mx1 = '.*\d\+\.\d\+\.\d\+\.\s\(\d\+\):\(\d\+\)\(a\|p\)m.*' let mx2 = '.*\d\+\.\d\+\.\d\+\D\+\(\d\+\):\(\d\+\)' let h = '0' let m = '00' if a:time =~ mx1 let h = substitute(AL_sscan(a:time, mx1, '\1'), '^0\+', '', '') % 12 let m = AL_sscan(a:time, mx1, '\2') let p = AL_sscan(a:time, mx1, '\3') if p ==# 'p' let h = h + 12 endif elseif a:time =~ mx2 let h = substitute(AL_sscan(a:time, mx2, '\1'), '^0\+', '', '') let m = AL_sscan(a:time, mx2, '\2') endif if h < 10 let h = '0'.h endif return h.':'.m endfunction function! s:Nr2(nr) let nr = substitute(a:nr, '^0\+', '', '') if (nr + 0) < 10 return '0' . (nr + 0) else return nr endif endfunction function! s:DatetimeConvert(datetime) let mx = '\(\d\+\)\.\(\d\+\)\.\(\d\+\)\D\+\(\d\+\):\(\d\+\)' let day = '' let day = day . AL_sscan(a:datetime, mx, '\1') . '/' let day = day . s:Nr2(AL_sscan(a:datetime, mx, '\2')) . '/' let day = day . s:Nr2(AL_sscan(a:datetime, mx, '\3')) . ' ' let day = day . s:Nr2(AL_sscan(a:datetime, mx, '\4')) . ':' let day = day . s:Nr2(AL_sscan(a:datetime, mx, '\5')) return day endfunction function! HeadlineFormat_ITmedia() let b:headlineLabelPickupNo = 1 "let head = '\c\(\d\+年\d\+月\d\+日\)<\/B>
' " Obtain topnews let save_reg = @" let @" = save_reg " Format headlines silent! g//,// join silent! v//d _ call AL_execute('%s/\m\c]*>(\d/ join silent! v/^____/d _ silent! %s/\c]*>//g silent! %s/\c<[\/]*FONT[^>]*>//g silent! %s/\c
//g silent! %s/\c^____
]*>\([^<]\+\)<\/a>.*[\([0-9\/ :]*\)\].*/\=g:headlineMarkCategory . substitute(submatch(3), '\([^\s]\+\) .*', '\1', '') . "\n" . HeadlineFormatLine(submatch(2), submatch(1), substitute(submatch(3), '.* \(.*\)', '\1', ''))/i silent! g/\c^____/d _ "call AL_execute('%s/\m^ \(\d\d\d\d\/\d\d\/\d\d\) \(\d\d\:\d\d.*\)/'.g:headlineMarkCategory.'\1\r \2/g') "call s:UniqueLines('^'.g:headlineMarkCategory.'\(\d\+\)/\(\d\+\)/\(\d\+\)$') call s:UniqueLines('^'.g:headlineMarkCategory.'\(\d\+\)/\(\d\+\)$') endfunction function! s:UniqueLines(pat) let mx = a:pat let pos = 1 while 1 call cursor(pos, 0) if getline('.') =~ mx let ret = 1 else let ret = search(mx, 'W') endif if ret == 0 break endif let pos = line('.') let dat = getline('.') silent! exec pos+1 . ",$g/^" . escape(dat, '/') . '$/delete _' if line('.') >= line('$') break endif let pos = pos + 1 endwhile endfunction