~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(citations): accept whitespace before the comma in group-citation labels (#7367)
Ziyang Guo39dc78acc90e
diff --git a/tests/text_optimization/test_citation_formatter.py b/tests/text_optimization/test_citation_formatter.pyindex 373a4c2c48..6476f3c7af 100644--- a/tests/text_optimization/test_citation_formatter.py+++ b/tests/text_optimization/test_citation_formatter.py@@ -1130,6 +1130,81 @@ Research with lenticular citations 【1】 and 【2】.assert r"\cite{1}" in resultassert r"\cite{2}" in result+ def test_latex_group_citation_with_space_before_comma(self):+ """[[2 ,3]] (space before the comma) must still match the group+ pattern and emit a single \\cite{2,3}, not fall through to a+ single-citation \\cite{2} that drops the second member (#6944)."""+ content = """# Report++A hand-edited group label with a space before the comma: [[2 ,3]].++## Sources++[2] Second Source+ URL: https://example.com/2++[3] Third Source+ URL: https://example.com/3+"""+ exporter = LaTeXExporter()+ result = exporter.export_to_latex(content)++ # The whole group must resolve to a single \cite{2,3}; the+ # pre-fix behavior emitted \cite{2} and dropped ",3" entirely.+ # (A bare \cite{2} negative pin would also catch the regression+ # but \cite{2} is a substring of \cite{2,3}, so the positive+ # pin carries the check on its own: pre-fix this assertion+ # fails because the formatter emits \cite{2} (no ",3").)+ assert r"\cite{2,3}" in result++ def test_latex_group_citation_link_form_with_space_before_comma(self):+ """The [[label]](url) link form of #6944 must also accept the+ space-before-comma alias and emit a clean \\cite{2,3} rather+ than literal markdown-link syntax stranded in the LaTeX+ output (#6954's fourth site; folded in here so this PR+ becomes the complete carrier for #6944).++ The pre-fix behavior at this site leaves the label as-is, so+ the [[2 ,3]](url) shape renders as ``[\\cite{2 ,3}](url)`` in+ the LaTeX output — the markdown link syntax survives+ verbatim, with both members intact. The widening+ (``_CITATION_GROUP_LABEL_RE``) folds the label into a single+ group, which then renders as the canonical ``\\cite{2,3}``+ and the link can resolve cleanly.+ """+ content = """# Report++A hand-edited group label with a space before the comma, in link form:+[[2 ,3]](https://example.com/group).++## Sources++[2] Second Source+ URL: https://example.com/2++[3] Third Source+ URL: https://example.com/3+"""+ exporter = LaTeXExporter()+ result = exporter.export_to_latex(content)++ assert r"\cite{2,3}" in result+ # The markdown-link syntax must not leak through to LaTeX.+ assert r"[\\cite{2 ,3}]" not in result+ # Round-2 review: the original assertion above is a strict+ # substring pin for the stranded label form. The stranded+ # output of a reverted (pre-fix) site is+ # `[\cite{2,3}](https://example.com/group)` (a+ # markdown-link-wrapped, comma-fixed cite), and the+ # round-1 assertion set passes with that output because+ # \cite{2,3} is a substring of the stranded form. Add the+ # closing `](https://example.com/group)` as a second+ # negative pin so a reversion of citation_formatter.py:3406+ # to the pre-fix r"\s*\d+(?:,\s*\d+)+\s*" is actually+ # caught (verified by mutation: the round-1 set stays green+ # after the revert; this addition flips it to red).+ assert r"](https://example.com/group)" not in result+def test_unicode_lenticular_mixed_with_standard(self):"""Test LaTeX with mixed standard and lenticular brackets."""content = """# Report