Skip to content

Commit

Permalink
Change package name to citation-style-language
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Jan 21, 2022
1 parent 1beb554 commit 283fbae
Show file tree
Hide file tree
Showing 52 changed files with 183 additions and 133 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.hd
build/
csl-ctan/
csl-doc.pdf
csl.tds/
doc/csl-doc.pdf
*-doc.pdf
*-ctan/
*.tds/
example/example.json
example/example.pdf

Expand Down
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
.PHONY: install test
.PHONY: ctan doc install save test

test:
busted --run=citeproc

ctan:
l3build ctan

doc:
latexmk -cd doc/citation-style-language-doc.tex

install:
l3build install

ctan:
l3build ctan
save:
bash tools/l3build-save.sh
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [Citation Style Language](https://citationstyles.org/)} (CSL) is an XML-base
There are currently thousands of styles in CSL including the most widely used APA, Chicago, Vancouver, etc.
The `citeproc-lua` project is a Lua implementation of CSL v1.0.1 processor that is aimed for use with LaTeX.
The engine reads bibliographic metadata and performs sorting and formatting on both citations and bibliography according to the selected CSL style.
A LaTeX package (`csl.sty`) is provided to communicate with the processor.
A LaTeX package (`citation-style-language.sty`) is provided to communicate with the processor.

This project is in early development stage and some feature of CSL (especially collapsing and disambiguation) are not implemented yet. Comments, suggestions and bug reports are welcome.

Expand All @@ -16,7 +16,7 @@ A full LaTeX example is in the [`example/`](example) directory.
```latex
\documentclass{article}
\usepackage{csl}
\usepackage{citation-style-language}
\cslsetup{style = apa}
\addbibresource{example.bib}
Expand Down
18 changes: 9 additions & 9 deletions build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-- Configuration file of "citeproc" for use with "l3build"

module = "csl"
module = "citation-style-language"

docfiledir = "./doc"
testfiledir = "./test/latex"
Expand All @@ -27,9 +27,9 @@ sourcefiles = {
"styles/*.csl"
}
tagfiles = {
"latex/csl.sty",
"latex/citation-style-language.sty",
"citeproc/citeproc.lua",
"doc/csl-doc.tex",
"doc/citation-style-language-doc.tex",
"doc/citeproc.1",
"CHANGELOG.md",
}
Expand All @@ -49,22 +49,22 @@ asciiengines = {}
packtdszip = true

tdslocations = {
"tex/latex/csl/styles/*.csl",
"tex/latex/csl/locales/csl-locales-*.xml",
"tex/latex/citation-style-language/styles/*.csl",
"tex/latex/citation-style-language/locales/csl-locales-*.xml",
}

function update_tag(file, content, tagname, tagdate)
local version_pattern = "%d[%d.]*"
local url_prefix = "https://github.com/zepinglee/citeproc-lua/compare/"
if file == "csl.sty" then
if file == "citation-style-language.sty" then
return string.gsub(content,
"\\ProvidesExplPackage %{csl%} %{[^}]+%} %{[^}]+%}",
"\\ProvidesExplPackage {csl} {" .. tagdate .. "} {" .. tagname .. "}")
"\\ProvidesExplPackage %{citation-style-language%} %{[^}]+%} %{[^}]+%}",
"\\ProvidesExplPackage {citation-style-language} {" .. tagdate .. "} {" .. tagname .. "}")
elseif file == "citeproc.lua" then
return string.gsub(content,
'citeproc%.__VERSION__ = "' .. version_pattern .. '"',
'citeproc.__VERSION__ = "' .. string.sub(tagname, 2) .. '"')
elseif file == "csl-doc.tex" then
elseif file == "citation-style-language-doc.tex" then
return string.gsub(content,
"\\date%{([^}]+)%}",
"\\date{" .. tagdate .. " " .. tagname .. "}")
Expand Down
24 changes: 12 additions & 12 deletions doc/csl-doc.tex → doc/citation-style-language-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
\begin{document}

\title{%
\pkg{csl} --- Citation Style Language for LaTeX
Bibliography formatting with \pkg{citation-style-language}
}

\author{%
Expand Down Expand Up @@ -59,12 +59,12 @@ \section{Introduction}
is an XML-based language that defines the formats of citations and bibliography.
There are currently thousands of styles in CSL including the most widely used
APA, Chicago, Vancouver, etc.
The \pkg{csl} package is aimed to provide another reference formatting method
The \pkg{citation-style-language} package is aimed to provide another reference formatting method
for LaTeX that utilizes the CSL styles.
It contains a citation processor implemented in pure Lua (\pkg{citeproc-lua})
which reads bibliographic metadata and performs sorting and formatting on both
citations and bibliography according to the selected CSL style.
A LaTeX package (\file{csl.sty}) is provided to communicate with the processor.
A LaTeX package (\file{citation-style-language.sty}) is provided to communicate with the processor.

Note that this project is in early development stage and some feature of CSL
are not implemented yet (especially collapsing and disambiguation).
Expand All @@ -73,11 +73,11 @@ \section{Introduction}

\section{Getting started}

An example of using \pkg{csl} package is as follows.
An example of using \pkg{citation-style-language} package is as follows.

\begin{LaTeXdemo}
\documentclass{...}
\usepackage{csl}
\usepackage{citation-style-language}
\cslsetup{
style = ...,
...
Expand Down Expand Up @@ -125,7 +125,7 @@ \section{Package commands}
\end{syntax}
\end{function}

The behavior of the \pkg{csl} package is controlled by several key-value
The behavior of the \pkg{citation-style-language} package is controlled by several key-value
options which can be set with the \cs{cslsetup} command.
For example,
\begin{LaTeXdemo}
Expand Down Expand Up @@ -174,7 +174,7 @@ \section{Package commands}
the CSL style file will be used.
The locale falls back to ``\opt{en}'' (English) if the attribute is not set.
When \pkg{babel} package is loaded, the selected main language is implicitly set
as the \opt{locale} for \pkg{csl}.
as the \opt{locale} for \pkg{citation-style-language}.

\DescribeOption{bib-font}
Usually, the list of references is printed in the same font style and size as
Expand Down Expand Up @@ -263,7 +263,7 @@ \section{Package commands}
In other packages, several commands are provided for producing citations in
different styles such as \cs{citet}, \cs{citep}, \cs{parencite}, and
\cs{footnotecite}.
In \pkg{csl} package, however, the format of citations is fixed as formatted
In \pkg{citation-style-language} package, however, the format of citations is fixed as formatted
in CSL style and it is impossible to select another format without modifying
the \file{.csl} style file.
Note that narrative citation (like ``Doe (2018)'') will be supported in CSL 1.1.
Expand Down Expand Up @@ -296,7 +296,7 @@ \section{Compatibility with other packages}

\paragraph{\pkg{babel}}

The main language set by \pkg{babel} is used as the locale for \pkg{csl}.
The main language set by \pkg{babel} is used as the locale for \pkg{citation-style-language}.

\paragraph{\pkg{hyperref}}

Expand All @@ -306,8 +306,8 @@ \section{Compatibility with other packages}

\paragraph{Incompatible packages}

The following packages are not compatible with \pkg{csl}.
An error will be triggered if any of them is loaded together with \pkg{csl}.
The following packages are not compatible with \pkg{citation-style-language}.
An error will be triggered if any of them is loaded together with \pkg{citation-style-language}.
\begin{itemize}
\item \pkg{babelbib}
\item \pkg{backref}
Expand All @@ -330,7 +330,7 @@ \section{Compatibility with other packages}

\section{Known issues}

The \pkg{csl} package is in early development stage and there are some issues with it.
The \pkg{citation-style-language} package is in early development stage and there are some issues with it.

\begin{itemize}
\item The \pkg{citeproc-lua} has not implemented all the features of CSL,
Expand Down
2 changes: 1 addition & 1 deletion example/example.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\documentclass{article}

\usepackage{csl}
\usepackage{citation-style-language}

\cslsetup{style = apa}
\addbibresource{example.bib}
Expand Down
2 changes: 1 addition & 1 deletion example/latexmkrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$bibtex = '"$(kpsewhich -var-value=TEXMFHOME)"/scripts/csl/citeproc %O %S';
$bibtex = '"$(kpsewhich -var-value=TEXMFHOME)"/scripts/citation-style-language/citeproc %O %S';
26 changes: 13 additions & 13 deletions latex/csl.sty → latex/citation-style-language.sty
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\RequirePackage{xparse}
\ProvidesExplPackage {csl} {2021-12-18} {v0.1.0}
\ProvidesExplPackage {citation-style-language} {2021-12-18} {v0.1.0}
{Citation Style Language for LaTeX}

% \msg_new:nnn { csl } { require-luatex }
% { LuaTeX~ is~ required~ for~ `csl'~ package. }
% \sys_if_engine_luatex:F { \msg_fatal:nn { csl } { require-luatex } }
% \msg_new:nnn { citation-style-language } { require-luatex }
% { LuaTeX~ is~ required~ for~ `citation-style-language'~ package. }
% \sys_if_engine_luatex:F { \msg_fatal:nn { citation-style-language } { require-luatex } }

\sys_if_engine_luatex:T
{ \lua_now:n { csl = require("csl") } }
Expand All @@ -21,9 +21,9 @@
\cs_new:Npn \csl_incompatible_package:n #1
{
\AtBeginOfPackageFile* { #1 }
{ \msg_error:nnn { csl } { incompatible-package } { #1 } }
{ \msg_error:nnn { citation-style-language } { incompatible-package } { #1 } }
}
\msg_new:nnn { csl } { incompatible-package }
\msg_new:nnn { citation-style-language } { incompatible-package }
{ The~ `#1'~ package~ is~ incompatible~ with~ `citeproc'. }

\csl_incompatible_package:n { babelbib }
Expand Down Expand Up @@ -127,7 +127,7 @@
{
\tl_set:Nn \l__csl_citation_tl { [ \textbf { #1 } ] }
\G@refundefinedtrue
\exp_args:Nnnx \msg_warning:nnn { csl } { citation / undefined } { #1 }
\exp_args:Nnnx \msg_warning:nnn { citation-style-language } { citation / undefined } { #1 }
\group_begin:
\reset@font [ \textbf { #1 } ]
\group_end:
Expand All @@ -147,7 +147,7 @@
}


\msg_new:nnn { csl } { citation / undefined }
\msg_new:nnn { citation-style-language } { citation / undefined }
{
Citation~ `#1'~ on~ page~ \thepage \space undefined~ \msg_line_context: .
}
Expand Down Expand Up @@ -339,14 +339,14 @@
{
\bool_if:NTF \l__csl_engine_initialized_bool
{ \lua_now:n { csl.bibliography() } }
{ \msg_warning:nnn { csl } { bibliography / empty } }
{ \msg_warning:nnn { citation-style-language } { bibliography / empty } }
}
{
\tl_if_empty:NTF \l__csl_bibliography_tl
{
\file_if_exist_input:nF { \jobname .bbl }
{
\msg_warning:nnx { csl } { file / non-exist} { \jobname .bbl }
\msg_warning:nnx { citation-style-language } { file / non-exist} { \jobname .bbl }
}
}
{ \exp_args:NV \csl_print_bibiliography_tl \l__csl_bibliography_tl }
Expand All @@ -360,10 +360,10 @@
\end { thebibliography }
}

\msg_new:nnn { csl } { bibliography / empty }
\msg_new:nnn { citation-style-language } { bibliography / empty }
{ The~ bibliography~ is~ empty. }

\msg_new:nnn { csl } { file / non-exist }
\msg_new:nnn { citation-style-language } { file / non-exist }
{ No~ file~ #1. }


Expand Down Expand Up @@ -799,7 +799,7 @@
{
\l__csl_bib_postamble_tl
\tl_set:Nn \@noitemerr
{ \msg_warning:nnn { csl } { bibliography / empty } }
{ \msg_warning:nnn { citation-style-language } { bibliography / empty } }
\endlist
\csl_reset_bib_format:
}
Expand Down
2 changes: 1 addition & 1 deletion test/latex/luatex-1-bibstyle-in-preamble.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

\input{csl-test}

\usepackage{csl}
\usepackage{citation-style-language}

\bibliographystyle{apa}

Expand Down
26 changes: 17 additions & 9 deletions test/latex/luatex-1-bibstyle-in-preamble.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Don't change this file in any respect.
TEST 1: Single cite item in a citation
============================================================
\g__csl_citation_count_ITEM-1_int=\count...
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
Expand All @@ -14,55 +15,62 @@ l. ...}
TEST 2: Multiple cite items in a citation
============================================================
\g__csl_citation_count_ITEM-1,ITEM-2_int=\count...
Package csl Warning: Citation `ITEM-1, ITEM-2' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1, ITEM-2' on page 1
(citation-style-language) undefined on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1, ITEM-2}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 3: Citation with page locator
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 4: Citation with section locator
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 5: Citation with implicit page locator
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 6: Citation with prefix and suffix
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 7: Citation with suffix
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
============================================================
============================================================
TEST 8: Citation with prefix
============================================================
Package csl Warning: Citation `ITEM-1' on page 1 undefined on line ....
Package citation-style-language Warning: Citation `ITEM-1' on page 1 undefined
(citation-style-language) on line ....
> \l__csl_citation_tl=[\textbf {ITEM-1}].
<recently read> }
l. ...}
Expand All @@ -78,7 +86,7 @@ l. ...}
============================================================
TEST 10: Bibilography
============================================================
Package csl Warning: The bibliography is empty.
Package citation-style-language Warning: The bibliography is empty.
============================================================
[1
] (luatex-1-bibstyle-in-preamble.aux)
Expand Down
2 changes: 1 addition & 1 deletion test/latex/luatex-1-bibstyle.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

\input{csl-test}

\usepackage{csl}
\usepackage{citation-style-language}


\begin{document}
Expand Down
Loading

0 comments on commit 283fbae

Please sign in to comment.