Skip to content

Commit

Permalink
Added bibtex filter to hide custom bibtex keywords from bib file outp…
Browse files Browse the repository at this point in the history
  • Loading branch information
tonnesfn authored and zkotti committed Dec 10, 2022
1 parent 99cbcd4 commit 4a9bcc6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ scholar:

query: "@*"

filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website] # Filter out certain bibtex entry keywords used internally from the bib output

# -----------------------------------------------------------------------------
# Responsive WebP Images
Expand Down
2 changes: 1 addition & 1 deletion _layouts/bib.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
{% if entry.bibtex_show -%}
<!-- Hidden bibtex block -->
<div class="bibtex hidden">
{% highlight bibtex %}{{ entry.bibtex }}{% endhighlight %}
{% highlight bibtex %}{{ entry.bibtex | hideCustomBibtex }}{% endhighlight %}
</div>
{%- endif %}
</div>
Expand Down
15 changes: 15 additions & 0 deletions _plugins/hideCustomBibtex.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Jekyll
module HideCustomBibtex
def hideCustomBibtex(input)
keywords = @context.registers[:site].config['filtered_bibtex_keywords']

keywords.each do |keyword|
input = input.gsub(/^.*#{keyword}.*$\n/, '')
end

return input
end
end
end

Liquid::Template.register_filter(Jekyll::HideCustomBibtex)

0 comments on commit 4a9bcc6

Please sign in to comment.