Skip to content

Commit

Permalink
fixup! feat(core): Add basic experimental sorting to CSL engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Jul 20, 2024
1 parent 8fe2048 commit d08cbaf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions csl/core/engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,14 @@ function CslEngine:_layout (options, content, entries)
if options.delimiter then
return self:_render_delimiter(output, options.delimiter)
end
-- (Normally citations have a delimiter options)
local delim = self.mode == "citation" and ", " or "<par/>"
-- (Normally citations have a delimiter options, so we should only reach
-- this point for the bibliography)
local delim = self.mode == "citation" and "; " or "<par/>"
-- references all belong to a different paragraph
-- FIXME: should account for attributes on the toplevel bibliography element:
-- line-spacing
-- hanging-indent
return table.concat(output, "<par/>")
return table.concat(output, delim)
end

function CslEngine:_text (options, content, entry)
Expand Down Expand Up @@ -1215,15 +1216,15 @@ end
-- @tparam table entry List of CSL entries
-- @treturn string The XML citation string
function CslEngine:cite (entries)
local entries = type(entries) == "table" and not entries.type and entries or { entries }
entries = type(entries) == "table" and not entries.type and entries or { entries }
return self:_process(entries, "citation")
end

--- Generate a reference string.
-- @tparam table entry List of CSL entries
-- @treturn string The XML reference string
function CslEngine:reference (entries)
local entries = type(entries) == "table" and not entries.type and entries or { entries }
entries = type(entries) == "table" and not entries.type and entries or { entries }
return self:_process(entries, "bibliography")
end

Expand Down

0 comments on commit d08cbaf

Please sign in to comment.