Skip to content

Commit

Permalink
Fix bibliography heading (#204)
Browse files Browse the repository at this point in the history
After upgrading to pandoc 3.5, the bibliography heading stopped being a
heading due to a change in
jgm/pandoc@3d90234. I thought the
behaviour was a bug and filed jgm/pandoc#10367, but it's behaviour as
expected, and the workaround is simple: just add a heading manually.
This PR removes the metadata setting for the reference section heading,
along with documentation and test updates.
  • Loading branch information
bewuethr authored Nov 8, 2024
1 parent cfa469a commit b852c14
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ the `bibliography` feature:
pbb enable bibliography
```

The bibliography is appended to the end of a post. If you want a heading for
it, just add one to the end of the post.

[`--citeproc`]: <https://pandoc.org/MANUAL.html#citations>

### dot graphs
Expand Down
12 changes: 4 additions & 8 deletions man/pbb.1
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,8 @@ pandoc documentation
for details regarding the format and location of the bibliography as well as how
citations work.
.PP
The heading of the bibliography defaults to \*(lqBibliography\*(rq and can be
adjusted by modifying the value of
.I reference-section-title
in
.IR .metadata.yml .
If you want a heading for the reference section, add one to the end of the
Markdown.
.SS dot graphs
When a code block has the class
.IR dot ,
Expand Down Expand Up @@ -265,10 +262,9 @@ to modify its contents.
.TP
.I .metadata.yml
Stores metadata used by pandoc such as the heading for the table of contents,
the field that controls generation of the table of contents (which can be
and the field that controls generation of the table of contents (which can be
overridden per post, see
.BR OPTIONS ),
and the heading for the bibliography.
.BR OPTIONS ).
.TP
.I assets
Contains various assets used when the blog is built:
Expand Down
1 change: 0 additions & 1 deletion pbb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ init() {
printf '%s\n' \
'toc: false' \
'toc-title: Table of contents' \
'reference-section-title: Bibliography' \
> "$metadata"
git add "$metadata"

Expand Down
7 changes: 4 additions & 3 deletions test/bibliography.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ load test_helper
# My first post
Blah blah [@Ritchie1974].
## Bibliography
EOF

run pbb build
Expand All @@ -24,7 +26,6 @@ load test_helper
cat docs/????-??-??-*.html
grep -Pqz 'data-cites="Ritchie1974">\(Ritchie\sand\sThompson\s1974\)' docs/????-??-??-*.html

# Post contains bibliography; not a heading until jgm/pandoc#10367 is fixed
# grep -q 'id="bibliography".*>Bibliography</h1>' docs/????-??-??-*.html
grep -q '<p>Bibliography</p>' docs/????-??-??-*.html
# Post contains bibliography
grep -q 'id="bibliography".*>Bibliography</h1>' docs/????-??-??-*.html
}
3 changes: 1 addition & 2 deletions test/init.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ load test_helper
# Conf file contains title
grep -Fqx 'blogtitle=Testblog' .pbbconfig

# Metadata file contains TOC and bibliography settings
# Metadata file contains TOC settings
grep -Fqx 'toc: false' .metadata.yml
grep -Fqx 'toc-title: Table of contents' .metadata.yml
grep -Fqx 'reference-section-title: Bibliography' .metadata.yml

# Header file contains title
[[ $(< includes/header.html) == '<div id="blogtitle"><a href="./">Testblog</a></div>' ]]
Expand Down

0 comments on commit b852c14

Please sign in to comment.