theBenForce / logseq-plugin-my-highlights

Import highlights from various sources
MIT License
36 stars 4 forks source link

too many pages created due to author names with commas #26

Closed Dieterbe closed 2 years ago

Dieterbe commented 2 years ago

for example, the page highlights/book/Abundance: The Future Is Better Than You Think has this metadata:

type:: Book
last_sync:: 2022-08-19T06:00:10.749Z
author:: Diamandis, Peter H.;Kotler, Steven
alias:: Abundance - Highlights
title:: highlights/book/Abundance: The Future Is Better Than You Think
source-book-ids:: c09ed53e1147551a70d5e4de53802532100ac485f3914c5be09f5f85

when I go to "all pages", in logseq, i see this: pages looks like all the comma characters cause a new page to be created.

The same also happens with single-author books, for example

author:: Vance, Ashlee
alias:: Elon Musk - Highlights

this will create a page "Vance", and one "Ashlee"

theBenForce commented 2 years ago

I was thinking about this one earlier. Are you okay with author pages being created with correct names (that would be my preference) or would you like the option to store them as a string w/o links?

Dieterbe commented 2 years ago

I don't understand the question but author pages with correct names sounds great. I would not try to rearrange names, but just honor the syntax which kindle uses, which is ";" separates between names and "," is part of text and can be ignored. So it would be pages like "Vance, Ashlee", "Diamandis, Peter H" and "Kotler, Steven" ? Is there a tradeoff or downside in doing this ?

theBenForce commented 2 years ago

No downside, I just prefer names without the comma. I'll add an option so that I can remove the comma but have it default to the order that Kindle has it.

Thanks for the feedback!

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 1.16.5 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

Dieterbe commented 2 years ago

I tried the new "Author First Name First" option, but it doesn't change anything for me. I even tried restarting logseq. After every re-import of highlights, the authors appear exactly in the book page medatadata as they did before. Anyway, i think this problem is orthogonal to whether first name comes first or not, as it is caused by the "," in the authors, and lack of [[ ]] around metadata values with whitespace

after checking https://docs.logseq.com/#/page/term%2Fproperties and doing some of my own experimentation, it looks like instead of formatting like so:

author:: Diamandis, Peter H.;Kotler, Steven                                                                                                                                                                         

it should instead be:

author:: [[Diamandis, Peter H.]], [[Kotler, Steven]]  

i looked at your code changes, and it seems you already worked on something along these lines. but a new import does not have any effect. it still generates the old/incorrect syntax for me. (i have plugin 1.16.7, logseq 0.8.1 )

Dieterbe commented 2 years ago

hmm.. it seems like if i delete all the highlight pages, and then re-import everything, it works as expected. IOW. the exported pages are only truly refreshed if they are manually deleted first ?

theBenForce commented 2 years ago

Not sure why that's the case, I'm telling logseq to update the property on every import: https://github.com/theBenForce/logseq-plugin-my-highlights/blob/main/src/actions/syncBookHighlights.ts#L26