pcooksey / bibtex-js

BibTeX-js can parse a BibTeX-file and render it as part of an HTML file. This way, you can easily add a list of publications to your private homepage or display a list of recommended publications for a seminar. The way the entries are display can be customized using a simple template system and CSS.
MIT License
270 stars 68 forks source link

<span class="if BIBTEXTYPE==article">Artikel</span> #37

Closed Abakaba closed 6 years ago

Abakaba commented 6 years ago

Can I use the if statement also for BIBTEXTYPE?

pcooksey commented 6 years ago

There is no == for the if statements. They only check if a class exists for that bibtex entry.

Currently if you use the bibtextype it will take the values found in this link. What you want is to customize the output for each bibtex type?

pcooksey commented 6 years ago

Please checkout the develop branch (2e6098d1ae27d076b6a59c3c51ae563ddbb342a0) and let me know if it handles your case. I added == to the if statements. So in your case it should work like so:

<span class="if BIBTEXTYPEKEY==@ARTICLE">Artikel</span>

Notice that I've used BIBTEXTYPEKEY and not BIBTEXTYPE which is set internally to defined values. The wiki was missing BIBTEXTYPEKEY updated wiki link. Also, @ARTICLE needs to be capitalized and have an @ symbol in the beginning.

Abakaba commented 6 years ago

Cool! This works nicely! Many thanks. This allows me now to have a lable on the publication type per bibtex entry. As soon as my page is ready, I will share it with you.

Abakaba commented 6 years ago

I am just wondering if you plan to merge this feature in the master branch? Furthermore, it seems like the develop branch (2e6098d) an d all latest branches do not display special characters. e.g. {\~n} or {\'o}.

I would really appreciate if you can generate one version which contains the functionality Artikel and displays special characters.

Many thanks in advance.

pcooksey commented 6 years ago

Of course! Just got a little busy. I've merged the == into master (2e6098d1ae27d076b6a59c3c51ae563ddbb342a0).

As for the displaying special characters,

  1. Special characters are entered as {\"a} or {\"{a}} not \"{a}.

So you should escape the special character. This was found in Chapter 2 Helpful Tips So, it works for me when doing {\~n}

That said, I do believe there are some lingering issues with the special character display. So I'll create a new issue #38 for generating a test for all the special characters that are supported by bibtex. However, this may take some time as I am in the middle of other work.

pcooksey commented 6 years ago

I'm closing this issue. Please refer to issue #38 if you are still having issues with displaying special characters.