Sha256: 2fab8434dd6773aaf3442178eacd0dd85e47324f9ff72f619b7393de6569e3d5

Contents?: true

Size: 1.76 KB

Versions: 19

Compression:

Stored size: 1.76 KB

Contents

import "common"

mixin book_meta(key, format: nil)
	tr
		- value = book.send(key.to_sym)
		- if value.is_a?(Array)
			- value = value.compact.map(&format).join(', ')
		- end

		- unless value.nil?
			td.book_meta_key= key.gsub('_', ' ')
			- if value.to_s.empty?
				- value = ' '
			- end

			td.book_meta_value= value
		- end

mixin metas
	table
		- default_block.call!

mixin section(name)
	h1.meta_section= name
	- default_block.call


mixin iterate_spine(toc_item)
	- if toc_item.sub_items.count > 0
		ul.spine
			- toc_item.sub_items.each do |item|
				li
					- item_href = "/book/#{pretty_path_toc_item(item)}"
					a.href(href: item_href)= item.local_source_pattern
					- unless item.title.nil?
						= '   '
						span.title: a.title(href: item_href)= item.title
					- end
					- unless item.options.empty?
						= '   '
					- end
					- item.options.each do |opt|
						- next if opt.nil?
						= ' '
						span.option= opt.inspect
					- end
					+iterate_spine(item)
			- end
	- end

+page(header_id: 'home')
	.cover_image
		div
			- if !book.cover_image.nil? && !(file = file_resolver.file_from_request(book.cover_image)).nil?
				img(src: "/raw/#{file.pkg_destination_path}")
			- else
				img(src: '/server/raw/default_cover.png')
			- end
	#content
		+section('Metadata')
			+metas
				+book_meta('title')
				+book_meta('subtitle')
				+book_meta('authors', format: lambda { |author| author.pretty_name })

				+book_meta('publisher')
				+book_meta('language')
				+book_meta('version')
				+book_meta('build_version')


		+section('Targets')
			- book.buildable_targets.each do |b_target|
				p(class: 'target_selected' if target == b_target): a(href: "/change_target/#{b_target.name}")= b_target.name
			- end

		+section('Spine')
			+iterate_spine(target.root_toc)

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
epuber-0.11.1 lib/epuber/server/pages/book.bade
epuber-0.11.0 lib/epuber/server/pages/book.bade
epuber-0.10.3 lib/epuber/server/pages/book.bade
epuber-0.10.2 lib/epuber/server/pages/book.bade
epuber-0.10.1 lib/epuber/server/pages/book.bade
epuber-0.9.3 lib/epuber/server/pages/book.bade
epuber-0.9.2 lib/epuber/server/pages/book.bade
epuber-0.9.1 lib/epuber/server/pages/book.bade
epuber-0.9.0 lib/epuber/server/pages/book.bade
epuber-0.8.0 lib/epuber/server/pages/book.bade
epuber-0.7.4 lib/epuber/server/pages/book.bade
epuber-0.7.3 lib/epuber/server/pages/book.bade
epuber-0.7.2 lib/epuber/server/pages/book.bade
epuber-0.7.1 lib/epuber/server/pages/book.bade
epuber-0.7.0 lib/epuber/server/pages/book.bade
epuber-0.6.0 lib/epuber/server/pages/book.bade
epuber-0.5.7 lib/epuber/server/pages/book.bade
epuber-0.5.6 lib/epuber/server/pages/book.bade
epuber-0.5.5 lib/epuber/server/pages/book.bade