|
|
|
@ -44,14 +44,11 @@ module Docs
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def name
|
|
|
|
|
@name || super.try(:demodulize)
|
|
|
|
|
@name || super.demodulize
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def slug
|
|
|
|
|
slug = @slug || (
|
|
|
|
|
raise "Slug must be set explicitly when name (#{name}) consists of anything else than [\\w\\.%]" if /[^\w\.%]/ =~ name
|
|
|
|
|
name.try(:downcase)
|
|
|
|
|
)
|
|
|
|
|
slug = @slug || default_slug || raise('slug is required')
|
|
|
|
|
version? ? "#{slug}~#{version_slug}" : slug
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -119,6 +116,11 @@ module Docs
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def default_slug
|
|
|
|
|
return if name =~ /[^A-Za-z0-9_]/
|
|
|
|
|
name.downcase
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def store_page?(page)
|
|
|
|
|
page[:entries].present?
|
|
|
|
|
end
|
|
|
|
|