Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Sep 11, 2023
1 parent 813af9c commit c7510cd
Show file tree
Hide file tree
Showing 7 changed files with 3,004 additions and 139 deletions.
4 changes: 4 additions & 0 deletions citeproc/citeproc-latex-core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ local function read_data_files(data_files)
local csl_items = {}

local file, format, contents = read_data_file(data_file)
util.debug(format)
util.debug(contents)

if contents then

Expand All @@ -142,9 +144,11 @@ local function read_data_files(data_files)

elseif format == "bibtex" then
local bib_data, exceptions = bibtex_parser.parse(contents, bibtex_strings)
util.debug(bib_data)
if bib_data then
bibtex2csl = bibtex2csl or require("citeproc-bibtex2csl")
csl_items = bibtex2csl.convert_to_csl_data(bib_data, true, true, true, true)
util.debug(csl_items)
for _, entry in ipairs(bib_data.entries) do
if not bibtex_entries[entry.key] then
bibtex_entries[entry.key] = entry
Expand Down
6 changes: 3 additions & 3 deletions submodules/styles/apa.csl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<category citation-format="author-date"/>
<category field="psychology"/>
<category field="generic-base"/>
<updated>2023-07-16T18:56:49-04:00</updated>
<updated>2023-09-11T12:11:00+08:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale xml:lang="en">
Expand Down Expand Up @@ -1656,13 +1656,13 @@
</layout>
</citation>
<bibliography hanging-indent="true" et-al-min="21" et-al-use-first="19" et-al-use-last="true" entry-spacing="0" line-spacing="2">
<sort>
<!-- <sort>
<key macro="author-bib"/>
<key macro="date-sort-group"/>
<key macro="date-bib" sort="ascending"/>
<key variable="status"/>
<key macro="title"/>
</sort>
</sort> -->
<layout>
<choose>
<!-- TODO: Add new item types -->
Expand Down
24 changes: 24 additions & 0 deletions tests/latex/luatex-1/style-apa.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
\input{regression-test}

\documentclass{article}

\input{csl-test}

\usepackage{citation-style-language}

\cslsetup{
regression-test = true,
style = apa,
}
\addbibresource{biblatex-apa-test-references.bib}


\begin{document}

\START

\nocite{*}

\printbibliography

\end{document}
47 changes: 47 additions & 0 deletions tests/latex/luatex-1/style-apa.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
No file style-apa.aux.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line ....
LaTeX Font Info: Trying to load font information for TS1+cmr on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
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 ....
>
\l__csl_citation_info_tl=citationID={9.8:1@1},citationItems={{id={9.8:1}}},properties={noteIndex={0}}.
<recently read> }
l. ...\cite{9.8:1}
Module citeproc Warning: Didn't find a database entry for '9.8:1' on input line ...
LaTeX Warning: Citation `9.8:1' on page 1 undefined on input line ....
> \l__csl_citation_tl=(\textbf {9.8:1}).
<recently read> }
l. ...\cite{9.8:1}
>
\l__csl_citation_info_tl=citationID={@nocite},citationItems={{id={*}}},properties={noteIndex={0}}.
<recently read> }
l. ...\nocite{*}
> \l__csl_citation_tl=.
<recently read> }
l. ...\nocite{*}
The sequence \l__csl_bibliography_seq contains the items (without outer
braces):
> {\begin {thebibliography}{index = 1, hanging-indent = true, line-spacing =
2, entry-spacing = 0}}
> {\end {thebibliography}}.
<recently read> }
l. ...
Package citation-style-language Warning: The bibliography is empty.
[1
] (style-apa.aux)
LaTeX Warning: There were undefined references.
Loading

0 comments on commit c7510cd

Please sign in to comment.