I wanted to display my publications as a WP page. I already use bibtex2html to generate html pages with crossref from my BibTeX files. There are some other ways to do this, including another version of bibtex2html, a jabref export, and even a WP plugin. However, I prefer the output of the tool created by Grégoire Malandain.
First thing I did was to modify custom-layout.c in bibtex2html so that the default output is created with the UTF-8 charset instead than the ISO-8859-1. This way I can keep the default WP UTF-8 charset. It is not possible to use two charsets within the same document I think. Apparently, characters in strings are not encoded in UTF-8 when you write them to a file from a C program. I do not know enough about this, so I used an ugly hack which consisted in filtering every HTML file generated by bibtex2html with a python script I found there . I added a system call in bibtex2html to execute this script every time a HTML file is created. That slows the generation of HTML quite a bit, but it works.
Then I created a template for my publication page (publications.php). Basically, I just added
/*
Template Name: My publication page
*/
?>
at the top of a copy of the page.php of my theme, and replaced the usual content by the HTML file corresponding to my publications. You can generate a page for a single author with bibtex2html, see the documentation for details. The page is generate by creating an empty WP Page with the new template.
I had a bit of trouble with the icons used for PDF, PS and WWW links in bibtex2html. The relative paths were not working, probably due to the rewrite rules used for permalinks. I placed at the top of the publications.php file, and it solved the problem (see here). The links to the PDF are not working unless you write a mod_rewrite rule (in that case I had to edit classes.php inside the wp-includes directory and set var $use_verbose_rules = false; to true, and update my permalink structure, see here). Another solution, in my case, was to create a symlink to my pdf files in the parent directory of the WP root, since my pdf links are defined as ../pdf/file.pdf in my BibTeX file.
Everything seems to work now.
No comments:
Post a Comment