debshots/app/views/packages/_long_description.slim

19 lines
512 B
Text

/ Converts long descriptions from Debian control files into
/ proper HTML.
/ See: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
- text.lines.each do |line|
/ pre +++#{line}---
- case line.rstrip
- when '.'
/ Empty line
/ TODO: Technically wrong because this creates an empty paragraph:
p
- when /^(\s+)(.+)/
/ Verbatim text
div.description-verbatim-lines
= (' ' * $1.to_s.length).html_safe
= $2
- else
/ Normal text
= line