Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a plugin to filter irrelevant bibtex keywords from bib output #652

Merged
merged 1 commit into from
May 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,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 @@ -153,7 +153,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)