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
|
# File 'lib/textigniter/plugins/slug.rb', line 3
def parse(h)
value = h['slug']
values = value.split(/\//)
filename = values.last
values.pop
valid = Date.parse(filename[0..9]) rescue false
if valid != false
slug = "#{values.join('/')}/#{filename.gsub(filename[0..9] + "-", '')}"
else
slug = value
end
slug = "#{$owd}/#{slug}" unless slug.include? $twd
slug = slug.sub('index', '')
slug = slug.sub("#{$twd}/content", "#{$owd}")
return slug
end
|