MartinPaulEve / meTypeset

meTypeset is a tool to convert from Microsoft Word .docx format to NLM/JATS-XML for scholarly/scientific article typesetting.
Other
89 stars 32 forks source link

How configure meTypeset to read from a local Zotero database? #120

Open juanCure opened 6 years ago

juanCure commented 6 years ago

Hi @MartinPaulEve I don't know if this is the correct place to my question. i apologize for it.

However I have 2 doubts:

  1. How configure meTypeset for read from a local Zotero database?
  2. What is the best way of load the references in Zotero database for match with the references in the Microsoft Word document?

I hope you could give response to my doubts.

Best, juanCure

withanage commented 6 years ago

Hi JuanCure,

How configure meTypeset for read from a local Zotero database?

You have to change the settings.xml in your local installation and run meTypeset with option --zotero
https://github.com/MartinPaulEve/meTypeset/blob/master/bin/settings.xml#L85

For finding the zotero database path: https://www.zotero.org/support/zotero_data

What is the best way of load the references in Zotero database for match with the references in the Microsoft Word document?

When running in Zotero modus, meTypeset code queries the zotero sqlite database and matches the results with the references in Word.

To get the best results, you should have something similar to a one-to-one relationship with the references in Word document and your Zotero database. I would recommend to have a one zotero database for your monograph or journal article.

For edited volumes, I would suggest to make one zotero database for chapter file and process chapters individually.

If your zotero database contains duplicate results for a similar query, meTypeset is unable to predict the exact result. code

Another future solution is for meTypeset to query the Zotero API directly using the unique record identifiers of zotero and you add zotero identifiers in a reference in Word document. But this is not yet a feature in meTypeset as far as I know.

juanCure commented 6 years ago

Thanks a lot for your response @withanage

I have set mt:zotero with the path to my local zotero database, I have changed the mt:databasefile value as zotero.sqlite too, but I have the doubt if this is necessary? I have made this because in the database path there is not the bibliography.db file however there is the zotero.sqlite file.

After I have run the command meTypeset with the necessary parameters but I have got the following messages of errors:

Traceback (most recent call last):
  File "/usr/local/meTypeset/bin/meTypeset.py", line 256, in <module>
    main()
  File "/usr/local/meTypeset/bin/meTypeset.py", line 252, in main
    me_typeset_instance.run()
  File "/usr/local/meTypeset/bin/meTypeset.py", line 244, in run
    self.run_modules()
  File "/usr/local/meTypeset/bin/meTypeset.py", line 228, in run_modules
    BibliographyDatabase(self.gv).run()
  File "/usr/local/meTypeset/bin/bibliographydatabase.py", line 422, in run
    self.process_zotero()
  File "/usr/local/meTypeset/bin/bibliographydatabase.py", line 403, in process_zotero
    ref = etree.fromstring(res)
  File "src/lxml/lxml.etree.pyx", line 3213, in lxml.etree.fromstring (src/lxml/lxml.etree.c:82934)
  File "src/lxml/parser.pxi", line 1819, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:124533)
  File "src/lxml/parser.pxi", line 1700, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:122964)
  File "src/lxml/parser.pxi", line 1040, in lxml.etree._BaseParser._parseUnicodeDoc (src/lxml/lxml.etree.c:116705)
  File "src/lxml/parser.pxi", line 573, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:110510)
  File "src/lxml/parser.pxi", line 683, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:112276)
  File "src/lxml/parser.pxi", line 613, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:111124)
lxml.etree.XMLSyntaxError: StartTag: invalid element name, line 1, column 731

I will create a new issue for report this errors, but I take the opportunity to ask you, because I think this message error has relation with this issue.