texlive[70565] branches/branch2023.final/Master/texmf-dist:

commits+karl at tug.org commits+karl at tug.org
Sun Mar 10 21:07:57 CET 2024


Revision: 70565
          https://tug.org/svn/texlive?view=revision&revision=70565
Author:   karl
Date:     2024-03-10 21:07:57 +0100 (Sun, 10 Mar 2024)
Log Message:
-----------
citation-style-language (branch) (10mar24)

Modified Paths:
--------------
    branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md
    branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf
    branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex
    branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.1
    branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua
    branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc.lua
    branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty
    branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/CHANGELOG.md	2024-03-10 20:07:57 UTC (rev 70565)
@@ -7,6 +7,18 @@
 
 ## [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 @@
 
 - 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

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/doc/latex/citation-style-language/citation-style-language-doc.tex	2024-03-10 20:07:57 UTC (rev 70565)
@@ -49,7 +49,7 @@
   }%
 }
 
-\date{2024-02-20 v0.4.6}
+\date{2024-03-10 v0.4.7}
 
 \maketitle
 

Modified: branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.1
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.1	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.1	2024-03-10 20:07:57 UTC (rev 70565)
@@ -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

Modified: branches/branch2023.final/Master/texmf-dist/doc/man/man1/citeproc-lua.man1.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-bibtex-parser.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -183,7 +183,7 @@
     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 @@
 end
 
 
---- at alias NameDict table
+--- at alias NameDict table<string, string>
 --- at alias NameStr string
 
 ---Split BibTeX names
@@ -320,8 +320,16 @@
   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 @@
       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 @@
   return res
 end
 
+
+--- at param parts string[]
+--- at 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,7 +533,20 @@
   return name
 end
 
+--- at param parts string[]
+--- at 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.
 --- This function is case-sensitive.

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-context.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -318,7 +318,10 @@
   )
 end
 
+--- at param page string|number
+--- at 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

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-engine.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -52,8 +52,10 @@
 --- at alias ItemId string | number
 --- at alias NoteIndex integer
 --- at alias CitationId string
---- at alias CitationData {citationID: CitationId, citationItems: table[], properties: table, citation_index: integer}
+--- at alias CitationData {citationID: CitationId, citationItems: CitationItem[], properties: CitationProperties, citation_index: integer}
 
+--- at alias CitationProperties { noteIndex: integer, mode: string? }
+
 --- at class NameVariable
 --- at field family string?
 --- at field given string?
@@ -95,7 +97,7 @@
 --- at field locales Locale[]
 --- at field system_locales Locale[]
 --- at field lang string
---- at field output_format any
+--- at field output_format OutputFormat
 --- at field opt table
 --- at field registry Registry
 --- at field cite_first_note_numbers table<ItemId, NoteIndex>
@@ -197,6 +199,7 @@
   end
 end
 
+--- at param ids CiteId[]
 function CiteProc:updateItems(ids)
   -- util.debug(string.format('updateItems(%s)', table.concat(ids, ", ")))
   self.registry.reflist = {}
@@ -282,8 +285,12 @@
 end
 
 
+--- at param citation CitationData
+--- at param citationsPre (CitationId | NoteIndex)[]
+--- at param citationsPost (CitationId | NoteIndex)[]
+--- at 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)
 

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-latex-core.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -318,6 +318,9 @@
 end
 
 
+--- at param engine CiteProc
+--- at param citations CitationData[]
+--- at return table<CitationId, string>
 function core.process_citations(engine, citations)
   local citations_pre = {}
 

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-choose.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -250,14 +250,38 @@
     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")
     if locator_label == "sub verbo" then

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-citation.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -150,6 +150,9 @@
   return o
 end
 
+--- at param citation CitationData
+--- at param engine CiteProc
+--- at return string
 function Citation:build_citation_str(citation, engine)
   if engine.registry.requires_sorting then
     engine:sort_bibliography()
@@ -172,8 +175,10 @@
   end
 end
 
+--- at alias CiteId string | number
+
 --- at class CitationItem
---- at field id string | number
+--- at field id CiteId
 --- at field prefix string?
 --- at field suffix string?
 --- at field locator string?
@@ -417,12 +422,8 @@
 --- at param properties table
 --- at 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)

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-node-style.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -80,7 +80,7 @@
     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)

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-output.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -415,7 +415,7 @@
   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 @@
     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 @@
       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 @@
   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 @@
     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 @@
   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 @@
   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 @@
   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)

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc-util.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -233,7 +233,7 @@
 --- at 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 @@
   return string.sub(str, -#suffix) == suffix
 end
 
+--- at param str string | number
+--- at return boolean
 function util.is_numeric(str)
   if str == nil or str == "" then
     return false

Modified: branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc.lua	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/scripts/citation-style-language/citeproc.lua	2024-03-10 20:07:57 UTC (rev 70565)
@@ -16,7 +16,7 @@
   util = require("citeproc.util")
 end
 
-citeproc.__VERSION__ = "0.4.6"
+citeproc.__VERSION__ = "0.4.7"
 
 citeproc.new = engine.CiteProc.new
 citeproc.util = util

Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-cite.sty	2024-03-10 20:07:57 UTC (rev 70565)
@@ -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,28 +32,57 @@
 \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
   {
     \bool_if:NTF \l__csl_note_bool
@@ -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

Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty	2024-03-10 20:07:36 UTC (rev 70564)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty	2024-03-10 20:07:57 UTC (rev 70565)
@@ -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 }



More information about the tex-live-commits mailing list.