summaryrefslogtreecommitdiff
path: root/lib/page_local.rb
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-12-23 15:02:32 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-12-23 21:11:29 -0500
commit4c3f03c1a7c622c3e92081664b42c96831b43dca (patch)
treea39fae944978c8886eaf06b7f1c23a63c5d1384e /lib/page_local.rb
parent3ca1e438fe602f3f03609ea6869b1de7a4091acc (diff)
Let LocalPage::load decide how to handle different file types
Diffstat (limited to 'lib/page_local.rb')
-rw-r--r--lib/page_local.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/page_local.rb b/lib/page_local.rb
index e13fa33..e956f6a 100644
--- a/lib/page_local.rb
+++ b/lib/page_local.rb
@@ -9,6 +9,18 @@ require 'pandoc'
require 'person'
class LocalPage < Page
+ def self.load(inpath)
+ case
+ when Dir::exist?(inpath)
+ require 'page_index'
+ return IndexPage::new(inpath)
+ when [".md", ".org"].include?(File::extname(inpath))
+ return LocalPage::new(inpath)
+ else
+ return nil
+ end
+ end
+
def initialize(infile)
@infile = infile
super()