File: html_anchor.rb

package info (click to toggle)
tdiary 2.0.1-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,220 kB
  • ctags: 1,667
  • sloc: ruby: 20,044; lisp: 476; makefile: 91; sql: 32; sh: 31
file content (37 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# html_anchor $Revision: 1.4 $
#
# anchor: 󥫡YYYYMMDD.htmlסYYYYMM.html׷֤
#         tDiary鼫ưŪ˸ƤӽФΤǡץ饰ե
#         ֤Ǥ褤Υץ饰ͭ˻Ȥˤϡ
#         Web¦ѹɬסApacheȤ硢ʲ2Ĥ
#         ˡΤƤ롣
#
#         (1) mod_rewriteȹ碌Ѥ(侩)
#             : http://sho.tdiary.net/20020301.html#p04
#
#         (2) ErrorDocumentѤ
#             .htaccess˰ʲɲä(your_URL_of_index.rbϤʤ
#             index.rbURL)μˡϡWebФ
#             顼Ĥ夬Τǡ侩Ǥޤ󡣾mod_rewrite
#             ȤʤΤߤκǽʤǤ
#
#               <Files ~ "^([0-9]{4}|[0-9]{6}|[0-9]{8}).html$">
#                   ErrorDocument 404 your_URL_of_index.rb
#               </Files>
#
# Copyright (c) 2002 TADA Tadashi <sho@spc.gr.jp>
# Distributed under the GPL
#

def anchor( s )
	if /^(\d+)#?([pct]\d*)?$/ =~ s then
		if $2 then
			"#$1.html##$2"
		else
			"#$1.html"
		end
	else
		""
	end
end