From 84400b2841b43086a7d6fa541584238fe961238e Mon Sep 17 00:00:00 2001 From: Zeping Lee Date: Mon, 29 Jul 2024 10:48:42 +0800 Subject: [PATCH] Fixup --- citeproc/citeproc-bibtex2csl.lua | 3 +++ citeproc/citeproc-latex-parser.lua | 3 ++- tests/bibtex/xampl.json | 3 --- tests/latex/luatex-1/error-bib-unavailable.tlg | 1 - tests/latex/luatex-1/error-item-unavailable.tlg | 5 ----- tests/latex/luatex-1/error-json-decode.tlg | 1 - tests/latex/luatex-1/error-style-unavailable.tlg | 1 + tests/latex/luatex-2/error-bib-unavailable.tlg | 2 -- tests/latex/luatex-2/error-item-unavailable.tlg | 7 ------- tests/latex/luatex-2/error-json-decode.tlg | 2 -- tests/latex/luatex-2/error-style-unavailable.tlg | 1 + tests/latex/pdftex-1/error-style-unavailable.tlg | 1 + tests/latex/pdftex-2/error-style-unavailable.tlg | 1 + 13 files changed, 9 insertions(+), 22 deletions(-) diff --git a/citeproc/citeproc-bibtex2csl.lua b/citeproc/citeproc-bibtex2csl.lua index cc4cf258..a2979748 100644 --- a/citeproc/citeproc-bibtex2csl.lua +++ b/citeproc/citeproc-bibtex2csl.lua @@ -374,6 +374,9 @@ end function bibtex2csl._parse_edtf_date(str) local date_range = util.split(str, "/") + if str == "" then + return nil + end if #date_range == 1 then date_range = util.split(str, util.unicode["en dash"]) end diff --git a/citeproc/citeproc-latex-parser.lua b/citeproc/citeproc-latex-parser.lua index 9eab31b3..55235ff3 100644 --- a/citeproc/citeproc-latex-parser.lua +++ b/citeproc/citeproc-latex-parser.lua @@ -8,7 +8,7 @@ local latex_parser = {} local bibtex_parser local latex_data -local markup +local markup local util if kpse then latex_data = require("citeproc-latex-data") @@ -365,6 +365,7 @@ function latex_parser.convert_cs_to_inlines(tokens, i, strict, case_protection) return inlines, i end +-- TODO: raise a warning for unrecognized LaTeX command like `\switchargs` function latex_parser.convert_group_to_inlines(token, strict, case_protection, force_add_braces) if case_protection then local first_token = token.contents[1] diff --git a/tests/bibtex/xampl.json b/tests/bibtex/xampl.json index 859e9eba..068e55da 100644 --- a/tests/bibtex/xampl.json +++ b/tests/bibtex/xampl.json @@ -223,9 +223,6 @@ } ], "collection-title": "Four volumes", - "issued": { - "literal": "" - }, "note": "Seven volumes planned (this is a cross-referenced set of BOOKs)", "publisher": "Addison-Wesley", "title": "The art of computer programming" diff --git a/tests/latex/luatex-1/error-bib-unavailable.tlg b/tests/latex/luatex-1/error-bib-unavailable.tlg index 7b58960d..beddf330 100644 --- a/tests/latex/luatex-1/error-bib-unavailable.tlg +++ b/tests/latex/luatex-1/error-bib-unavailable.tlg @@ -27,7 +27,6 @@ TEST 1: Citation > \l__csl_citation_info_tl=citationID={ITEM-1@1},citationItems={{id={ITEM-1}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-1' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-1}). } l. ...} diff --git a/tests/latex/luatex-1/error-item-unavailable.tlg b/tests/latex/luatex-1/error-item-unavailable.tlg index 7db2322d..3afc48ac 100644 --- a/tests/latex/luatex-1/error-item-unavailable.tlg +++ b/tests/latex/luatex-1/error-item-unavailable.tlg @@ -24,7 +24,6 @@ TEST 1: Entry not available > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE@1},citationItems={{id={ITEM-UNAVAILABLE}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-UNAVAILABLE}). } l. ...} @@ -36,8 +35,6 @@ TEST 2: Multiple enties > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE,ANOTHER-ITEM@1},citationItems={{id={ITEM-UNAVAILABLE}},{id={ANOTHER-ITEM}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... -Module citeproc Warning: Didn't find a database entry for 'ANOTHER-ITEM' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-UNAVAILABLE}, \cslundefinedcite {ANOTHER-ITEM}). } l. ...} @@ -50,8 +47,6 @@ TEST 3: Mixture > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE,ITEM-1,ANOTHER-ITEM@1},citationItems={{id={ITEM-UNAVAILABLE}},{id={ITEM-1}},{id={ANOTHER-ITEM}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... -Module citeproc Warning: Didn't find a database entry for 'ANOTHER-ITEM' on input line ... > \l__csl_citation_tl=(D’Arcus, 2005; \cslundefinedcite {ITEM-UNAVAILABLE}, \cslundefinedcite {ANOTHER-ITEM}). } l. ...} diff --git a/tests/latex/luatex-1/error-json-decode.tlg b/tests/latex/luatex-1/error-json-decode.tlg index 581e9787..27de3fed 100644 --- a/tests/latex/luatex-1/error-json-decode.tlg +++ b/tests/latex/luatex-1/error-json-decode.tlg @@ -27,7 +27,6 @@ TEST 1: Citation > \l__csl_citation_info_tl=citationID={ITEM-3@1},citationItems={{id={ITEM-3}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-3' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-3}). } l. ...} diff --git a/tests/latex/luatex-1/error-style-unavailable.tlg b/tests/latex/luatex-1/error-style-unavailable.tlg index de73ac4e..3a9acadb 100644 --- a/tests/latex/luatex-1/error-style-unavailable.tlg +++ b/tests/latex/luatex-1/error-style-unavailable.tlg @@ -18,6 +18,7 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line .... LaTeX Font Info: ... okay on input line .... LaTeX Font Info: Checking defaults for U/cmr/m/n on input line .... LaTeX Font Info: ... okay on input line .... +Package citation-style-language Warning: Empty bibliographic resources. Use \addbibresource. ! Module citeproc Error: Style "style-unavailable.csl" not found. \lua_now:e #1->\__lua_now:n {#1} l. ...\begin{document} diff --git a/tests/latex/luatex-2/error-bib-unavailable.tlg b/tests/latex/luatex-2/error-bib-unavailable.tlg index cb55e89d..64319d79 100644 --- a/tests/latex/luatex-2/error-bib-unavailable.tlg +++ b/tests/latex/luatex-2/error-bib-unavailable.tlg @@ -21,14 +21,12 @@ LaTeX Font Info: ... okay on input line .... ! Module citeproc Error: Database file "bib-unavailable.bib" not found. \lua_now:e #1->\__lua_now:n {#1} l. ...\begin{document} -Module citeproc Warning: Didn't find a database entry for 'ITEM-1' on input line ... ============================================================ TEST 1: Citation ============================================================ > \l__csl_citation_info_tl=citationID={ITEM-1@1},citationItems={{id={ITEM-1}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-1' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-1}). } l. ...} diff --git a/tests/latex/luatex-2/error-item-unavailable.tlg b/tests/latex/luatex-2/error-item-unavailable.tlg index 39181e04..330bce3f 100644 --- a/tests/latex/luatex-2/error-item-unavailable.tlg +++ b/tests/latex/luatex-2/error-item-unavailable.tlg @@ -18,15 +18,12 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line .... LaTeX Font Info: ... okay on input line .... LaTeX Font Info: Checking defaults for U/cmr/m/n on input line .... LaTeX Font Info: ... okay on input line .... -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... -Module citeproc Warning: Didn't find a database entry for 'ANOTHER-ITEM' on input line ... ============================================================ TEST 1: Entry not available ============================================================ > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE@1},citationItems={{id={ITEM-UNAVAILABLE}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-UNAVAILABLE}). } l. ...} @@ -38,8 +35,6 @@ TEST 2: Multiple enties > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE,ANOTHER-ITEM@1},citationItems={{id={ITEM-UNAVAILABLE}},{id={ANOTHER-ITEM}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... -Module citeproc Warning: Didn't find a database entry for 'ANOTHER-ITEM' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-UNAVAILABLE}, \cslundefinedcite {ANOTHER-ITEM}). } l. ...} @@ -52,8 +47,6 @@ TEST 3: Mixture > \l__csl_citation_info_tl=citationID={ITEM-UNAVAILABLE,ITEM-1,ANOTHER-ITEM@1},citationItems={{id={ITEM-UNAVAILABLE}},{id={ITEM-1}},{id={ANOTHER-ITEM}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-UNAVAILABLE' on input line ... -Module citeproc Warning: Didn't find a database entry for 'ANOTHER-ITEM' on input line ... > \l__csl_citation_tl=(D’Arcus, 2005; \cslundefinedcite {ITEM-UNAVAILABLE}, \cslundefinedcite {ANOTHER-ITEM}). } l. ...} diff --git a/tests/latex/luatex-2/error-json-decode.tlg b/tests/latex/luatex-2/error-json-decode.tlg index c418b253..787b1fa1 100644 --- a/tests/latex/luatex-2/error-json-decode.tlg +++ b/tests/latex/luatex-2/error-json-decode.tlg @@ -21,14 +21,12 @@ LaTeX Font Info: ... okay on input line .... ! Module citeproc Error: JSON decode error in file "error-json-decode.json".. \lua_now:e #1->\__lua_now:n {#1} l. ...\begin{document} -Module citeproc Warning: Didn't find a database entry for 'ITEM-3' on input line ... ============================================================ TEST 1: Citation ============================================================ > \l__csl_citation_info_tl=citationID={ITEM-3@1},citationItems={{id={ITEM-3}}},properties={noteIndex={0}}. } l. ...} -Module citeproc Warning: Didn't find a database entry for 'ITEM-3' on input line ... > \l__csl_citation_tl=(\cslundefinedcite {ITEM-3}). } l. ...} diff --git a/tests/latex/luatex-2/error-style-unavailable.tlg b/tests/latex/luatex-2/error-style-unavailable.tlg index 62d7ae1a..cef109ba 100644 --- a/tests/latex/luatex-2/error-style-unavailable.tlg +++ b/tests/latex/luatex-2/error-style-unavailable.tlg @@ -18,6 +18,7 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line .... LaTeX Font Info: ... okay on input line .... LaTeX Font Info: Checking defaults for U/cmr/m/n on input line .... LaTeX Font Info: ... okay on input line .... +Package citation-style-language Warning: Empty bibliographic resources. Use \addbibresource. ! Module citeproc Error: Style "style-unavailable.csl" not found. \lua_now:e #1->\__lua_now:n {#1} l. ...\begin{document} diff --git a/tests/latex/pdftex-1/error-style-unavailable.tlg b/tests/latex/pdftex-1/error-style-unavailable.tlg index 82901f76..18b306e8 100644 --- a/tests/latex/pdftex-1/error-style-unavailable.tlg +++ b/tests/latex/pdftex-1/error-style-unavailable.tlg @@ -15,6 +15,7 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line .... LaTeX Font Info: ... okay on input line .... LaTeX Font Info: Checking defaults for U/cmr/m/n on input line .... LaTeX Font Info: ... okay on input line .... +Package citation-style-language Warning: Empty bibliographic resources. Use \addbibresource. No file error-style-unavailable.bbl. ! LaTeX Error: File 'style-unavailable.csl' not found. For immediate help type H . diff --git a/tests/latex/pdftex-2/error-style-unavailable.tlg b/tests/latex/pdftex-2/error-style-unavailable.tlg index e7be6702..b46d639a 100644 --- a/tests/latex/pdftex-2/error-style-unavailable.tlg +++ b/tests/latex/pdftex-2/error-style-unavailable.tlg @@ -15,6 +15,7 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line .... LaTeX Font Info: ... okay on input line .... LaTeX Font Info: Checking defaults for U/cmr/m/n on input line .... LaTeX Font Info: ... okay on input line .... +Package citation-style-language Warning: Empty bibliographic resources. Use \addbibresource. No file error-style-unavailable.bbl. ! LaTeX Error: File 'style-unavailable.csl' not found. For immediate help type H .