Added partial to display long description properly
This commit is contained in:
parent
73c2361471
commit
8dc2514852
3 changed files with 27 additions and 1 deletions
|
|
@ -952,3 +952,9 @@ a.black
|
||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.description-verbatim-lines
|
||||||
|
{
|
||||||
|
line-height: 120%;
|
||||||
|
// white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
|
||||||
19
app/views/packages/_long_description.slim
Normal file
19
app/views/packages/_long_description.slim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
/ 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
|
||||||
|
|
@ -44,7 +44,8 @@
|
||||||
p.subtitle Description
|
p.subtitle Description
|
||||||
// TODO: split long_description by <p> tags
|
// TODO: split long_description by <p> tags
|
||||||
- if @package.long_description.present?
|
- if @package.long_description.present?
|
||||||
p =@package.long_description
|
= render(partial: 'long_description', locals: {text: @package.long_description})
|
||||||
|
/ p =@package.long_description
|
||||||
- else
|
- else
|
||||||
p Sorry - no more information available.
|
p Sorry - no more information available.
|
||||||
- if @package.homepage.present?
|
- if @package.homepage.present?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue