mabentwickeltsich / MendeleyMacros

New functionalities for Mendeley's plugin: hyperlinks for citations pointing to bibliography, hyperlinks for URLs in bibliography, and fix to maintain Microsoft Word style of bibliography.
41 stars 25 forks source link

Doesn't work on APA 5th and 6th Edition #7

Closed daredmayo closed 5 years ago

daredmayo commented 5 years ago

I have try your code and it works perfectly on IEEE style, but i can't use it on APA style. is that any update on APA style or something

mabentwickeltsich commented 5 years ago

Hi @daredmayo,

I will need more than just “it doesn't work”. What commit are you using? Did you change something to the code? What error are you getting?

I know that the code for APA is still buggy and sometimes fails with merged citations. Can you provide a document which generates the error? I may be able to better track the problem.

Regards Luis

rsdonker commented 5 years ago

Hello Luis (@mabentwickeltsich),

I spend a good afternoon today trying to install your macros. They seem perfect! However, just as @daredmayo I seem to run into some troubles with the standard APA 6th edition style when trying to create some cross references.

I have gotten the IEEE style macro to work perfectly after some tries and the APA style macro will also run without any error. However when the APA style is applied using Mendeley the APA macro completes a run without adding hyperlinks to citations in the text that refer to the bibliography. In both cases the macro is still able to convert links within the bibliography itself.

This issue arises even when the document exists of nothing else but a citation and one corresponding reference in the bibliography. I did not modify the code in any way.

I am curious if you could help me resolve this issue.

Kind regards, Rinse

mabentwickeltsich commented 5 years ago

Hi @rsdonker,

Could you provide the document that produces the error? It would be much easier to test the macros with that document in order to track the bug.

Regards Luis

rsdonker commented 5 years ago

Hello @mabentwickeltsich,

Of course. I just made a small example file. Somehow I am not able to upload it with this comment but I did see you provided an email-address to another user on an already closed issue. Could I send the file to you there?

Kind regards,

Rinse

mabentwickeltsich commented 5 years ago

Yes, use that email please.

rsdonker commented 5 years ago

I just send you the document. I hope it arrived at the right address.

mabentwickeltsich commented 5 years ago

Hi @rsdonker,

I think i found the problem but it will take me longer to fully test and perhaps come with a better way to permanently solve the problem.

The way the data is stored within the citation field in Microsoft Word has changed; some blank spaces were removed. The regular expression, used to get information from those fields, expects the blank spaces and fails when they are not present.

Please, try a simple patch in line 340 where variable objRegExpCitationData.Pattern is set:

Regards Luis

rsdonker commented 5 years ago

Hello Luis,

Thank you for looking into this for me. Making the whitespace characters optional did indeed fix my main problem. The script runs again and creates hyperlinks as expected. If nothing else that makes me a happy man.

Kind regards,

Rinse

Edit: Removed the postscriptum as it did not belong to this thread

mabentwickeltsich commented 5 years ago

I assume @daredmayo was having the same problem.

Code already patched. Closing issue.