Sha256: 12e391b191a8820439c53f4e8b89496cb4d5b846f1d4ca3f0be6ba026f5f5ded

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

prepend Actions

on 'index' do
	@base = Utopia::Project::Base.instance
	
	if readme_path = @base.path_for('README.md')
		@document = Kramdown::Document.new(File.read(readme_path), syntax_highlighter: nil)
		
		if title = @document.root.children.shift
			@title = title.children.first.value
		end
		
		start = @document.root.children.index{|node| node.children.first&.value == "Usage"}
		finish = start + 1
		
		while node = @document.root.children[finish]
			if node.type == :header
				break
			else
				finish += 1
			end
		end
		
		@document.root.children[start...finish] = [
			Kramdown::Element.new(:raw, "<content:usage/>")
		]
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
utopia-project-0.2.1 pages/controller.rb
utopia-project-0.2.0 pages/controller.rb
utopia-project-0.1.0 pages/controller.rb