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

Highlight one or more authors #361

Open
JulioAzcarate opened this issue Jun 22, 2024 · 6 comments
Open

Highlight one or more authors #361

JulioAzcarate opened this issue Jun 22, 2024 · 6 comments

Comments

@JulioAzcarate
Copy link

It would be very useful to have an option to highlight one or more authors in the list of publications.

PS: sorry, I didn't find how to tag this comment as inprove or suggestion.

@inukshuk
Copy link
Owner

Good idea!

The first approach that comes to mind is to do this by using a bibliography template. In the template you have access to the rendered reference string as well as to the all the entry's individual fields. This means you could, for example, check the entry's authors to see if the author you want to highlight is is present, and if so use a regular expression to wrap the first occurrence of the author in the reference string.

@DerAndereJohannes
Copy link

I also asked myself this today and looked into changing the templates. Here was my solution, feel free to use it:

{% assign new_reference = reference %}
{% for ref_name in site.reference_names %}
    {% assign highlighted_name = '<strong>' | append: ref_name | append: '</strong>' %}
    {% assign new_reference = new_reference | replace: ref_name, highlighted_name %}
{% endfor %}

{{ new_reference }}

This way I can simply define the names in the standard _config.yml file like so:

reference_names:
    - "Name One"
    - "Name Two"

@robaru
Copy link

robaru commented Aug 5, 2024

Hey @DerAndereJohannes, I am trying to apply your template but I don’t manage to get it to work.

I have created a bib.html file into _layouts and referenced in _config.yml. Its content is exactly the one that you provide above.

The _config.yml looks like this:

scholar:
  style: apa
  locale: en
  source: ./assets/
  bibliography: papers.bib
  sort_by: type,year,month
  order: ascending
  group_by: type,year
  bibliography_template: bib
  reference_names:
    - “Name one"

In name one, I have written my full name.

Can I ask for some help?

@DerAndereJohannes
Copy link

Hi @robaru,
Sorry, I should have been a bit more clear. The reference_names does not belong to the scholar repository so you have to place it outside of the scholar tag like I did here.

For you, the change would look like this:

scholar:
  style: apa
  locale: en
  source: ./assets/
  bibliography: papers.bib
  sort_by: type,year,month
  order: ascending
  group_by: type,year
  bibliography_template: bib

reference_names:
  - “Name one"

Let me know if this helped!

@robaru
Copy link

robaru commented Aug 6, 2024

It worked! Thanks!

@Leno4ka94
Copy link

Leno4ka94 commented Sep 2, 2024

@inukshuk @everyone Hi, can somebody help me to add other style to jekyll-scholar for example unified-style-sheet-for-linguistics.csl (zotero style)
I try to add but nothing work. I hope it can be realize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants