Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to configure output template #19

Open
ludzeller opened this issue Oct 6, 2017 · 7 comments
Open

Add a way to configure output template #19

ludzeller opened this issue Oct 6, 2017 · 7 comments

Comments

@ludzeller
Copy link

ludzeller commented Oct 6, 2017

Could there be an easy way to configure the way the txt files are configured, look and which fields they output? A templating system would do of course, but maybe a little manual on how to change the code would also do the trick for now. Thing is, I know nothing about python...

@Xunius
Copy link
Owner

Xunius commented Oct 6, 2017

Hi ludzeller,

That's a good idea. In fact I'm planning a major update and a template system is one of the ideas I want to implement, but I'm still learning some GUI things. So the quickest solution might be you paste me a couple of templates you would like to have, and let me see whether I could come up with a quick patch for you. Since you are running the python script directly on Mac, I think with a couple of templates as reference it would be much easier for you to craft your own templates.

@Xunius
Copy link
Owner

Xunius commented Oct 6, 2017

Ah, could you also do me a favor? In the docs you export, do you have any notes in the "Notes" tag in the right-side-panel in Mendeley? Because I noticed that I can't find them in the Mendeley datafile anymore, and the tool can't fetch them either, and I wonder could it be that Mendeley has changed the way it saves such notes. I'm on Mendeley 1.17.10, and I can't find them on Linux or Win.

@ludzeller
Copy link
Author

ludzeller commented Oct 17, 2017

Of course, here would be my dream template (at the moment...)

--------------------------------------------------------------------------------
# entry title

Comment #: {enumerator}
Page #: {page number in PDF}
Created: 2017-10-06 13:18:07
Text: That's a good idea. In fact I'm planning a major update and a template system is one of the ideas I want to implement, but I'm still learning some GUI things. So the quickest solution might be you paste me a couple of templates you would like to have, and let me see whether I could come up with a quick patch for you. Since you are running the python script directly on Mac, I think with a couple of templates as reference it would be much easier for you to craft your own templates

---

Comment #: {enumerator}
Page #: {page number in PDF}
Created: 2017-10-06 13:18:07
Text: That's a good idea. In fact I'm planning a major update and a template system is one of the ideas I want to implement, but I'm still learning some GUI things. So the quickest solution might be you paste me a couple of templates you would like to have, and let me see whether I could come up with a quick patch for you. Since you are running the python script directly on Mac, I think with a couple of templates as reference it would be much easier for you to craft your own templates

---

Having the page number would be extremely useful for citing! Even if the PDF does not start at page 1 of the actual publication, it would still be much easier to use that as an offset and to calculated the actual page numbers by hand.

In the docs you export, do you have any notes in the "Notes" tag in the right-side-panel in Mendeley?

Yes, I use the Notes field excessively. And yes, it is exported in the according txt file as the first entry of all of them. (In the case of two PDFs it was exported twice at the beginning, even though the Notes field does not differ for each PDF. There is just one per Mendeley entry.)

It would of course be nicer if the Notes was styled a little bit differently at the beginning of the txt.

Notes: That's a good idea. In fact I'm planning a major update and a template system is one of the ideas I want to implement, but I'm still learning some GUI things. So the quickest solution might be you paste me a couple of templates you would like to have, and let me see whether I could come up with a quick patch for you. Since you are running the python script directly on Mac, I think with a couple of templates as reference it would be much easier for you to craft your own templates

@Xunius
Copy link
Owner

Xunius commented Nov 6, 2017

Hi ludzeller,
Very sorry for the delay, I was literally "engaged" during the previous 2 weeks ;)
Now I'm working on a solution to get your template. Just want to confirm one point: in your template, the "Comment" field is the notes you put in Mendeley on top of a highlight section, and "Text" field is the text that gets highlighted, am I right? So you want to export each piece of original highlighted texts grouped with your own comment?
If so, I think it's doable but I need to mess around a bit. But for those notes that are not attached to any highlights but just attached onto a page in the PDF, that will probably give you some "Text" field that doesn't make much sense on its own.

@ludzeller
Copy link
Author

ludzeller commented Nov 8, 2017

Congratulations for your engagement, if that's what you mean!

And thanks for getting back, really appreciating your help. I will be in the process of writing down my PhD thesis over the coming months and your code could really save my day!

Actually, I both didn't know that the highlights can be read out and linked with comments as well. If that's the case (and I often right-clicked on a highlight to add a note, now assuming I have actually created a linked data structure with that) then it would be fantastic to render them accordingly for output.

That brings me to this new dream template. I think there would be three scenarios:

  • Highlights linked with comment
  • Just highlights without linked comment
  • Just comments without linked highlight

See the templates below. Is that actually feasible?

--------------------------------------------------------------------------------
# entry title
# Highlights linked with comment

Highlight #: {enumerator}
Page #: {page number in PDF}
Created: 2017-10-06 13:18:07
Text: The highlighted text.
Comment: The comment linked to it.

---
#Just comments 

Comment #: {enumerator}
Page #: {page number in PDF}
Created: 2017-10-06 13:18:07
Comment: The comment linked to it.

---
#Just highlights 

Highlight #: {enumerator}
Page #: {page number in PDF}
Created: 2017-10-06 13:18:07
Text: The comment linked to it.

@Xunius
Copy link
Owner

Xunius commented Nov 9, 2017

Hi ludzeller,

I've come up with a new update to add the functionality to design template for the annotations. Please get the new code and check it out.
Specifically, under the "lib" folder you can modify the file "annotation_template.py" to change the template. I've put some instructions in it, and the template itself should be self-explanatory enough to understand.

Regarding the notes associated with highlights, there is no hard link saved into the mendeley data file, so I'm using geometrical closeness to infer a linkage. I found that if you click on a highlighted text and then add note, the location of the note is almost certainly inside the bounding box of the highlight, therefore suggesting a linkage. For a note inserted at page margin, if it is close enough to a block of highlighted texts, I think it could also infer a linkage. How close this needs to be is defined by a parameter "MAX_ASSOCIATE_DIST" in "annotation_template.py". If you want to disable the 2nd scenario, just set "MAX_ASSOCIATE_DIST" to 0, then only those notes added by clicking a highlight get associated.

Give it a try and let me know if there is any trouble. Good luck with the thesis!

@ludzeller
Copy link
Author

Hi Xunius,

I finally found the time to check your latest commits, thanks so much for your time!

Unfortunately the -t flag doesn't seem to work properly. Basically all the outputs are just empty then.

Should I maybe send you my sqlite file so that you have something to test against? If so, please drop me a line at [email protected].

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants