From 4c3f03c1a7c622c3e92081664b42c96831b43dca Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 23 Dec 2017 15:02:32 -0500 Subject: Let LocalPage::load decide how to handle different file types --- lib/page_local.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/page_local.rb') 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() -- cgit v1.2.3 From efbd3731c986a8555869c184cda69ff9b910ce9f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 23 Dec 2017 15:52:22 -0500 Subject: pdf support --- lib/page_local.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/page_local.rb') diff --git a/lib/page_local.rb b/lib/page_local.rb index e956f6a..6c70ac3 100644 --- a/lib/page_local.rb +++ b/lib/page_local.rb @@ -16,6 +16,9 @@ class LocalPage < Page return IndexPage::new(inpath) when [".md", ".org"].include?(File::extname(inpath)) return LocalPage::new(inpath) + when ".pdf" == File::extname(inpath) + require 'page_pdf' + return PdfPage::new(inpath) else return nil end -- cgit v1.2.3