class << self

Definitions

def encode_path(path)

Encode a presentation-relative path while preserving its directory structure.

Signature

parameter path String

A path relative to the slides root.

returns String

The URL-encoded path.

Implementation

def encode_path(path)
	components = path.split(File::SEPARATOR)
	Protocol::URL::Path.for(components, encoding: Protocol::URL::Encoding::System).to_s
end

def discover(root, slides)

Discover stylesheets in the order they should enter the cascade.

Signature

parameter root String

The presentation slides root.

parameter slides Array(Slide)

The ordered presentation slides.

returns Array(Stylesheet)

The discovered stylesheets.

Implementation

def discover(root, slides)
	root = File.expand_path(root)
	stylesheets = {}
	
	add(stylesheets, root, STYLE_NAME, nil)
	
	slides.each do |slide|
		directory = File.dirname(slide.path)
		
		unless directory == "."
			components = directory.split(File::SEPARATOR)
			components.each_index do |index|
				path = File.join(*components[0..index], STYLE_NAME)
				scope = directory_scope(File.dirname(path))
				add(stylesheets, root, path, scope)
			end
		end
		
		path = slide.path.sub(/\.md\z/, ".css")
		add(stylesheets, root, path, slide_scope(slide.path))
	end
	
	stylesheets.values
end