BibTeX Parser (version 1.5.3)
MoinMoin processor for BibTeX entries.
Copyright (C) 2004-2007 Jun Hu <j.hu@tue.nl>
Copyright (C) 2004 Alexandre Duret-Lutz <adl@gnu.org>
Copyright (C) 2010-2011 Bruno Lopes http://www.tecmf.inf.puc-rio.br/BrunoLopes
This module is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
Contents
Download
http://github.com/blopesvieira/MoinMoin-Parser-BibTeX2
Purpose
This module will run BibTeX blocks such as the following through bibtex2html (removing the whitespace between each "{" and "}").
{ { {#!bibtex @Book{aho.74, author= {Alfred V. Aho and John E. Hopcroft and Jeffrey D. Ullman}, title = {The Design and Analysis of Computer Algorithms}, publisher= {Addison-Wesley}, year = {1974}, } } } }
Several BibTeX entries can be listed into the same block (and they can \cite each other). The 'comment' element can be used to display a comment below each entry.
HlinsDatabase
If your wiki contains a page named HlinsDatabase, then the output of bibtex2html will be processed to add hyperlinks, using the contents of HlinsDatabase as input. It will search for:
first level bullet lists that are formatted as wiki external links:
* [url name]
first level bullet lists that contains a '=':
* name = url
and first level description lists
name:: url
to build a mapping list.
For example, if there is a line
* [http://www.google.com Google]
or
* Google = http://www.google.com
or
Google:: http://www.google.com
All the appearance of 'Google' in the bibtex2html output will be replaced with '<a href="http://www.google.com">Google</a>'. The white spaces around mapping pairs will be stripped.
HTML tags are not allowed to appear in the keywords to prevent abuse.
URL links and moin attachments
Bibtex2html uses some additional fields such as "ftp", "http", "url", "ps" ,"dvi", "rtf", "pdf", "documenturl", "urlps" and "urldvi" in bibtex database. Web links are automatically inserted. The link name depends on the nature of the link:
- it is the file suffix, whenever this suffix is .dvi, .ps, .pdf,
- rtf, .txt or .html, possibly followed by a compression sufix,
- gz, .Z or .zip;
- otherwise the name of the link is either http or ftp depending on the protocol.
This parser also supports moin attachment links in these fields. for example:
{ { {#!bibtex abstract=off usekeys=off keywords=off style=alpha @INPROCEEDINGS{Hu+JanseETAL-UserEvalDistInte:05, author = {Hu, J. and Janse, M.D. and Kong, H.}, title = {User Evaluation on a Distributed Interactive Movie}, booktitle = {HCI International 2005 (accepted)}, year = {2005}, pdf = {attachment:HCII2005.pdf}, ps = {attachment:HCII2005.ps.gz}, } } } }
Parameters
- style = [plain|unsrt|alpha|abbrv]
default style is plain.
- hlinsdb = <WikiPage>
<WikiPage> will be used as input, instead of the default HlinsDatabase
- keywords = [on|off]
- whether to show keywords (if any),
default is on
- abstract = [on|off]
- whether to show abstract (if any),
default is on
- usekeys = [on|off]
- whether to use the cite keys from the BibTeX input file (and not the ones generated by the BibTeX
style file). default is on.
Examples
- Formatted references:
- hyperlink database:
Revision history
1.5.3 By BrunoLopes
- Support to lower-case BibTeX style file names.
1.5.2 By BrunoLopes
Support to MoinMoin up to 1.9
1.5.1 By JunHu
Thanks to Joachim Selke (http://www.joachim-selke.de) again for the suggestion of moving the configuration lines in the code to wiki configuration. According to Joachim, "This should simplify updates of bibtex.py a lot."
- I cannot get bibtex to work. The os.popen3 output stream does not contain any text. I wrote a junk script with the same syntax but separate from Moin which works fine (the html output is produced). Also, the -c option to specify bibtex does not work for me, I removed it from popen3. I kept getting a /tmp/bib...html file not found error. When tried on the command-line, it works fine without -c. Any help will be appreciated!
1.5.0 By JunHu
- Version number jumps to 1.5.0 serials. Nothing really special about this jump, just to indicate that this parser works well
in MoinMoin 1.5.
Thanks to Joachim Selke (http://www.joachim-selke.de) for the ideas to improve the parser (quote from the email from Joachim):
- The documentation says that attachments can be included e.g. by using
the line pdf = {attachment:foo.pdf}. Unfortunately, on my system this does not work. I had to use pdf = {./attachment:foo.pdf}. Thus, I suggest the following change to bibtex.py: Replace line 208 by if not url.startswith('attachment:'): Replace line 211 by url = url[11:]
I use MoinMoin on a server where no TeX system is installed and where
- I am not allowed to install it. Therefore, I had to put the binaries for bibtex and bibtex2html somewhere in my server directory and add their locations to the lines 177 and 178 in bibtex.py. But this was not enough to get bibtex to work. I also had to specify where the BibTeX style files (.bst) are located. This can be set using the environment variable BSTINPUTS. Thus, I suggest the following additions to bibtex.py: Insert at line 179: bstfiles = '/path/to/bstfiles' Insert at line 246:
os.environBSTINPUTS = bstfiles
- I am not allowed to install it. Therefore, I had to put the binaries for bibtex and bibtex2html somewhere in my server directory and add their locations to the lines 177 and 178 in bibtex.py. But this was not enough to get bibtex to work. I also had to specify where the BibTeX style files (.bst) are located. This can be set using the environment variable BSTINPUTS. Thus, I suggest the following additions to bibtex.py: Insert at line 179: bstfiles = '/path/to/bstfiles' Insert at line 246:
1.3.4 By JunHu
- Added possibilities to refer to moin attachments in bibtex2html additional field whose name is "ftp", "http", "url", "ps" , "dvi", "rtf", "pdf", "documenturl", "urlps" or "urldvi". Limitation: Only the attachments attached to the same page is allowed.
1.3.3-3 By JunHu
ReimarBauer had got some new ideas - formatting the link database items as wiki external links in first level bullet lists. Thank you very much for the nice idea and the example code.
1.3.3-2 By JunHu
ReimarBauer suggested to use the MoinMoin convention for hyperlink database formatting. "In my eyes it is not good to have special list rules to remember. ". I agree. So the old formatting rules from hlins and the ones introduced in 1.3.3 are dropped in this version. However, in my eyes, a description list does not look bad either, so we will use first level bullet lists, and first level description lists as well.
1.3.3-1 By JunHu
- This version does the hyperlink substitution by itself, and hlins is not used anymore.
1.3.0 By JunHu, Rewritten for MoinMoin 1.3 as a parser. This version
- has introduced some parameters. Known bugs:
- For some strange reasons, hlins has problems with blank lines in
HlinsDatabase. Please notice that if anything went wrong during processing, you would possibly get an empty reslut.