diff options
author | Karl Berry <karl@freefriends.org> | 2024-03-10 20:05:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-03-10 20:05:53 +0000 |
commit | 2a7a4bc5f7b280171baee6973331f681d20ac23f (patch) | |
tree | 292d238dd9d9f0da7cbea2c607bd655a1ab8fc85 /Master/texmf-dist | |
parent | 474e0bd8ac78e218ef711aeca99837358f7e0f4b (diff) |
citation-style-language (10mar24)
git-svn-id: svn://tug.org/texlive/trunk@70555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
17 files changed, 211 insertions, 58 deletions
diff --git a/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md b/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md index 47802475f8b..c79e3805f07 100644 --- a/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.7] - 2024-03-10 + +### Added + +- Add support of biblatex's extended name format ([#48](https://github.com/zepinglee/citeproc-lua/issues/48)). + +- Add `\citeyearpar` and `\parencite*` commands ([#52](https://github.com/zepinglee/citeproc-lua/issues/52)). + +### Fixed + +- Fix an error in parsing TeX math contents ([#49](https://github.com/zepinglee/citeproc-lua/issues/49)). + ## [0.4.6] - 2024-02-20 ### Fixed @@ -160,7 +172,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial CTAN release. -[Unreleased]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.6...HEAD +[Unreleased]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.7...HEAD +[0.4.7]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.6...v0.4.7 [0.4.6]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.5...v0.4.6 [0.4.5]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.4...v0.4.5 [0.4.4]: https://github.com/zepinglee/citeproc-lua/compare/v0.4.3...v0.4.4 diff --git a/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf b/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf Binary files differindex 06e7930fa67..560691af59e 100644 --- a/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf +++ b/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf diff --git a/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex b/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex index 5710e7e38ca..e68d49e56e3 100644 --- a/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex +++ b/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex @@ -49,7 +49,7 @@ }% } -\date{2024-02-20 v0.4.6} +\date{2024-03-10 v0.4.7} \maketitle diff --git a/Master/texmf-dist/doc/man/man1/citeproc-lua.1 b/Master/texmf-dist/doc/man/man1/citeproc-lua.1 index ce1743c6951..da8e441f748 100644 --- a/Master/texmf-dist/doc/man/man1/citeproc-lua.1 +++ b/Master/texmf-dist/doc/man/man1/citeproc-lua.1 @@ -1,4 +1,4 @@ -.TH citeproc-lua 1 "0.4.6" +.TH citeproc-lua 1 "0.4.7" .SH NAME citeproc-lua \- make CSL citations and bibliography for LaTeX .SH SYNOPSIS diff --git a/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf b/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf Binary files differindex f9d820268ea..c4b047bfabb 100644 --- a/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua index 36238791cc9..39f4826ca1b 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua @@ -183,7 +183,7 @@ function BibtexParser:parse(bib_str, strings) strings = setmetatable({}, {__index = self.strings}) end if type(bib_str) ~= "string" then - util.error("Invalid string.") + util.error("Invalid string") end local bib_objects = self.grammar:match(bib_str) if not bib_objects then @@ -292,7 +292,7 @@ local function ignore_case(str) end ----@alias NameDict table +---@alias NameDict table<string, string> ---@alias NameStr string ---Split BibTeX names @@ -320,8 +320,16 @@ function bibtex_parser.split_name_parts(str) local comma_parts = Ct(C(comma_part) * (comma * white_space * C(comma_part))^0) local parts = comma_parts:match(str) + local is_biblatex_extended_format = false + if #parts > 0 and (string.match(parts[1], "^[a-zA-Z]+%-?i?%s*=") + or string.match(parts[1], '^"[a-zA-Z]+%-?i?%s*=.*"$')) then + is_biblatex_extended_format = true + end + local name = {} - if #parts == 1 then + if is_biblatex_extended_format then + name = bibtex_parser._split_extended_name_format(parts) + elseif #parts == 1 then name = bibtex_parser._split_first_von_last_parts(parts[1]) elseif #parts == 2 then name = bibtex_parser._split_von_last_parts(parts[1]) @@ -329,18 +337,10 @@ function bibtex_parser.split_name_parts(str) name.first = parts[2] end elseif #parts == 3 then - name = bibtex_parser._split_von_last_parts(parts[1]) - if parts[2] ~= "" then - name.jr = parts[2] - end - if parts[3] ~= "" then - name.first = parts[3] - end + name = bibtex_parser._split_last_jr_first_parts(parts) elseif #parts > 3 then - util.warning() - name = bibtex_parser._split_last_jr_fist_parts(util.slice(parts, 1, 3)) - else - util.warning() + util.error(string.format('Too many commas in name "%s"', str)) + name = bibtex_parser._split_last_jr_first_parts(util.slice(parts, 1, 3)) end return name @@ -396,6 +396,49 @@ local function join_words_and_seps(words, seps, start, stop) return res end + +---@param parts string[] +---@return table<string, string> +function bibtex_parser._split_extended_name_format(parts) + local name = {} + for _, part in ipairs(parts) do + local key, value = string.match(part, "^([a-zA-Z]+%-?i?)%s*=%s*(.-)%s*$") + if not key then + key, value = string.match(part, '^"([a-zA-Z]+%-?i?)%s*=%s*(.-)%s*"%s*$') + end + if not key then + util.error(string.format('Invalid extended name part "%s"', part)) + end + + if key == "given" then + key = "first" + elseif key == "given-i" then + key = "first-i" + elseif key == "prefix" then + key = "von" + elseif key == "prefix-i" then + key = "von-i" + elseif key == "family" then + key = "last" + elseif key == "family-i" then + key = "last-i" + elseif key == "suffix" then + key = "jr" + elseif key == "suffix-i" then + key = "jr-i" + end + + local braced_pattern = P"{" * C(balanced^0) * P"}" * P(-1) + local stripped = braced_pattern:match(value) + if stripped then + value = stripped + end + + name[key] = value + end + return name +end + function bibtex_parser._split_first_von_last_parts(str) local word_sep = P"-" + P"~" + P(util.unicode['no-break space']) local word_tokens = Ct(C(utf8_balanced - space_char - word_sep)^0) @@ -490,6 +533,19 @@ function bibtex_parser._split_von_last_parts(str) return name end +---@param parts string[] +---@return NameDict +function bibtex_parser._split_last_jr_first_parts(parts) + local name = bibtex_parser._split_von_last_parts(parts[1]) + if parts[2] ~= "" then + name.jr = parts[2] + end + if parts[3] ~= "" then + name.first = parts[3] + end + return name +end + --- Note that BibTeX find crossref in a case-insensitive manner (see --- `article-crossref` in `xampl.bib`) which is unlike biber/biblatex. diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua index 58efc0f37b5..ba7bf9fe14f 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua @@ -318,7 +318,10 @@ function Context:get_localized_quotes() ) end +---@param page string|number +---@return string function Context.page_first(page) + page = tostring(page) local page_first = util.split(page, "%s*[&,-]%s*")[1] return util.split(page_first, util.unicode["en dash"])[1] end diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua index 0f65f66b87c..485d3f58350 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua @@ -52,7 +52,9 @@ local Position = util.Position ---@alias ItemId string | number ---@alias NoteIndex integer ---@alias CitationId string ----@alias CitationData {citationID: CitationId, citationItems: table[], properties: table, citation_index: integer} +---@alias CitationData {citationID: CitationId, citationItems: CitationItem[], properties: CitationProperties, citation_index: integer} + +---@alias CitationProperties { noteIndex: integer, mode: string? } ---@class NameVariable ---@field family string? @@ -95,7 +97,7 @@ local Registry = {} ---@field locales Locale[] ---@field system_locales Locale[] ---@field lang string ----@field output_format any +---@field output_format OutputFormat ---@field opt table ---@field registry Registry ---@field cite_first_note_numbers table<ItemId, NoteIndex> @@ -197,6 +199,7 @@ function CiteProc:check_valid_citation_element() end end +---@param ids CiteId[] function CiteProc:updateItems(ids) -- util.debug(string.format('updateItems(%s)', table.concat(ids, ", "))) self.registry.reflist = {} @@ -282,8 +285,12 @@ function CiteProc:updateUncitedItems(uncited_ids) end +---@param citation CitationData +---@param citationsPre (CitationId | NoteIndex)[] +---@param citationsPost (CitationId | NoteIndex)[] +---@return (table | (integer | string | CitationId)[])[] function CiteProc:processCitationCluster(citation, citationsPre, citationsPost) - -- util.debug(citation.citationID) + -- util.debug(string.format('processCitationCluster(%s)', citation.citationID)) self:check_valid_citation_element() citation = self:normalize_citation_input(citation) diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua index 367646c5130..e8f7fcd6518 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua @@ -318,6 +318,9 @@ function core.make_citation(citation_info) end +---@param engine CiteProc +---@param citations CitationData[] +---@return table<CitationId, string> function core.process_citations(engine, citations) local citations_pre = {} diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua index c8e4e14cc8c..b3c827dc623 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua @@ -250,13 +250,37 @@ function If:evaluate_condition(condition, state, context) return context.disambiguate or (context.in_bibliography and context.reference.disambiguate) elseif condition.condition == "is-numeric" then - local variable = context:get_variable(condition.value) - return util.is_numeric(variable) + local variable = condition.value + local variable_type = util.variable_types[variable] or "standard" + + if variable_type ~= "standard" and variable_type ~= "number" then + util.warning(string.format('Expecting number variable for condition "is-numeric", got %s "%s"', variable_type, variable)) + return false + end + + local value = context:get_variable(variable) + if not value then + return false + end + if type(value) ~= "string" and type(value) ~= "number" then + util.error(string.format('Expecting a string or number for variable "%s", got "%s"', variable, type(value))) + end + return util.is_numeric(value) elseif condition.condition == "is-uncertain-date" then - local variable = context:get_variable(condition.value) - -- TODO - return self:is_uncertain_date(variable) + local variable = condition.value + + local variable_type = util.variable_types[variable] or "standard" + + if variable_type ~= "date" then + util.warning(string.format('Expecting date variable for condition "is-uncertain-date", got "%s"', variable_type, variable)) + return false + end + local value = context:get_variable(variable) + if not value then + return false + end + return self:is_uncertain_date(value) elseif condition.condition == "locator" then local locator_label = context:get_variable("label") diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua index d16cd7b9456..45e1335b309 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua @@ -150,6 +150,9 @@ function Citation:from_node(node, style) return o end +---@param citation CitationData +---@param engine CiteProc +---@return string function Citation:build_citation_str(citation, engine) if engine.registry.requires_sorting then engine:sort_bibliography() @@ -172,8 +175,10 @@ local function remove_name_formatting(ir) end end +---@alias CiteId string | number + ---@class CitationItem ----@field id string | number +---@field id CiteId ---@field prefix string? ---@field suffix string? ---@field locator string? @@ -417,12 +422,8 @@ end ---@param properties table ---@return CiteIr function Citation:build_fully_disambiguated_ir(cite_item, output_format, engine, properties) + -- util.debug(cite_item.id) local cite_ir = self:build_ambiguous_ir(cite_item, output_format, engine) - -- util.debug(cite_ir) - -- if cite_item.id == "ITEM-3" then - -- util.debug(cite_item.id) - -- util.debug(cite_ir) - -- end cite_ir = self:apply_disambiguate_add_givenname(cite_ir, engine) cite_ir = self:apply_disambiguate_add_names(cite_ir, engine) cite_ir = self:apply_disambiguate_conditionals(cite_ir, engine) diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua index 0914289a208..5cc3df5579c 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua @@ -80,7 +80,7 @@ function Style:parse(xml_str) return nil end local style_node = csl_xml:get_path("style")[1] - if not csl_xml then + if not style_node then error('Element "style" not found.') end return Style:from_node(style_node) diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua index 0c056fa7480..2b3661c9b17 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua @@ -415,7 +415,7 @@ local function get_inline_element_grammar() local spaces = P(" ")^1 local grammar = P{ "content"; - token = V"italic" + V"bold" + V"sup" + V"sub" + V"sc" + V"small_caps" + V"span_nocase" + V"nodecor" + V"mathtex" + V"mathml" + V"code" + V"script" + C(1), + token = V"italic" + V"bold" + V"sup" + V"sub" + V"sc" + V"small_caps" + V"span_nocase" + V"nodecor" + V"math_tex" + V"math_ml" + V"code" + V"script" + C(1), content = Ct((V"token")^0) / tokens2inlines, italic = P"<i>" * Ct((V"token" - P"</i>")^0) * P"</i>" / function (tokens) return Formatted:new(tokens2inlines(tokens), {["font-style"] = "italic"}) @@ -453,10 +453,10 @@ local function get_inline_element_grammar() nodecor = P"<span" * spaces * P'class="nodecor">' * Ct((V"token" - P"</span>")^0) * P"</span>" / function (tokens) return NoDecor:new(tokens2inlines(tokens)) end, - mathtex = P"<mathtex>" * Ct((1- P"</mathtex>")^0) * P"</mathtex>" / function (text) - return MathML:new(text) + math_tex = P"<math-tex>" * C((1- P"</math-tex>")^0) * P"</math-tex>" / function (text) + return MathTeX:new(text) end, - mathml = P"<math>" * C((1- P"</math>")^0) * P"</math>" / function (text) + math_ml = P"<math>" * C((1- P"</math>")^0) * P"</math>" / function (text) return MathML:new(text) end, code = P"<code>" * C((1 - P"</code>")^0) * P"</code>" / function (text) @@ -1639,7 +1639,7 @@ function Markup:write_inline(inline, context) return self:write_code(inline, context) elseif inline._type == "MathML" then - return self:write_mathml(inline, context) + return self:write_math_ml(inline, context) elseif inline._type == "MathTeX" then return self:write_math_tex(inline, context) @@ -1690,7 +1690,7 @@ function Markup:write_code(inline, context) return inline.value end -function Markup:write_mathml(inline, context) +function Markup:write_math_ml(inline, context) return inline.value end @@ -1806,7 +1806,8 @@ function LatexWriter:write_display(inline, context) return res elseif inline.div == "block" then - return "" + util.warning("display=\"block\" is not supported in LaTeX output.") + return res end return res end @@ -1834,7 +1835,7 @@ function LatexWriter:write_code(inline, context) return inline.value end -function LatexWriter:write_mathml(inline, context) +function LatexWriter:write_math_ml(inline, context) util.error("MathML is not supported in LaTeX output.") return "" end @@ -1941,7 +1942,7 @@ function HtmlWriter:write_code(inline, context) return string.format("<code>%s</code>", inline.value) end -function HtmlWriter:write_mathml(inline, context) +function HtmlWriter:write_math_ml(inline, context) return string.format('<math xmlns="http://www.w3.org/1998/Math/MathML">%s</math>', inline.value) end @@ -2057,12 +2058,12 @@ function PseudoHtml :write_escaped(str, context) return str end -function PseudoHtml:write_mathml(inline, context) +function PseudoHtml:write_math_ml(inline, context) return string.format('<math>%s</math>', inline.value) end function PseudoHtml:write_math_tex(inline, context) - return string.format("<mathtex>%s</mathtex>", inline.value) + return string.format("<math-tex>%s</math-tex>", inline.value) end function PseudoHtml:write_nocase(inline, context) diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua index 302e5b72c5e..97ac6d010ef 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua @@ -233,7 +233,7 @@ end ---@return string[] function util.split(str, sep, maxsplit) if type(str) ~= "string" then - util.error("Invalid string.") + util.error("Invalid string") end sep = sep or "%s+" if sep == "" then @@ -398,6 +398,8 @@ function util.endswith(str, suffix) return string.sub(str, -#suffix) == suffix end +---@param str string | number +---@return boolean function util.is_numeric(str) if str == nil or str == "" then return false diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc.lua index 90b02732196..0c673c67e33 100755 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc.lua @@ -16,7 +16,7 @@ else util = require("citeproc.util") end -citeproc.__VERSION__ = "0.4.6" +citeproc.__VERSION__ = "0.4.7" citeproc.new = engine.CiteProc.new citeproc.util = util diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty index 1482a343833..6ebb300536d 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty @@ -6,14 +6,14 @@ % ## Citation commands -\DeclareDocumentCommand \cite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } +\DeclareDocumentCommand \cite { s o o m } + { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } -\NewDocumentCommand \parencite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } +\NewDocumentCommand \parencite { s o o m } + { \__csl_cite:nnnn {#1} {#2} {#3} {#4} } \NewDocumentCommand \citep { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } + { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } \NewDocumentCommand \textcite { o o m } { \__csl_text_cite:nnn {#1} {#2} {#3} } @@ -22,7 +22,7 @@ { \__csl_text_cite:nnn {#1} {#2} {#3} } \NewDocumentCommand \footcite { o o m } - { \__csl_cite:nnn {#1} {#2} {#3} } + { \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } % \cites[⟨prenote⟩][⟨postnote⟩]{⟨key⟩}...[⟨prenote⟩][⟨postnote⟩]{⟨key⟩} @@ -32,27 +32,56 @@ \NewDocumentCommand \citeauthor { o o m } { \__csl_cite_author:nnn {#1} {#2} {#3} } +% TODO: \citeyear + +% ATM the starred form is the same as non-star form. +\NewDocumentCommand \citeyearpar { s o o m } + { + \IfBooleanT {#1} + { + \bool_if:NTF \l__csl_note_bool + { \msg_error:nn { citation-style-language } { starred-cite-in-note-style } } + } + \__csl_cite_suppress_author:nnn {#2} {#3} {#4} + } + \seq_new:N \l__csl_cite_keys_seq \seq_new:N \l__csl_citation_items_seq \prop_new:N \l__csl_citation_properties_prop \prop_new:N \l__csl_citation_info_prop -% \__csl_cite:nnn #1#2#3 -\cs_new:Npn \__csl_cite:nnn #1#2#3 +% \__csl_cite:nnnn #1#2#3# +% #1: boolean of star form +% #2: prenote +% #3: postnote +% #4: cite keys +\cs_new:Npn \__csl_cite:nnnn #1#2#3#4 { - \tl_if_blank:nTF {#3} - { \__csl_print_undefined_citation:n {#3} } + \tl_if_blank:nTF {#4} + { \__csl_print_undefined_citation:n {#4} } { \seq_clear:N \l__csl_cite_keys_seq \seq_clear:N \l__csl_citation_items_seq \prop_clear:N \l__csl_citation_properties_prop - \__csl_process_cite_input:nnn {#1} {#2} {#3} + \__csl_process_cite_input:nnn {#2} {#3} {#4} \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \IfBooleanT {#1} + { + \bool_if:NTF \l__csl_note_bool + { \msg_warning:nn { citation-style-language } { starred-cite-in-note-style } } + { + \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } + \prop_put:Nnn \l__csl_citation_properties_prop { mode } { suppress-author } + } + } \__csl_make_citation:N \l__csl_citation_info_prop } } +\msg_new:nnn { citation-style-language } { starred-cite-in-note-style } + { Starred~ variant~ of~ cite~ command~ does~ not~ work~ with~ note~ styles. } + \cs_new:Npn \__csl_text_cite:nnn #1#2#3 { @@ -62,7 +91,7 @@ \bool_set_false:N \l__csl_note_bool \__csl_cite_author:nnn {#1} {#2} {#3} \bool_set_true:N \l__csl_note_bool - \__csl_cite:nnn {#1} {#2} {#3} + \__csl_cite:nnnn { \BooleanFalse } {#1} {#2} {#3} } { \seq_clear:N \l__csl_cite_keys_seq @@ -113,6 +142,20 @@ } +\cs_new:Npn \__csl_cite_suppress_author:nnn #1#2#3 + { + \seq_clear:N \l__csl_cite_keys_seq + \seq_clear:N \l__csl_citation_items_seq + \prop_clear:N \l__csl_citation_properties_prop + \__csl_process_cite_input:nnn {#1} {#2} {#3} + \__csl_process_citation_info:NN \l__csl_cite_keys_seq \l__csl_citation_items_seq + \prop_put:Nnn \l__csl_citation_properties_prop { noteIndex } { 0 } + \prop_put:Nnn \l__csl_citation_properties_prop { mode } { suppress-author } + \bool_set_false:N \l__csl_note_bool + \__csl_make_citation:N \l__csl_citation_info_prop + } + + % Appends the cite key into \l__csl_cite_keys_seq and cite-items into % \l__csl_citation_items_seq % #1, #2: prenote/postnote diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty index 603312dcf8e..4dd3456b78a 100644 --- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty +++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {citation-style-language} {2024-02-20} {0.4.6} +\ProvidesExplPackage {citation-style-language} {2024-03-10} {0.4.7} {Citation Style Language for LaTeX} \RequirePackage { l3keys2e } |