summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-09-23 20:42:52 +0000
committerKarl Berry <karl@freefriends.org>2022-09-23 20:42:52 +0000
commita3dbcbcf3fb731c4edf0addd1d36c54dbc77c620 (patch)
treed7c5bccfd017551a95f1ff78ce5fe657dc28e99a /Master/texmf-dist/tex/latex
parent340d8a8f014f41f84d303ea7276f92eac5742861 (diff)
citation-style-language (23sep22)
git-svn-id: svn://tug.org/texlive/trunk@64484 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/citation-style-language/citation-style-language.sty63
1 files changed, 42 insertions, 21 deletions
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 bc4acd29e23..30aaefdf426 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} {2022-09-18} {v0.2.1}
+\ProvidesExplPackage {citation-style-language} {2022-09-23} {v0.2.2}
{Citation Style Language for LaTeX}
\RequirePackage { l3keys2e }
@@ -414,26 +414,25 @@
\sys_if_engine_luatex:TF
{
\bool_if:NTF \l__csl_engine_initialized_bool
- { \lua_now:n { csl.bibliography() } }
+ {
+ \__csl_collect_bibliography:n { \lua_now:n { csl.bibliography() } }
+ % \tl_show:N \g__csl_bibliography_tl
+ \tl_use:N \g__csl_bibliography_tl
+ }
{ \msg_warning:nnn { citation-style-language } { bibliography / empty } }
}
{
\tl_if_empty:NTF \g__csl_bibliography_tl
{ \msg_warning:nnn { citation-style-language } { bibliography / empty } }
- { \exp_args:NV \__csl_print_bibliography:n \g__csl_bibliography_tl }
+ {
+ \tl_use:N \g__csl_bibliography_tl
+ }
}
}
\msg_new:nnn { citation-style-language } { bibliography / empty }
{ The~ bibliography~ is~ empty. }
-\cs_new:Npn \__csl_print_bibliography:n #1
- {
- \begin { thebibliography }
- #1
- \end { thebibliography }
- }
-
\tl_new:N \l__csl_style_tl
\clist_new:N \l__csl_bib_resources_clist
@@ -709,19 +708,38 @@
% of `thebibliography` is stored into \g__csl_bibliography_tl.
\cs_new:Npn \__csl_load_bbl:
{
+ % The \@input@ prints "No file ....bbl" in the .log file from which
+ % the latexmk decides to run $bibtex or not.
+ \__csl_collect_bibliography:n { \@input@ { \jobname .bbl } }
+ % \file_if_exist_input:nF { \jobname .bbl }
+ % {
+ % \msg_warning:nnx { citation-style-language } { file / non-exist} { \jobname .bbl }
+ % }
+ }
+
+% Collection the bibliography (as well as \cslsetup) into \g__csl_bibliography_setup_tl
+\cs_new:Npn \__csl_collect_bibliography:n #1
+ {
\group_begin:
\RenewDocumentCommand \cslsetup { m }
- { \tl_set:Nn \g__csl_bibliography_setup_tl {##1} }
+ { \tl_gset:Nn \g__csl_bibliography_setup_tl { \cslsetup { ##1 } } }
\RenewDocumentEnvironment { thebibliography } { m +b }
- { \tl_gset:Nn \g__csl_bibliography_tl { {##1} ##2 } }
+ {
+ \tl_gset:Nn \g__csl_bibliography_tl
+ {
+ \begin { thebibliography } {##1}
+ ##2
+ \end { thebibliography }
+ }
+ }
{ }
- % The \@input@ prints "No file ....bbl" in the .log file from which
- % the latexmk decides to run $bibtex or not.
- \@input@ { \jobname .bbl }
- % \file_if_exist_input:nF { \jobname .bbl }
- % {
- % \msg_warning:nnx { citation-style-language } { file / non-exist} { \jobname .bbl }
- % }
+ % Perform the execution
+ #1
+ \tl_if_empty:NF \g__csl_bibliography_setup_tl
+ {
+ \tl_gput_left:Nn \g__csl_bibliography_tl { \par }
+ \tl_gput_left:NV \g__csl_bibliography_tl \g__csl_bibliography_setup_tl
+ }
\group_end:
}
@@ -745,8 +763,11 @@
{ \clist_put_right:Nn \l__csl_bib_resources_clist {#2} }
+% In earlier time, \bibdata{xxx.json} was used but this causes latexmk unable
+% to find xxx.json.bib and it refuses to run the $bibtex procedure.
+% John Collins suggests using a different command than \bibdata.
\clist_new:N \g__csl_aux_bib_files_clist
-\cs_set:Npn \bibdata #1
+\cs_new:Npn \csl@data #1
{ \clist_gput_right:Nn \g__csl_aux_bib_files_clist {#1} }
@@ -759,7 +780,7 @@
\cs_new:Npn \__csl_write_aux_bibdata:n #1
{
\if@filesw
- \iow_now:Nx \@auxout { \token_to_str:N \bibdata {#1} }
+ \iow_now:Nx \@auxout { \token_to_str:N \csl@data {#1} }
\fi
}