Skip to content

Commit

Permalink
squeeze layout joins
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jan 22, 2014
1 parent 1bb604b commit 6bde412
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions features/names.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ Feature: CSL Name Rendering
Then the results should be:
| COLE, S. J.; MOORE, R. |


Scenario: Name as sort order
Given the following style node:
"""
<names variable="author">
<name and="text" delimiter=", " delimiter-precedes-last="always" name-as-sort-order="first" sort-separator=", " />
</names>
"""
When I render the following citation items as "html":
| author |
| John Doe |
| John Doe and Jane Doe |
Then the results should be:
| Doe, John |
| Doe, John, and Jane Doe |
4 changes: 2 additions & 2 deletions lib/citeproc/ruby/renderer/layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class Renderer
# @param node [CSL::Style::Layout]
# @return [String]
def render_layout(item, node)
node.each_child.map { |child|
join node.each_child.map { |child|
render item, child
}.reject(&:empty?).join(node.delimiter)
}.reject(&:empty?), node.delimiter
end

end
Expand Down

0 comments on commit 6bde412

Please sign in to comment.