Module: Pekky::Format::Util
- Defined in:
- lib/pekky/format.rb
Overview
Util contains helper methods that don’t fit anywhere else.
Class Method Summary collapse
-
.look_up_page(url) ⇒ Object
Looks up a page based on a pekky URL.
-
.qualify_path(path) ⇒ Object
Qualify path adds a prefix to URLs on export.
Class Method Details
.look_up_page(url) ⇒ Object
Looks up a page based on a pekky URL.
232 233 234 235 |
# File 'lib/pekky/format.rb', line 232 def self.look_up_page(url) match = url.match(/^pekky:\/\/(\S+)/) qualify_path(Pekky.tree[match[1].to_sym].path) end |
.qualify_path(path) ⇒ Object
Qualify path adds a prefix to URLs on export.
238 239 240 241 242 243 244 |
# File 'lib/pekky/format.rb', line 238 def self.qualify_path(path) if !path.match(/^http/) and Pekky.exporting? and Config[:path_prefix] File.join(Config[:path_prefix], path) else path end end |