Skip to content

Commit d28aee0

Browse files
committed
style(packages): Reformat bibtex package changes with stylua
1 parent e42b8de commit d28aee0

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

packages/bibtex/csl/engine.lua

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ function CslEngine:_layout (options, content, entries)
462462
for _, entry in ipairs(entries) do
463463
self:_prerender()
464464
local elem = self:_render_children(content, entry, {
465-
secondFieldAlign = self.inheritable.bibliography["second-field-align"] and true or false
465+
secondFieldAlign = self.inheritable.bibliography["second-field-align"] and true or false,
466466
})
467467
elem = self:_render_affixes(elem, options)
468468
elem = self:_render_formatting(elem, options)
@@ -846,13 +846,13 @@ function CslEngine:_name_et_al (options)
846846
end
847847

848848
local function initialize (options, entry)
849-
if SU.boolean(options.initialize, true) and options['initialize-with'] then
849+
if SU.boolean(options.initialize, true) and options["initialize-with"] then
850850
-- FIXME TODO Quick and dirty:
851851
-- Major styles abbreviate the given name with ". " as initialize-with
852852
-- and don't set initialize-with-hyphen to false.
853853
-- So here we just use the short name already derived by our BibTeX parser.
854854
-- ... But this is not general, obviously.
855-
return entry['given-short'] .. options['initialize-with']:gsub("%s*$", "")
855+
return entry["given-short"] .. options["initialize-with"]:gsub("%s*$", "")
856856
end
857857
return entry.given
858858
end
@@ -861,10 +861,7 @@ function CslEngine:_format_a_name (options, name)
861861
if not options then
862862
return name
863863
end
864-
return self:_render_formatting(
865-
self:_render_textCase(name, options),
866-
options
867-
)
864+
return self:_render_formatting(self:_render_textCase(name, options), options)
868865
end
869866

870867
function CslEngine:_a_name (options, content, entry)
@@ -938,11 +935,8 @@ function CslEngine:_a_name (options, content, entry)
938935
for _, namep in ipairs(content) do
939936
-- Override with the options for the cs:name-part explicit nodes, if any
940937
if namep.command == "cs:name-part" then
941-
namePartOptions[namep.options.name] = pl.tablex.merge(
942-
namePartOptions[namep.options.name],
943-
namep.options,
944-
true
945-
)
938+
namePartOptions[namep.options.name] =
939+
pl.tablex.merge(namePartOptions[namep.options.name], namep.options, true)
946940
end
947941
end
948942
options["__name-parts"] = namePartOptions -- memoize
@@ -1197,7 +1191,7 @@ function CslEngine:_names (options, content, entry)
11971191
local et_al_use_first = tonumber(name_node.options["et-al-use-first"]) or 1
11981192
local and_opt = name_node.options["and"]
11991193
local and_word
1200-
if and_opt == "symbol"then
1194+
if and_opt == "symbol" then
12011195
and_word = "&"
12021196
elseif and_opt == "text" then
12031197
and_word = self:_render_term("and")
@@ -1376,12 +1370,12 @@ function CslEngine:_choose (options, content, entry, context)
13761370
local match = self:_if(child.options, child, entry)
13771371
if match then
13781372
return self:_render_children(child, entry, {
1379-
delimiter = delimiter
1373+
delimiter = delimiter,
13801374
})
13811375
end
13821376
elseif child.command == "cs:else" then
13831377
return self:_render_children(child, entry, {
1384-
delimiter = delimiter
1378+
delimiter = delimiter,
13851379
})
13861380
end
13871381
end

packages/bibtex/init.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function package:registerCommands ()
195195
SU.warn("Legacy bibtex.style is deprecated, consider enabling the CSL implementation.")
196196
end
197197
local entry = self:getEntryForCite(options, content, false)
198-
if entry then
198+
if entry then
199199
local bibstyle = require("packages.bibtex.styles." .. style)
200200
local cite = Bibliography.produceCitation(options, SILE.scratch.bibtex.bib, bibstyle)
201201
SILE.processString(("<sile>%s</sile>"):format(cite), "xml")
@@ -240,7 +240,7 @@ function package:registerCommands ()
240240
-- comma-separated lists of numbers, or ranges with an en-dash.
241241
-- We want to be consistent between all these cases, so we always
242242
-- use fake superscripts.
243-
SILE.call("textsuperscript", { fake = true}, content)
243+
SILE.call("textsuperscript", { fake = true }, content)
244244
end)
245245

246246
-- CSL 1.0.2 appendix VI
@@ -429,14 +429,14 @@ function package:registerCommands ()
429429
SILE.settings:temporarily(function ()
430430
local hanging_indent = SU.boolean(engine.bibliography.options["hanging-indent"], false)
431431
local must_align = engine.bibliography.options["second-field-align"]
432-
local lskip = (SILE.settings:get("document.lskip") or SILE.types.node.glue()):absolute()
432+
local lskip = (SILE.settings:get("document.lskip") or SILE.types.node.glue()):absolute()
433433
if hanging_indent or must_align then
434434
-- Respective to the fixed part of the current lskip, all lines are indented
435435
-- but the first one.
436436
local indent = SILE.settings:get("bibliography.indent"):absolute()
437437
SILE.settings:set("document.lskip", lskip.width + indent)
438-
SILE.settings:set("document.parindent", - indent)
439-
SILE.settings:set("current.parindent", - indent)
438+
SILE.settings:set("document.parindent", -indent)
439+
SILE.settings:set("current.parindent", -indent)
440440
else
441441
-- Fixed part of the current lskip, and no paragraph indentation
442442
SILE.settings:set("document.lskip", lskip.width)

packages/bibtex/support/bibparser.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ end)
7777
-- stylua: ignore end
7878
---@diagnostic enable: undefined-global, unused-local, lowercase-global
7979

80-
8180
local bibcompat = require("packages.bibtex.support.bibmaps")
8281
local crossrefmap, fieldmap = bibcompat.crossrefmap, bibcompat.fieldmap
8382
local months =
@@ -237,5 +236,5 @@ end
237236

238237
return {
239238
parseBibtex = parseBibtex,
240-
crossrefAndXDataResolve = crossrefAndXDataResolve
239+
crossrefAndXDataResolve = crossrefAndXDataResolve,
241240
}

0 commit comments

Comments
 (0)