summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty')
-rw-r--r--Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty149
1 files changed, 124 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty
index 8a95c5b2abd..2a2af3a7d2b 100644
--- a/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty
+++ b/Master/texmf-dist/tex/latex/citation-style-language/citation-style-language-bib.sty
@@ -9,21 +9,21 @@
% The options like `notcategory` can be used multiple times and thus we save
% them into a seq instead of a prop.
\seq_new:N \l__csl_bib_filter_seq
-\int_new:N \g__bib_list_index_int
-\tl_new:N \g__bib_list_index_tl
+\int_new:N \g__csl_bib_list_index_int
+\tl_new:N \g__csl_bib_list_index_tl
\tl_new:N \l__csl_bibliography_tl
\seq_new:N \l__csl_bibliography_seq
\NewDocumentCommand \printbibliography { O { } }
{
- \int_gincr:N \g__bib_list_index_int
- \tl_gset:Nx \g__bib_list_index_tl { \int_use:N \g__bib_list_index_int }
+ \int_gincr:N \g__csl_bib_list_index_int
+ \tl_gset:Nx \g__csl_bib_list_index_tl { \int_use:N \g__csl_bib_list_index_int }
\__csl_set_categories:
% Bibliography filter
\group_begin:
\seq_clear:N \l__csl_bib_filter_seq
\seq_put_right:Nx \l__csl_bib_filter_seq
- { index = \g__bib_list_index_tl }
+ { index = \g__csl_bib_list_index_tl }
\keys_set:nn { csl / bibliography } {#1}
\__csl_serialize_seq:NN \l__csl_bib_filter_seq \l__csl_bib_filter_tl
% Collect the bibliography to token list
@@ -34,7 +34,7 @@
\__csl_collect_bibliography:n
{
\lua_now:e
- { csl.bibliography("\l__csl_bib_filter_tl") }
+ { csl_citation_manager:bibliography("\l__csl_bib_filter_tl") }
}
}
}
@@ -43,7 +43,7 @@
\exp_args:NV \__csl_write_aux_bibliography:n \l__csl_bib_filter_tl
}
% Print the bibliography
- \prop_get:NVNTF \g__csl_bibliographies_prop \g__bib_list_index_tl
+ \prop_get:NVNTF \g__csl_bibliographies_prop \g__csl_bib_list_index_tl
\l__csl_bibliography_tl
{
\bool_if:NT \l__csl_regression_test_bool
@@ -53,11 +53,11 @@
}
\tl_use:N \l__csl_bibliography_tl
}
- { \msg_warning:nn { citation-style-language } { bibliography / empty } }
+ { \msg_warning:nn { citation-style-language } { empty-bibliography } }
\group_end:
}
-\msg_new:nnn { citation-style-language } { bibliography / empty }
+\msg_new:nnn { citation-style-language } { empty-bibliography }
{ The~ bibliography~ is~ empty. }
\DeclareDocumentCommand \bibliography { m }
@@ -108,11 +108,16 @@
\cs_new:Npn \__csl_write_aux_bibliography:n #1
{
\if@filesw
- \iow_now:Nn \@auxout { \csl@aux@bibliography {#1} }
+ \iow_now:Nx \@auxout
+ {
+ \token_to_str:N \csl@aux@bibliography
+ { \int_use:N \g__csl_ref_section_index_int }
+ {#1}
+ }
\fi
}
-\cs_new:Npn \csl@aux@bibliography #1 { }
+\cs_new:Npn \csl@aux@bibliography #1#2 { }
\tl_new:N \l__csl_bib_index_tl
@@ -182,7 +187,7 @@
}
{
\tl_set:Nn \@noitemerr
- { \msg_warning:nn { citation-style-language } { bibliography / empty } }
+ { \msg_warning:nn { citation-style-language } { empty-bibliography } }
\endlist
\group_end:
\exp_args:NV \__csl_print_bib_note:n \l__csl_bib_post_note_tl
@@ -355,6 +360,96 @@
}
+% ### Bibliography sections and segments
+
+
+\int_new:N \g__csl_ref_section_index_int
+\int_new:N \g__csl_max_ref_section_index_int
+\int_gset:Nn \g__csl_ref_section_index_int { 0 }
+\int_gset:Nn \g__csl_max_ref_section_index_int { 0 }
+
+\keys_define:nn { csl / ref-section }
+ {
+ style .code:n =
+ {
+ \tl_set:Nn \l__csl_style_tl {#1}
+ \renewcommand \csl@style {#1}
+ } ,
+ bib-resource .clist_set:N = \l__csl_bib_resources_clist ,
+ locale .tl_set:N = \l__csl_locale_tl ,
+ }
+
+\NewDocumentCommand \refsection { O { } }
+ {
+ \int_gincr:N \g__csl_max_ref_section_index_int
+ \int_gset_eq:NN \g__csl_ref_section_index_int \g__csl_max_ref_section_index_int
+
+ \tl_clear:N \l__csl_style_tl
+ \clist_clear:N \l__csl_bib_resources_clist
+ \tl_clear:N \l__csl_locale_tl
+ \keys_set:nn { csl / ref-section } { #1 }
+ \tl_if_empty:NTF \l__csl_style_tl
+ {
+ \tl_set_eq:NN \l__csl_style_tl \g__csl_global_style_tl
+ \tl_set_eq:NN \csl@style \l__csl_style_tl
+ }
+ {
+ \tl_set_eq:NN \csl@style \l__csl_style_tl
+ \exp_args:NV \__csl_write_aux_bibstyle:n \l__csl_style_tl
+ }
+ \clist_if_empty:NF \l__csl_bib_resources_clist
+ % { \clist_set_eq:NN \l__csl_bib_resources_clist \g__csl_global_bib_resources_clist }
+ {
+ \exp_args:Nx \__csl_write_aux_bibdata:n
+ { \clist_use:Nn \l__csl_bib_resources_clist { , } }
+ }
+ \tl_if_empty:NTF \l__csl_locale_tl
+ { \tl_set_eq:NN \l__csl_locale_tl \g__csl_global_locale_tl }
+ {
+ \exp_args:Nx \__csl_write_aux_options:n
+ { locale = \l__csl_locale_tl }
+ }
+ \sys_if_engine_luatex:TF
+ {
+ \lua_now:e
+ {
+ csl_citation_manager:begin_ref_section(
+ "\l__csl_style_tl",
+ "\clist_use:Nn \l__csl_bib_resources_clist { , }",
+ "\l__csl_locale_tl"
+ )
+ }
+ \str_if_eq:eeTF
+ {
+ \lua_now:n
+ {
+ tex.print(tostring(
+ csl_citation_manager.ref_section.initialized
+ ))
+ }
+ }
+ { true }
+ { \bool_set_true:N \l__csl_engine_initialized_bool }
+ { \bool_set_false:N \l__csl_engine_initialized_bool }
+ \__csl_get_style_class_luatex:
+ }
+ {
+ \__csl_get_style_class:
+ }
+ }
+
+\cs_set_eq:NN \newrefsection \refsection
+
+\cs_new:Npn \endrefsection {
+ \int_compare:nNnT { \g__csl_ref_section_index_int } > { 0 }
+ {
+ \int_gzero:N \g__csl_ref_section_index_int
+ \sys_if_engine_luatex:T
+ { \lua_now:n { csl_citation_manager:end_ref_section() } }
+ }
+}
+
+
% ### Bibliography Headings and Environments
\prop_new:N \l__csl_bib_env_begin_prop
@@ -381,7 +476,7 @@
{
\cs_if_exist:cF { __csl_head_ #1 :n }
{
- \msg_error:nnn { citation-style-language } { bib-heading-undefined }
+ \msg_error:nnn { citation-style-language } { undefined-bib-heading }
{#1}
}
\tl_if_blank:nTF {#2}
@@ -393,7 +488,7 @@
{ \exp_args:NV \label \l__csl_bib_head_label_tl }
}
-\msg_new:nnn { citation-style-language } { bib-heading-undefined }
+\msg_new:nnn { citation-style-language } { undefined-bib-heading }
{ Bibliography~ heading~ '#1'~ undefined. }
\keys_define:nn { csl / bib-heading }
@@ -426,6 +521,10 @@
\expandafter \newcommand \csname __csl_head_ #1 :n \endcsname [1] [ {#2} ]
}
+
+\cs_if_exist:NF \refname
+ { \cs_set:Npn \refname { References } }
+
\cs_if_exist:NTF \chapter
{
% `book` or `report`
@@ -437,19 +536,19 @@
\defbibheading { biblist } [ \biblistname ]
{
\chapter* {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { bibintoc } [ \bibname ]
{
\chapter* {#1}
\addcontentsline { toc } { chapter } {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { biblistintoc } [ \biblistname ]
{
\chapter* {#1}
\addcontentsline { toc } { chapter } {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { bibnumbered } [ \bibname ]
{ \chapter {#1} }
@@ -459,7 +558,7 @@
{
\section* {#1}
\if@twoside
- \markright { \MakeMarkcase {#1} }
+ \markright { \MakeUppercase {#1} }
\fi
}
\defbibheading { subbibintoc } [ \refname ]
@@ -467,7 +566,7 @@
\section* {#1}
\addcontentsline { toc } { section } {#1}
\if@twoside
- \markright { \MakeMarkcase {#1} }
+ \markright { \MakeUppercase {#1} }
\fi
}
\defbibheading { subbibnumbered } [ \refname ]
@@ -483,19 +582,19 @@
\defbibheading { biblist } [ \biblistname ]
{
\section* {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { bibintoc } [ \refname ]
{
\section* {#1}
\addcontentsline { toc } { section } {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { biblistintoc } [ \biblistname ]
{
\section* {#1}
\addcontentsline { toc } { section } {#1}
- \@mkboth { \MakeMarkcase {#1} } { \MakeMarkcase {#1} }
+ \@mkboth { \MakeUppercase {#1} } { \MakeUppercase {#1} }
}
\defbibheading { bibnumbered } [ \refname ]
{ \section {#1} }
@@ -531,7 +630,7 @@
{
\prop_get:NnNF \l__csl_bib_notes_prop {#1} \l_tmpa_tl
{
- \msg_error:nnn { citation-style-language } { bib-note-undefined }
+ \msg_error:nnn { citation-style-language } { undefined-bib-note }
{#1}
}
\tl_if_empty:NF \l_tmp_tl
@@ -547,7 +646,7 @@
}
}
-\msg_new:nnn { citation-style-language } { bib-note-undefined }
+\msg_new:nnn { citation-style-language } { undefined-bib-note }
{ Bibliography~ note~ '#1'~ undefined. }
@@ -593,7 +692,7 @@
\tl_put_right:Nn \l_tmpa_tl { ##1 = {##2} }
}
\sys_if_engine_luatex:T
- { \lua_now:e { csl.set_categories("\l_tmpa_tl") } }
+ { \lua_now:e { csl_citation_manager:set_categories("\l_tmpa_tl") } }
{
\tl_put_left:Nx \l_tmpa_tl { categories = \c_left_brace_str }
\tl_put_right:NV \l_tmpa_tl \c_right_brace_str