[LibreOffice] URLs as hyperlinks

When a zotero item has a URL attribute it should be entered as a hyperlink into the document.

According to adamsmith on Apr 27th 2012 that is currently not possible.

If that is still true, I would like to inquire for the technical reasons and possibly start a discussion about how to achieve this in future.

Edit: format as HTML
  • edited September 10, 2012
    This has been implemented in the citeproc-js CSL processor. The option is turned off by default, but it can be woken up quite easily. At the moment, there is only code in place for links in HTML output. If someone can post an example of what a link looks like in RTF (the lingo spoken to the word processor plugins), I'll be happy to add make RTF wrappers available in the processor as well.

    (Edit: after that, it would be up to the core devs of Zotero to decide whether and how to tie it into the Zotero preference system -- it can't be turned on always, since not everyone will want it for all documents.)
  • edited September 10, 2012
    A quick Google for "RTF hyperlink" pointed me to a relevant Stackoverflow question.

    As towards the "can't be turned on always" I would refer to a question I previously answered here.

    Edit: format as HTML
  • Thanks for the Stackflow link. As for when to toggle on linking, I overspoke: how and when to invoke the facility is up to the core developers, full stop.
  • You're absolutely right.
  • Unfortunately the code under that link does not seem to work correctly in the word processor plugins, at least with LibreOffice. I've kept the code in a comment for reference, so that someone who knows more about RTF and the word processors can take a look.

    Here's a link to the relevant file in the citeproc-js source code:

    https://bitbucket.org/fbennett/citeproc-js/src/3110df61a4e6/src/formats.js#cl-318
  • edited September 10, 2012
    From what I can see there are some brackets in the wrong position.

    return "\\field{\\*\\fldinst{HYPERLINK \"" + str + "\"}}{\\fldrslt{"+ str +"}}";

    should be

    return "\\field{\\*\\fldinst HYPERLINK \"" + str + "\"}{\\fldrslt " + str + "}";

    assuming that the output gets wrapped into {} later.
  • Is that based on something in the specification? On the face of it, I don't see how removing the internal braces would make a difference.
  • edited September 10, 2012
    I did a quick test. Created RTF using LibreOffice. Opened it in a text editor; looked at the actual output and compared it with your code.

    If you look closely it's not only the inner bracket. After the closing field there is one bracket less which probably makes the difference. diff.
  • Okay, I tried the code you suggest, and it fails to set the link wrapper.

    Again, someone who knows the RTF specification will know whether this will work in the first place, and if so what can be done to get it working. I understand your impatience, but I'm not the person you need for the initial work on this. I've pointed out the place in the code where an adjustment should be made, I can't take it any further than that.
  • Sorry when it seemed like I was impatient. I am just trying to help as much as possible. Let's hope someone can take it from here.
  • No problem. It will be a nice feature when it arrives.
Sign In or Register to comment.