How to export references from (LibreOffice) document?

Hello!

I use the Zotero Firefox plugin, and the one for LibreOffice. My Zotero entries are organised with tags, collections or different libraries. After completing a document, I am now looking for a way to export (to BibTeX) only the references I used it that document. Is there any? If not, please consider adding one; preferably the "Edit Bibliography"-screen.

Please see http://drop.pr/Nxy0WQ.png . IMHO even the possibility to drag-and-drop selected references from the right to a folder/collection on the left would help. But a dedicated export option would be neater :-)

Thanks and greetings!
  • generally planned (in the form of document collections), but may still take a while.
  • Was this export feature ever implemented?
  • It hasn't been yet, but at least the use case referenced by the original poster can now be met using this external tool:
    https://rintze.zelle.me/ref-extractor/
  • I tried that tool but it didn't find any references in my .odt file. The ref-extractor page says it only works for .docx files so I tried saving my .odt file as .docx (before and after changing from ReferenceMarks to Bookmarks) but the tool still didn't find any references in the file.
  • ah yes, sorry -- you do need Word for this (it requires Word Fields to work, which is why converting to Bookmarks doesn't work). I think it'd be very much possible to extend the tool to work with ODT files, but not sure if Rintze has the time to do that.
  • Can you provide some information about how the bibliographic data are stored within the .odt file? I tried looking at the XML but it wasn't immediately obvious to me what was going on.
  • They're inserted in CSL JSON format within the XML in reference marks, which are marked with the <text:reference-mark-start tag.
    There's a little bit of surrounding JSON that Zotero inserts to mark the citation itself, but that shouldn't be hard to understand.
  • Is the CSL JSON in the .odt file essentially the same as what's in the Fields in the .docx file? Are Word Fields not the same as the Bookmarks that LO can use for sharing with Word?
  • The CSL JSON is not just essentially the same, it's identical. Word Fields are _not_ the same as Bookmarks, no, that's why your attempt to save as .docx didn't work.
  • Thanks, Adam, for all the quick and informative responses.
    If the LO and Word Zotero plugins use the same CSL JSON, it's a shame that LO can't save a document in .docx format with the CSL JSON intact. In trying to get more insight, I found https://github.com/zotero/zotero-libreoffice-integration/issues/39
  • Am I correct in inferring (based on a sample of 1) that the text:reference-mark-start and text:reference-mark-end tags will always have exactly the same contents? Presumably this is for error detection?
  • The ref-extractor page says it only works for .docx files so I tried saving my .odt file as .docx (before and after changing from ReferenceMarks to Bookmarks) but the tool still didn't find any references in the file.
    Did you try:

    * In LibreOffice, change the Zotero citations in the .odt file from ReferenceMarks to Bookmarks.
    * Save the document in LibreOffice as .docx
    * Open the .docx document in Word, and change the Zotero citations from Bookmarks to Fields. Then save the .docx file and try the extractor.

    It sounds like you didn't try the last step, which might be what you're missing.
  • edited June 21, 2018
    As for supporting ODT files directly, I was a bit confused by how Zotero stores metadata in them, so I didn't pursue it any further. (I had the exact same question as @funnell above, see https://groups.google.com/forum/#!topic/zotero-dev/vImXuhjsFw0 and https://github.com/rmzelle/ref-extractor/issues/14#issuecomment-326648468, but didn't get a response to my inquiry).

    One possible explanation is that the value of "text:name" is used both to store the CSL-JSON metadata and to identify which start and end tags belong together, but I'd like to have this confirmed (or at least know for certain that both tags always have the same value so I can just extract the metadata from one).
  • You're right, I didn't try the last step, using Word, which I don't have convenient access to and which I'd rather not have to rely on.
    In the zotero-libreoffice-integration thread on issue 39, users tstenner and adomasven seem to be people who might have the answer to our question about duplication. I don't know what's a good way of bringing their attention to this discussion.
  • You're right, I didn't try the last step, using Word, which I don't have convenient access to and which I'd rather not have to rely on.
    It would be interesting to know if this approach works, though, so please give it a try if you have a chance.
    I don't know what's a good way of bringing their attention to this discussion.
    Zotero developers should be following the zotero-dev mailing list and this forum, but it might be that they're not really sure how the ODT integration works since it might have been created by a former developer. @adomasven, did you ever see my zotero-dev post I linked to above?
  • That post was a while back, but the developers do read every post in the zotero-dev. Although if you get no response on them, it is always okay to ping again - sometimes things do slip by my attention by accident.

    As for the questions regarding ODT xml schema - I have no answers. We only interact with LibreOffice via their plugin APIs and LibreOffice writes the ODT files with all the relevant doc data to disk. You should ask the LO developers.
  • As for the questions regarding ODT xml schema - I have no answers. We only interact with LibreOffice via their plugin APIs and LibreOffice writes the ODT files with all the relevant doc data to disk. You should ask the LO developers.
    Ah, I didn't realize Zotero didn't directly manipulate the XML, but that makes sense. Thanks!

    http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415230_253892949 says:
    A range reference marks a range of characters in text and is represented by two elements; a <text:reference-mark-start> element to mark the start of the range and a following <text:reference-mark-end> element to mark the end of the range.

    Every reference is identified by the value of its text:name attribute, which shall be unique. In a range reference, the start and end elements shall use the same attribute value.
    (emphasis mine)

    So that seems to confirm that the text:name attribute value on the start and end tags of any given reference is always the same, which should make supporting ODT files in my reference extractor fairly trivial. It's a bit silly to use the complete CSL JSON string as a identifier, but I'm not sure Zotero can do anything about that. Although maybe you could store this metadata on the <text:meta> or<text:meta-field> attributes?
Sign In or Register to comment.