-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob McGrail
committed
Oct 17, 2012
1 parent
1ca22ea
commit 84c40fa
Showing
15 changed files
with
140 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
EZP_ICON_BINARY_EXTENSIONS = %w[doc docx mp3 pdf ppt pps ppsx pptx rtf wav xls xlsx zip pub] | ||
EZP_ICON_BINARY_EXTENSIONS = %w[doc docx mp3 pdf ppt pps ppsx pptx rtf wav xls xlsx zip pub rar] | ||
EZP_ICON_IMAGE_EXTENSIONS = %w[jpg jpeg gif bmp png] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
module IncludeOrPage | ||
def page?(path) | ||
# if path =~ /.html$/ | ||
# raise UnexpectedPagelikeFile, 'Encountered an .html path, but only expect .htm.' | ||
# end | ||
|
||
path =~ /.(htm|html)$/ ? true : false | ||
if path =~ /.(htm|html)$/ | ||
if path !~ /index\.(htm|html)$/ | ||
true | ||
else | ||
false | ||
end | ||
else | ||
if ::File.exists?(path + '/index.htm') | ||
true | ||
else | ||
false | ||
end | ||
end | ||
end | ||
|
||
|
||
def include?(path) | ||
path =~ /.cfm$/ ? true : false | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module IsARedirect | ||
def redirect?(path) | ||
str = StringFromPath.get_case_insensitive(path) | ||
doc = Nokogiri::HTML(str) | ||
|
||
if doc.xpath("//cfheader[@statuscode='301']") | ||
# Return the destination. | ||
doc.xpath("//cfheader[@name='Location']").first[:value] | ||
else | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module EzPub | ||
class Redirect < EzPub::Handler | ||
EzPub::HandlerSets::All << self | ||
EzPub::HandlerSets::Content << self | ||
|
||
extend IsARedirect | ||
|
||
# Identifying redirects, and then ignore them. | ||
# Runs before content classes so they don't have to deal | ||
# with this nonsense. | ||
|
||
def self.priority | ||
1 | ||
end | ||
|
||
|
||
def self.mine?(path) | ||
# Check it's a page. | ||
if page?(path) | ||
# Check if it's a redirect. | ||
if redirect?(path) | ||
true | ||
else | ||
false | ||
end | ||
else | ||
false | ||
end | ||
end | ||
|
||
|
||
def self.store(path) | ||
Logger.warning path 'ignored redirect', 'shhh' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ImportPathHelper | ||
def trim_for_ezp(path) | ||
path.gsub(/^\.\//, '') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters