Skip to content

Commit

Permalink
fix abstract translation
Browse files Browse the repository at this point in the history
  • Loading branch information
wjschne committed Jul 6, 2024
1 parent a33450a commit 2f336a5
Show file tree
Hide file tree
Showing 16 changed files with 388 additions and 285 deletions.
1 change: 1 addition & 0 deletions .quartoignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ img/newquartodocument.png
img/yamlmetadata.png
img/terminal.png
installation.qmd
Makefile
options.qmd
README.qmd
references.bib
Expand Down
3 changes: 0 additions & 3 deletions _extensions/apaquarto/_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ contributes:
citation-masked-date: "n.d."
email: "Email"
figure-table-note: "Note"
section-title-abstract: "Abstract"
section-title-appendix: "Appedix"
section-title-references: "References"
title-block-author-note: "Author Note"
title-block-correspondence-note: "Correspondence concerning this article should be addressed to"
title-block-role-introduction: "Author roles were classified using the Contributor Role Taxonomy (CRediT; https://credit.niso.org/) as follows:"
Expand Down
11 changes: 9 additions & 2 deletions _extensions/apaquarto/apalanguage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- global quarto params
local paramsJson = quarto.base64.decode(os.getenv("QUARTO_FILTER_PARAMS"))
local quartoParams = quarto.json.decode(paramsJson)

quarto.log.output(quartoParams)
local function param(name, default)
-- get name from quartoParams, if possible
local value = quartoParams[name]
Expand Down Expand Up @@ -56,7 +56,14 @@ Meta = function(m)
m.language["figure-table-note"] = param("callout-note-title")
end
end


-- Find word for "Appendix"
if not m.language["crossref-apx-prefix"] then
if param("crossref-apx-prefix") then
m.language["crossref-apx-prefix"] = param("crossref-apx-prefix")
end
end

for i,x in ipairs(fields) do
-- In case someone assigned variable to top-level meta instead of to language
if m[x.field] then
Expand Down
2 changes: 2 additions & 0 deletions apaquarto.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ tr:nth-child(even) {
background-color: #e1e7ed;
}

li.nav-item {border-color: red;}

5 changes: 5 additions & 0 deletions changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ engine: knitr
* Full language option support


# Version 4.3.3 (2024-07-04)

- Fixed `lang` option for abstract. Documented language options that are likely to be used in apaquarto.


# Version 4.3.2 (2024-06-19)

- [#76](https://github.com/wjschne/apaquarto/issues/76) Fixed bug that failed to account for user-specified terms in `crossref`
Expand Down
11 changes: 9 additions & 2 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.37">
<meta name="generator" content="quarto-1.5.53">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>APA Style Documents with apaquarto – Changelog</title>
<title>Changelog – APA Style Documents with apaquarto</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down Expand Up @@ -163,6 +163,7 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#future-version-wishlist" id="toc-future-version-wishlist" class="nav-link active" data-scroll-target="#future-version-wishlist">Future Version Wishlist</a></li>
<li><a href="#version-4.3.3-2024-07-03" id="toc-version-4.3.3-2024-07-03" class="nav-link" data-scroll-target="#version-4.3.3-2024-07-03">Version 4.3.3 (2024-07-03)</a></li>
<li><a href="#version-4.3.2-2024-06-19" id="toc-version-4.3.2-2024-06-19" class="nav-link" data-scroll-target="#version-4.3.2-2024-06-19">Version 4.3.2 (2024-06-19)</a></li>
<li><a href="#version-4.3.1-2024-05-28" id="toc-version-4.3.1-2024-05-28" class="nav-link" data-scroll-target="#version-4.3.1-2024-05-28">Version 4.3.1 (2024-05-28)</a></li>
<li><a href="#version-4.3.0-2024-05-22" id="toc-version-4.3.0-2024-05-22" class="nav-link" data-scroll-target="#version-4.3.0-2024-05-22">Version 4.3.0 (2024-05-22)</a></li>
Expand Down Expand Up @@ -247,6 +248,12 @@ <h1>Future Version Wishlist</h1>
</ul></li>
</ul>
</section>
<section id="version-4.3.3-2024-07-03" class="level1">
<h1>Version 4.3.3 (2024-07-03)</h1>
<ul>
<li>Fixed <code>lang</code> option for abstract. Documented language options that are likely to be used in apaquarto.</li>
</ul>
</section>
<section id="version-4.3.2-2024-06-19" class="level1">
<h1>Version 4.3.2 (2024-06-19)</h1>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.37">
<meta name="generator" content="quarto-1.5.53">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>APA Style Documents with apaquarto – Introduction to apaquarto</title>
<title>Introduction to apaquarto – APA Style Documents with apaquarto</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down
288 changes: 149 additions & 139 deletions docs/installation.html

Large diffs are not rendered by default.

91 changes: 62 additions & 29 deletions docs/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.37">
<meta name="generator" content="quarto-1.5.53">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>APA Style Documents with apaquarto – Template Options</title>
<title>Template Options – APA Style Documents with apaquarto</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down Expand Up @@ -278,7 +278,7 @@ <h1 class="title">Template Options</h1>
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true" tabindex="-1"></a><span class="pp">---</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<section id="general-options" class="level1">
<h1>General Options</h1>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -339,7 +339,8 @@ <h1>General Options</h1>
</tr>
<tr class="even">
<td style="text-align: left;"><code>numbered-lines</code></td>
<td style="text-align: left;">Numbered lines (.pdf and .docx only)</td>
<td style="text-align: left;"><p>Numbered lines (.pdf and .docx only)</p>
<p>Default: <code>false</code></p></td>
</tr>
<tr class="odd">
<td style="text-align: left;"><code>bibliography</code></td>
Expand Down Expand Up @@ -424,7 +425,7 @@ <h2 class="anchored" data-anchor-id="authors">Authors</h2>
<section id="affiliations" class="level2">
<h2 class="anchored" data-anchor-id="affiliations">Affiliations</h2>
<p>The apaquarto extenstion uses the <a href="https://quarto.org/docs/journals/authors.html#affiliations-schema">standard Quarto schema for affiliations</a>.</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -559,7 +560,7 @@ <h3 class="anchored" data-anchor-id="listing-authors-and-affiliations-separately
<section id="author-roles" class="level2">
<h2 class="anchored" data-anchor-id="author-roles">Author Roles</h2>
<p>APA Style encourages but does not require papers with multiple authors to describe author roles using the <a href="https://credit.niso.org/">Contributor Roles Taxonomy</a> (CRediT). There are 14 contributor roles:</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -663,7 +664,7 @@ <h2 class="anchored" data-anchor-id="author-roles">Author Roles</h2>
<h2 class="anchored" data-anchor-id="author-notes">Author Notes</h2>
<p>The first paragraph of the Author Note will be populated with all the ORCID IDs that have been specified.</p>
<p>The second paragraph consists of status changes:</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -694,7 +695,7 @@ <h2 class="anchored" data-anchor-id="author-notes">Author Notes</h2>
</tbody>
</table>
<p>The third paragraph consists of study details and author disclosures:</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -771,7 +772,7 @@ <h2 class="anchored" data-anchor-id="author-notes">Author Notes</h2>
</section>
<section id="options-for-.docx-and-typst" class="level1">
<h1>Options for .docx and typst</h1>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -800,7 +801,7 @@ <h1>Options for .docx and typst</h1>
<section id="options-for-.pdf" class="level1">
<h1>Options for .pdf</h1>
<p>All of the .pdf-specfic options for apaquarto come directly from the <a href="https://ctan.org/pkg/apa7?lang=en">apa7 <span class="math inline">\(\LaTeX\)</span> package</a>. Consult the apa7 package documentation for greater detail.</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -879,7 +880,7 @@ <h1>Options for .html</h1>
<section id="suppress-elements" class="level1">
<h1>Suppress Elements</h1>
<p>Any of the elements below can be selectively suppressed from the document.</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 50%">
<col style="width: 50%">
Expand Down Expand Up @@ -981,7 +982,7 @@ <h1>Suppress Elements</h1>
<section id="language-options" class="level1">
<h1>Language Options</h1>
<p>You can alter the names of Abstract, Figures, Tables, and References by setting the <code>lang</code> field to one of these languages:</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 25%">
<col style="width: 75%">
Expand Down Expand Up @@ -1052,7 +1053,7 @@ <h1>Language Options</h1>
</tbody>
</table>
<p>However, there are a few options that are specific to apaquarto and thus were not anticipated by Quarto.</p>
<table class="table-primary table">
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 30%">
<col style="width: 40%">
Expand Down Expand Up @@ -1082,16 +1083,6 @@ <h1>Language Options</h1>
<td><em>n.d.</em></td>
</tr>
<tr class="even">
<td><code>citation-masked-title</code></td>
<td>The phrase to replace the title in a masked reference</td>
<td><em>Masked Title</em></td>
</tr>
<tr class="odd">
<td><code>section-title-appendix</code></td>
<td>The heading for Appendices</td>
<td><em>Appendix</em></td>
</tr>
<tr class="even">
<td><code>title-block-author-note</code></td>
<td>The heading of the author note</td>
<td><em>Author Note</em></td>
Expand Down Expand Up @@ -1120,14 +1111,56 @@ <h1>Language Options</h1>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">citation-masked-author</span><span class="kw">:</span><span class="at"> </span><span class="st">"Cita Enmascarada"</span></span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">citation-masked-title</span><span class="kw">:</span><span class="at"> </span><span class="st">"Título Enmascarado"</span></span>
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">citation-masked-date</span><span class="kw">:</span><span class="at"> </span><span class="st">"n.f."</span></span>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">section-title-appendix</span><span class="kw">:</span><span class="at"> </span><span class="st">"Apéndice"</span></span>
<span id="cb37-8"><a href="#cb37-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-author-note</span><span class="kw">:</span><span class="at"> </span><span class="st">"Nota de Autores"</span></span>
<span id="cb37-9"><a href="#cb37-9" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-correspondence-note</span><span class="kw">:</span><span class="at"> </span><span class="st">"La correspondencia relativa a este artículo debe dirigirse a"</span></span>
<span id="cb37-10"><a href="#cb37-10" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-role-introduction</span><span class="kw">:</span><span class="at"> </span><span class="st">"Los roles de autor se clasificaron utilizando la taxonomía de roles de colaborador (CRediT; https://credit.niso.org/) de la siguiente manera:"</span></span>
<span id="cb37-11"><a href="#cb37-11" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">references-meta-analysis</span><span class="kw">:</span><span class="at"> </span><span class="st">"Las referencias marcadas con un asterisco indican estudios incluidos en el metanálisis."</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>In addition, many terms translated automatically can be overridden. The full list is <a href="https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/language/_language.yml">here</a>. For example, if I wanted “Figure” in figure captions to be “Plot” instead, I would specify the change like so:</p>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-author-note</span><span class="kw">:</span><span class="at"> </span><span class="st">"Nota de Autores"</span></span>
<span id="cb37-8"><a href="#cb37-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-correspondence-note</span><span class="kw">:</span><span class="at"> </span><span class="st">"La correspondencia relativa a este artículo debe dirigirse a"</span></span>
<span id="cb37-9"><a href="#cb37-9" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title-block-role-introduction</span><span class="kw">:</span><span class="at"> </span><span class="st">"Los roles de autor se clasificaron utilizando la taxonomía de roles de colaborador (CRediT; https://credit.niso.org/) de la siguiente manera:"</span></span>
<span id="cb37-10"><a href="#cb37-10" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">references-meta-analysis</span><span class="kw">:</span><span class="at"> </span><span class="st">"Las referencias marcadas con un asterisco indican estudios incluidos en el metanálisis."</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>In addition, many terms that are translated automatically can be overridden. The full list is <a href="https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/language/_language.yml">here</a>. For example, if I wanted “Figure” in figure captions to be “Plot” instead, I would specify the change like so:</p>
<div class="sourceCode" id="cb38"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a><span class="fu">language</span><span class="kw">:</span><span class="at"> </span></span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">crossref-fig-title</span><span class="kw">:</span><span class="at"> </span><span class="st">"Plot"</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>Here are the language terms most likely to be used in apaquarto:</p>
<table class="table-primary caption-top table">
<colgroup>
<col style="width: 60%">
<col style="width: 40%">
</colgroup>
<thead>
<tr class="header">
<th>Field: English Default</th>
<th>Explanation</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>section-title-abstract: Abstract</code></td>
<td>Abtract title</td>
</tr>
<tr class="even">
<td><code>section-title-references: References</code></td>
<td>References title</td>
</tr>
<tr class="odd">
<td><code>title-block-keywords: Keywords</code></td>
<td>Keywords</td>
</tr>
<tr class="even">
<td><code>crossref-fig-title: Figure</code></td>
<td>Figure title prefix</td>
</tr>
<tr class="odd">
<td><code>crossref-tbl-title: Table</code></td>
<td>Table title prefix</td>
</tr>
<tr class="even">
<td><code>crossref-apx-prefix: Appendix</code></td>
<td>Appendix title prefix</td>
</tr>
<tr class="odd">
<td><code>crossref-eq-prefix: Equation</code></td>
<td>Equation title prefix</td>
</tr>
</tbody>
</table>


</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/resources.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.37">
<meta name="generator" content="quarto-1.5.53">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">


<title>APA Style Documents with apaquarto – Resources</title>
<title>Resources – APA Style Documents with apaquarto</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
Expand Down
4 changes: 2 additions & 2 deletions docs/site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/site_libs/quarto-html/quarto.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
for (const child of el.children) {
child.style.opacity = 0;
child.style.overflow = "hidden";
child.style.pointerEvents = "none";
}

nexttick(() => {
Expand Down Expand Up @@ -360,6 +361,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {

const clone = child.cloneNode(true);
clone.style.opacity = 1;
clone.style.pointerEvents = null;
clone.style.display = null;
toggleContents.append(clone);
}
Expand Down Expand Up @@ -434,6 +436,7 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
for (const child of el.children) {
child.style.opacity = 1;
child.style.overflow = null;
child.style.pointerEvents = null;
}

const placeholderEl = window.document.getElementById(
Expand Down
6 changes: 5 additions & 1 deletion docs/site_libs/quarto-search/quarto-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,11 @@ async function fuseSearch(query, fuse, fuseOptions) {

// If we don't have a subfuse and the query is long enough, go ahead
// and create a subfuse to use for subsequent queries
if (now - then > kFuseMaxWait && subSearchFuse === undefined) {
if (
now - then > kFuseMaxWait &&
subSearchFuse === undefined &&
resultsRaw.length < fuseOptions.limit
) {
subSearchTerm = query;
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
resultsRaw.forEach((rr) => {
Expand Down
Loading

0 comments on commit 2f336a5

Please sign in to comment.