Skip to content

Commit

Permalink
correspondence note override
Browse files Browse the repository at this point in the history
  • Loading branch information
wjschne committed Mar 30, 2024
1 parent a43fff4 commit 8365159
Show file tree
Hide file tree
Showing 11 changed files with 327 additions and 328 deletions.
31 changes: 3 additions & 28 deletions _extensions/apaquarto/apamasked.lua
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
--List of masked citations
local maskedcitations = pandoc.List()

--Retrieves citations from metadata
local function getmasked(meta)

if meta["masked-citations"] and meta["mask"] and pandoc.utils.stringify(meta["mask"]) == "true" then
local maskedstrings = meta["masked-citations"]


for i, v in pairs(maskedstrings) do
maskedcitations:insert(pandoc.utils.stringify(v))
end


--local convert2meta = false
--for i, v in ipairs(meta.bibliography or {}) do
-- if pandoc.utils.type(v) == "Inline" then
-- convert2meta = true
-- end
--end
--
--if convert2meta then
-- local orig_bib = meta.bibliography
-- meta.bibliography = pandoc.MetaList{orig_bib}
--end
--
--
--if meta.bibliography then
-- local maskedfile = "_extensions/wjschne/apaquarto/maskedbibliography.bib"
-- meta.bibliography:insert({pandoc.Str(maskedfile)})
-- else
-- meta.bibliography = {{pandoc.Str(maskedfile)}}
--end
--return (meta)

end

end


--Finds citations to be masked and converts them to masked citations
local function maskcite(cite)
local k = 0
local km = 0
Expand Down
16 changes: 9 additions & 7 deletions _extensions/apaquarto/docxfrontmatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ return {

local corresponding_paragraph = pandoc.Para(pandoc.Str(""))
local check_corresponding = false

if meta["author-note"]["correspondence-note"] then
corresponding_paragraph.content:extend(meta["author-note"]["correspondence-note"])
else

for i,a in ipairs(byauthor) do
if a.attributes then
if a.attributes.corresponding and stringify(a.attributes.corresponding) == "true" then
Expand All @@ -396,10 +399,8 @@ return {
corresponding_paragraph.content:extend({pandoc.Str(", Email:")})
corresponding_paragraph = extend_paragraph(corresponding_paragraph, a.email)
end

end
end

end
end

Expand All @@ -416,11 +417,12 @@ return {
for i,j in pairs(correspondencenote) do
corresponding_paragraph.content:insert(i, j)
end

if not mask then
body:extend({corresponding_paragraph})
end
end
end

if not mask then
body:extend({corresponding_paragraph})
end

if meta.apaabstract and #meta.apaabstract > 0 then
local abstractheadertext = pandoc.Str("Abstract")
Expand Down
16 changes: 0 additions & 16 deletions _extensions/apaquarto/header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@
\definecolor{quarto-callout-tip-color-frame}{HTML}{02B875}
\definecolor{quarto-callout-caution-color-frame}{HTML}{FD7E14}


% $if(journalmode1)$
%
% \usepackage{supertabular}
%
% \renewenvironment{longtable}{\begin{supertabular}}{\end{supertabular}}
% \renewcommand{\endhead}{}
% \renewcommand{\endfirsthead}{}
% \renewcommand{\endlastfoot}{}
% \renewcommand{\toprule}[2]{\hline}
% \renewcommand{\midrule}[2]{\hline}
% \renewcommand{\bottomrule}[2]{\hline}
%
% $endif$


\newlength\Oldarrayrulewidth
\newlength\Oldtabcolsep

Expand Down
4 changes: 4 additions & 0 deletions _extensions/apaquarto/title.tex
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@
\par{$for(author-note.disclosures.study-registration)$$it$$sep$$endfor$ $for(author-note.disclosures.data-sharing)$$it$$sep$$endfor$ $for(author-note.disclosures.related-report)$$it$$sep$$endfor$ $for(author-note.disclosures.conflict-of-interest)$$it$$sep$$endfor$ $for(author-note.disclosures.financial-support)$$it$$sep$$endfor$ $for(author-note.disclosures.gratitude)$$it$$sep$$endfor$ $for(author-note.disclosures.authorship-agreements)$$it$$sep$$endfor$ ${for(by-author/first)}${if(it.roles)}Author roles were classified using the Contributor Role Taxonomy (CRediT; https://credit.niso.org/) as follows: ${for(by-author)}${if(it.roles)}${it.apaauthordisplay}: ${for(it.roles)}${it.role}$sep$, ${endfor}${endif}${endfor}${endif}${endfor}${for(by-author/rest)}${if(it.roles)}${for(by-author)}${if(it.roles)}; ${it.apaauthordisplay}: ${for(it.roles)}${it.role}$sep$, ${endfor}${endif}${endfor}${endif}${endfor}}
$if(nocorrespondence)$
$else$
$if(author-note.correspondence-note)$
\par{$author-note.correspondence-note$}
$else$
\par{$language.title-block-correspondence-note$ $for(by-author)$$if(it.attributes.corresponding)$$it.apaauthordisplay$$for(by-author.affiliations)$$if(it.address)$$if(it.department)$, $it.department$$endif$$if(it.name)$, $it.name$$endif$$if(it.address)$, $it.address$$endif$$if(it.city)$, $it.city$$endif$$if(it.region)$, $it.region$$endif$$if(it.postal-code)$ $it.postal-code$$endif$$if(it.country)$, $it.country$$endif$$endif$$endfor$$if(it.email)$, Email: $it.email$$endif$$endif$$endfor$}
$endif$
$endif$
}


1 change: 1 addition & 0 deletions changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ engine: knitr
# Version 3.4.7 (2024-03-29)

- Studies included in a meta-analysis are not usually cited in the text but are [included in the References section and flagged with an asterisk](https://apastyle.apa.org/style-grammar-guidelines/references/meta-analysis-references). When the `meta-analysis` field is set to `true`, citations listed in `nocite` are flagged with an asterisk in References section and a note to that effect is inserted below the References header.
- Allow the correspondence note to be overridden by setting the `correspondence-note` subfield of the `author-note` field.

# Version 3.4.6 (2024-03-22)

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ <h1>Future Version Wishlist</h1>
<h1>Version 3.4.7 (2024-03-29)</h1>
<ul>
<li>Studies included in a meta-analysis are not usually cited in the text but are <a href="https://apastyle.apa.org/style-grammar-guidelines/references/meta-analysis-references">included in the References section and flagged with an asterisk</a>. When the <code>meta-analysis</code> field is set to <code>true</code>, citations listed in <code>nocite</code> are flagged with an asterisk in References section and a note to that effect is inserted below the References header.</li>
<li>Allow the correspondence note to be overridden by setting the <code>correspondence-note</code> subfield of the <code>author-note</code> field.</li>
</ul>
</section>
<section id="version-3.4.6-2024-03-22" class="level1">
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ <h4 class="anchored" data-anchor-id="an-existing-file">An existing file</h4>
});
</script>
</div> <!-- /content -->
<script>var lightboxQuarto = GLightbox({"loop":false,"selector":".lightbox","openEffect":"zoom","descPosition":"bottom","closeEffect":"zoom"});
<script>var lightboxQuarto = GLightbox({"loop":false,"closeEffect":"zoom","selector":".lightbox","descPosition":"bottom","openEffect":"zoom"});
window.onload = () => {
lightboxQuarto.on('slide_before_load', (data) => {
const { slideIndex, slideNode, slideConfig, player, trigger } = data;
Expand Down
Loading

0 comments on commit 8365159

Please sign in to comment.