Zotero export to plain (html) table?
Hello,
I work (on linux) on a large bibliography, and I'm really happy with Zotero. My problem ist that I am asked to deliver a plain html file with a table in it. At the moment I use Zotero's Bibtex export, open it with JabRef and use JabRef's .sxc/.ods/.html export feature. Things that get lost are: Author/Contributor/Translator classification of the name and some other fields like "Extra" or "Repository". Any idea?
Thanks in advance, hippiecore
I work (on linux) on a large bibliography, and I'm really happy with Zotero. My problem ist that I am asked to deliver a plain html file with a table in it. At the moment I use Zotero's Bibtex export, open it with JabRef and use JabRef's .sxc/.ods/.html export feature. Things that get lost are: Author/Contributor/Translator classification of the name and some other fields like "Extra" or "Repository". Any idea?
Thanks in advance, hippiecore
but Zotero has a html export (Create Bib from Selected Items -> html)
The foundation I work for wants plain tables like this:
http://www.fsancho-sabio.es/html/goikolea.html
I'd have to include several more fields from Zotero, at least the tags and the "extra" field, where I store the basque translation of the item's title.
Furthermore, the Zotero html doesn't reproduce the weblinks properly (cuts them before the last dot) and it doesn't reproduce all the fields.
And getting the additional fields in - I'd guess you'd have to modify the bibtex export?
(it's really just a little cut and paste, and changing a few tiny parts)
You can put the HTML tags in as suffix and prefix of each part, and you can chose the order of the elements within the bibilography.
The rough version I made is posted here:
http://gist.github.com/188496
And you are very welcome to modify for your purposes. It should work OK - you will need to move some of the fields around, and you might not want the links attached to titles (though they are useful).
Note it gives an error message about the XML when installed (due to the html tags), but it still works fine.
There are some beginners instructions on changing the CSL here, with links on to further information:
http://www.zotero.org/support/csl_simple_edits
I also used the same technique to just put a comma between each field, and so make a CSV format, which can therefore be opened in a spreadsheet easily.
Hope this helps!
Unfortunately not tags this way - csl can't call them (the extra field is "note" for csl I believe).
Komrade, nice if you post your style for csv! That would be the best for me, I'd open it with oo_calc.
(komrade: you can actually validate that style - you had forgotten a date-part in one point and you can change all the html <> to & lt; and > ; (without the space)
http://gist.github.com/188633
but hippiecore is right - the csv would be great! Happy to help you tweak details on that one, too - it would seem hard to get it to put the commas for missing fields (you'd want ,, where a field is missing, right?)
And I understand that csl isn't ideal for this, but javascript is actually hard to learn and those two are the only ways I know to get data out of zotero - better than nothing.
Yes, JS isn't idea;. Am just wondering if their might be other options; like some simpler template-based example such as XSLT. If I were going this, I'd rum the XHTML report output through an XSLT.
but it does put out html perfectly for my purpose.
My point was simply to demonstrate an example that could very easily be modified for what hippiecore needs. I understand that CSL is not designed for this, but in the absence of a real CSV export or customisable html, it has saved me alot of effort and given me exactly what I need for now.
e.g. if hippiecore edits my example:
change: <p> and </p>
to: <tr> and </tr>
and change (or add to) the other tags <em>X</em> and <a>X</a>
to make them <td>X</td>
and move or add a few fields into the appropriate order, you should start to get exactly what you need.
My CSV export is also quick-and-dirty - and just uses a custom no-date term for missing fields which I just removed with a search-and-replace once it's into excel.
Again, a fairly dirty hack, but is giving me direct export into exactly the form I want in a spreadsheet, so in the absence of something better...
I never written much html (beyond <blockquote> :-) ) so this is far from obvious to me, but sounds great.
To be more generally applicable, it will probably need lots of individual macros to separate out each element of each item type, and have a null option for each one.
And is there a way to output the "type" of item in CSL? (i.e. thesis, book etc.). I think you came across this issue with the new MLA style?
<if variable="URL">...
<else>...
http://gist.github.com/188806
It's still an alpha draft - there's lots of column matching errors if you mix multiple types.
If you do just journal articles or just books it should work OK.
(you can just do them in a few batches)
For obvious reasons, if you have a comma in the title (or anywhere else) it wont work!
To work better this should probably be coded from scratch using this concept
(i.e. lots of "if-content else-null" macros)
But I haven't got time to fiddle right now - got a PhD to write...
Ideally of course Zotero devs would create a CSV output which just exports the entire database, instead of messy hacks to the csl.
http://www.talklikeapirate.com/piratehome.html
http://gist.github.com/188806
gives excellent results. I just changed all "," delimiters to "%", as that character doesn't appear in the data, and I can import it without any problem to oo_calc.
Now I have to find out a way to include the missing fields.
https://github.com/davidswelt/zot_bib_web
It comes with a Wordpress connector, but runs independently as well (producing HTML).
I hope this is helpful to people finding this thread.