Module: JekyllBasenameDirnameName
- Defined in:
- lib/jekyll_basename_dirname.rb
Overview
Jekyll filters for working with paths.
Constant Summary collapse
- PLUGIN_NAME =
'jekyll_basename_dirname'.freeze
Instance Method Summary collapse
-
#basename(filepath) ⇒ String
Filters a string containing a path.
-
#basename_without_extension(filepath) ⇒ Object
Filters a string containing a path.
-
#dirname(filepath) ⇒ String
Filters a string containing a path.
-
#wbr(filepath) ⇒ Object
Filters a string containing a path so long paths wrap in an HTML page.
Instance Method Details
#basename(filepath) ⇒ String
Filters a string containing a path.
18 19 20 |
# File 'lib/jekyll_basename_dirname.rb', line 18 def basename(filepath) File.basename(filepath) end |
#basename_without_extension(filepath) ⇒ Object
Filters a string containing a path.
34 35 36 |
# File 'lib/jekyll_basename_dirname.rb', line 34 def basename_without_extension(filepath) File.basename(filepath).split('.')[0...-1].join('.') end |
#dirname(filepath) ⇒ String
Filters a string containing a path.
26 27 28 |
# File 'lib/jekyll_basename_dirname.rb', line 26 def dirname(filepath) File.dirname(filepath) end |
#wbr(filepath) ⇒ Object
Filters a string containing a path so long paths wrap in an HTML page. Returns:
blah/<wbr>/blah/<wbr>filename.ext
44 45 46 |
# File 'lib/jekyll_basename_dirname.rb', line 44 def wbr(filepath) filepath.gsub '/', '/<wbr>' end |