Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upConvert to citations/bibliography rather than links #24
Comments
This comment has been minimized.
This comment has been minimized.
It'd definitely be desirable, but it wouldn't be easy. Currently the thing that makes the tool uncomplicated is that it doesn't need to talk to Zotero at all during the scan. All the citation data is added when setting a citation style in LibreOffice. The scan just converts the markers to LO Reference Marks with Zotero format and Zotero item.uris that allow for updating. The relevant function is here: https://github.com/Juris-M/zotero-odf-scan-plugin/blob/master/chrome/content/rtfScan.js#L271 Hope you like regular expressions ;) |
This comment has been minimized.
This comment has been minimized.
The talking to Zotero bit isn't really too hard. Is https://github.com/Juris-M/zotero-odf-scan-plugin/blob/master/chrome/content/rtfScan.js#L512 the central function that orchestrates the finding and replacing, and https://github.com/Juris-M/zotero-odf-scan-plugin/blob/master/chrome/content/rtfScan.js#L594 the part that does the actual replacements? If I may ask, why use regexes when FF has XML/XPath functionality built in? |
This comment has been minimized.
This comment has been minimized.
I don't think there's a strong reason to use regex over XML except that Frank likes regex (the original tool this is based on was in python I think, but it's not like that would have made using XML/XPATH impossible). Might be that it actually ends up being more stable given different interpretation of the ODF XML model, but also possible that the reverse is true. Certainly worth testing out. |
This comment has been minimized.
This comment has been minimized.
You're not the first to ask that question. The problem is that the target string may be cross-nested with XML tags that capture a larger run of document text. Identifying the string and isolating it for replacement using XML methods would be very hard to do. It would also be slower to run (because you would need to iterate to the top of the XML hierarchy to determine that a given match attempt had failed). I offered that explanation at the time, and it didn't find favor, but that's the reason behind using regex there. |
retorquere commentedFeb 6, 2019
I'm interested in adding the possibility to have the ODF-scanner use the Zotero-embedded citeproc to create a finalized document; not to remove the existing functionality to create a Zotero-compatible document but so that I can use Word-online + ODF scan without requiring the use of Word to finalize the document. Would this be:
and if so, can you point me to the part of the code that does the current replacement?