Skip to content

Commit

Permalink
fix abstract indenting with multiple paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
wjschne committed Mar 16, 2024
1 parent 110fc83 commit 02e23ca
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 18 deletions.
2 changes: 1 addition & 1 deletion _extensions/apaquarto/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: My Document in APA Style, Seventh Edition
author: W. Joel Schneider
version: 3.4.4
version: 3.4.5
quarto-required: ">=1.4.549"
contributes:
formats:
Expand Down
2 changes: 1 addition & 1 deletion _extensions/apaquarto/apa.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ blockquote p:nth-child(1) {text-indent: 0}

.tabwid {padding: 0}

.Abstract p {text-indent: 0}
.AbstractFirstParagraph p {text-indent: 0}
Binary file modified _extensions/apaquarto/apaquarto.docx
Binary file not shown.
26 changes: 24 additions & 2 deletions _extensions/apaquarto/docxfrontmatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,39 @@ return {

if pandoc.utils.type(meta.apaabstract) == "Blocks" then
local abstractdiv = pandoc.Div({})
local abstractfirstparagraphdiv = pandoc.Div({})
local abstractlinecounter = 1
meta.apaabstract:walk {
LineBlock = function(lb)
lb:walk {
Inlines = function(el)
local lbpara = pandoc.Para(el)
abstractdiv.content:extend({lbpara})

if abstractlinecounter == 1 then
abstractfirstparagraphdiv.content:extend({lbpara})
abstractfirstparagraphdiv.classes:insert("AbstractFirstParagraph")

else
abstractdiv.content:extend({lbpara})
if abstractlinecounter == 2 then
abstractdiv.classes:insert("Abstract")
end

end

abstractlinecounter = abstractlinecounter + 1
end
}
end
}
body:extend({abstractdiv})
if abstractlinecounter > 1 then
body:extend({abstractfirstparagraphdiv})
end

if abstractlinecounter > 2 then
body:extend({abstractdiv})
end

end

end
Expand Down
1 change: 1 addition & 0 deletions _extensions/apaquarto/docxstyler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ customclasses = {
"Author",
"AuthorNote",
"Abstract",
"AbstractFirstParagraph",
"FigureTitle",
"FigureNote",
"FigureWithNote",
Expand Down
5 changes: 5 additions & 0 deletions changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ engine: knitr
- Typst version that would allow for easy customization


# Version 3.4.5 (2024-03-1+)

- Indent abstract with multiple paragraphs properly
- Title on first page of text is no longer numbered when `number-sections` is `true`

# Version 3.4.4 (2024-03-10)

- `supress-title-page` option to suppress title page
Expand Down
45 changes: 32 additions & 13 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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.24">
<meta name="generator" content="quarto-1.5.25">

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

Expand Down Expand Up @@ -134,6 +134,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-3.4.5-2024-03-10" id="toc-version-3.4.5-2024-03-10" class="nav-link" data-scroll-target="#version-3.4.5-2024-03-10">Version 3.4.5 (2024-03-10)</a></li>
<li><a href="#version-3.4.4-2024-03-10" id="toc-version-3.4.4-2024-03-10" class="nav-link" data-scroll-target="#version-3.4.4-2024-03-10">Version 3.4.4 (2024-03-10)</a></li>
<li><a href="#version-3.4.3-2024-03-08" id="toc-version-3.4.3-2024-03-08" class="nav-link" data-scroll-target="#version-3.4.3-2024-03-08">Version 3.4.3 (2024-03-08)</a></li>
<li><a href="#version-3.4.2-2024-03-06" id="toc-version-3.4.2-2024-03-06" class="nav-link" data-scroll-target="#version-3.4.2-2024-03-06">Version 3.4.2 (2024-03-06)</a></li>
Expand Down Expand Up @@ -193,6 +194,13 @@ <h1>Future Version Wishlist</h1>
<li>Typst version that would allow for easy customization</li>
</ul>
</section>
<section id="version-3.4.5-2024-03-10" class="level1">
<h1>Version 3.4.5 (2024-03-10)</h1>
<ul>
<li>Indent abstract with multiple paragraphs properly</li>
<li>Title on first page of text is no longer numbered when <code>number-sections</code> is <code>true</code></li>
</ul>
</section>
<section id="version-3.4.4-2024-03-10" class="level1">
<h1>Version 3.4.4 (2024-03-10)</h1>
<ul>
Expand Down Expand Up @@ -364,18 +372,7 @@ <h1>Version 1.0.0 (2023-03-05)</h1>
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
const onCopySuccess = function(e) {
// button target
const button = e.trigger;
// don't keep focus
Expand Down Expand Up @@ -407,7 +404,29 @@ <h1>Version 1.0.0 (2023-03-05)</h1>
}, 1000);
// clear code selection
e.clearSelection();
}
const getTextToCopy = function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
text: getTextToCopy
});
clipboard.on('success', onCopySuccess);
if (window.document.getElementById('quarto-embedded-source-code-modal')) {
// For code content inside modals, clipBoardJS needs to be initialized with a container option
// TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860)
const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
text: getTextToCopy,
container: window.document.getElementById('quarto-embedded-source-code-modal')
});
clipboardModal.on('success', onCopySuccess);
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var mailtoRegex = new RegExp(/^mailto:/);
var filterRegex = new RegExp('/' + window.location.host + '/');
Expand Down
2 changes: 1 addition & 1 deletion minimal.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ author-note:
financial-support: ~
gratitude: ~
authorship-agreements: ~
abstract: "This document is a template"
abstract: "This document is a template."
keywords: [keyword1, keyword2, keyword3]
bibliography: bibliography.bib
format:
Expand Down

0 comments on commit 02e23ca

Please sign in to comment.