Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
446f9439
Commit
446f9439
authored
Dec 26, 2011
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#790] Add filter to output an array into an unordered list
parent
3c3eb2f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
filters.rb
lib/chili_project/liquid/filters.rb
+17
-0
No files found.
lib/chili_project/liquid/filters.rb
View file @
446f9439
...
...
@@ -54,6 +54,23 @@ module ChiliProject
def
strip
(
input
)
input
.
to_s
.
strip
end
def
to_list
(
array
,
header_or_depth
=
nil
)
result
=
[]
if
header_or_depth
.
is_a?
(
String
)
result
<<
"
\n
p.
#{
header_or_depth
}
\n
"
depth
=
1
else
if
header_or_depth
.
respond_to?
(
:to_i
)
depth
=
[
1
,
header_or_depth
.
to_i
].
max
else
depth
=
1
end
end
result
+=
(
array
||
[]).
collect
{
|
elm
|
"
#{
"*"
*
depth
.
to_i
}
#{
elm
.
to_s
}
"
}
result
.
join
(
"
\n
"
)
end
end
Template
.
register_filter
(
OverriddenFilters
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment