Redo and add more documentation to gh-pages.
This commit is contained in:
parent
80fed15dd3
commit
3ce622a106
16 changed files with 530 additions and 23 deletions
15
docs/plugins/wintersmith-makerelative.coffee
Normal file
15
docs/plugins/wintersmith-makerelative.coffee
Normal file
|
@ -0,0 +1,15 @@
|
|||
module.exports = (env, callback) ->
|
||||
count = (string, substr) ->
|
||||
num = pos = 0
|
||||
return 1/0 unless substr.length
|
||||
num++ while pos = 1 + string.indexOf(substr, pos)
|
||||
num
|
||||
|
||||
env.helpers.makeRelative = (source, dest) ->
|
||||
return dest unless dest.indexOf("/") == 0
|
||||
depth = count(source, '/') # 1 being /
|
||||
ret = ""
|
||||
ret += "../" while depth = depth - 1
|
||||
ret + dest.substr(1)
|
||||
|
||||
callback()
|
Loading…
Add table
Add a link
Reference in a new issue