-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Don't split title with ekg--split-metadata-string
#110
Comments
This is due to the consequence of titles not being unique, which was a deliberate (but perhaps wrong!) design decision. I do think there might be situations in which you want to have two different titles for a doc, although it hasn't actually been useful for me personally yet. We can reconsider that decision, which would necessitate a database upgrade of some sort. |
Just wake up, sorry for late reply. :-)
Now I sort of understand the design and some errors I encountered before. Multiple-title design could be useful for some users, you should keep it there. Then it is just the "comma as separator" thing. The issue is that, commas are quite refrequently used in titles (generated by chatgpt):
Perhaps we could replace comma with other separators, like "\\"? Or just one title at one line in metadata overlay? |
Yes, good point: a comma isn't great as a separator. I think both of your suggestions are reasonable, but I think the two title lines seem best. I'll experiment with that and see if something reasonable can be done. Thank you for raising this! |
Yea, I would prefer this. Take your time. Thanks |
Now properties can have multiple lines in the metadata section. The new const ekg-property-multivalue-type controls how multivalued properties act. This fixes #110.
I checked in a change to develop, PTAL and let me know if that works for you. |
That's a lot of work! It works pretty neat. Also the tags are able to merge if multiple-line. Great! One small itch, the position of TAGs and TITLEs are rotating between each save, as shown beow:
Need a `nreverse' somewhere? Thanks! |
BTW, in |
This address a bug mentioned in #110 (comment).
Hello @ahyatt , Currently (as of c0623a2), 2 tests failed: Selector: "ekg-test-.*"
Passed: 24
Failed: 2 (2 unexpected)
Skipped: 0
Total: 26/26
Started at: 2023-10-31 00:28:49+0800
Finished.
Finished at: 2023-10-31 00:28:54+0800
..F......................F
F ekg-test-draft
(ert-test-failed
((should
(equal target-content (substring-no-properties (buffer-string))))
:form
(equal "Tags: test, date/2023-10-31\n\nfoo"
"Tags: date/2023-10-31, test\n\nfoo")
:value nil :explanation
(array-elt 6 (different-atoms (116 "#x74" "?t") (100 "#x64" "?d")))))
F ekg-test-url-handling
(ert-test-failed
((should
(equal (ekg-document-titles)
(list (cons "http://testurl" "A URL used for testing"))))
:form
(equal
(("http://testurl" . 65) ("http://testurl" . 32)
("http://testurl" . 85) ("http://testurl" . 82)
("http://testurl" . 76) ("http://testurl" . 32)
("http://testurl" . 117) ("http://testurl" . 115)
("http://testurl" . 101) ("http://testurl" . 100) ...)
(("http://testurl" . "A URL used for testing")))
:value nil :explanation
(proper-lists-of-different-length 22 1
(("http://testurl" . 65)
("http://testurl" . 32)
("http://testurl" . 85)
("http://testurl" . 82)
("http://testurl" . 76)
("http://testurl" . 32)
("http://testurl" . 117)
("http://testurl" . 115)
("http://testurl" . 101)
("http://testurl" . 100) ...)
(("http://testurl" .
"A URL used for testing"))
first-mismatch-at 0))) Also, for any
modified ekg.el
(defun ekg-capture-url ()
@@ -1041,8 +1041,7 @@ However, if URL already exists, we edit the existing note on it."
(if existing
(ekg-edit (ekg-get-note-with-id url))
(ekg-capture :tags (list (concat "doc/" (downcase cleaned-title)))
- ;; Remove commas from the value.
- :properties `(:titled/title ,cleaned-title)
+ :properties `(:titled/title ,(list title))
:id url))))
(defun ekg-capture-file ()
@@ -1058,7 +1057,7 @@ file. If not, an error will be thrown."
(if existing
(ekg-edit (ekg-get-note-with-id file))
(ekg-capture :tags (list (concat "doc/" (downcase (file-name-nondirectory file))))
- :properties `(:titled/title ,(file-name-nondirectory file))
+ :properties `(:titled/title ,(list (file-name-nondirectory file)))
:id file)))))
modified ekg-logseq-test.el
(ert-deftest ekg-logseq-test-note-with-resource-and-title-to-logseq ()
@@ -109,7 +109,7 @@
(let ((note (ekg-note-create :text "line1\nline2\n" :mode 'org-mode :tags '("tag1" "tag2" "tag3"))))
(setf (ekg-note-id note) "http://www.example.com")
(setf (ekg-note-modified-time note) 123456789)
- (setf (ekg-note-properties note) '(:titled/title "Title"))
+ (setf (ekg-note-properties note) '(:titled/title ("Title")))
(should (equal
"* Title\n:PROPERTIES:\n:ID: http://www.example.com\n:EKG_HASH: c696f3d4b296c737155637d3a708d2b986ab6f6f\n:END:\n#[[tag1]] #[[tag2]]\nhttp://www.example.com\nline1\nline2\n"
(ekg-logseq-note-to-logseq-org note "tag3")))
modified ekg.el
(defun ekg-display-note-titled (note)
@@ -695,7 +695,7 @@ FORMAT-STR controls how the time is formatted."
(if-let (title (plist-get (ekg-note-properties note) :titled/title))
(propertize (concat
(mapconcat #'identity (plist-get (ekg-note-properties note) :titled/title)
- " / ") "\n")
+ "\n") "\n")
'face 'ekg-title)
"")) PLEASE NOTE: after these changes above, the test Update: I created a PR, the above issues will all be addressed. Feel free to make any modifications. Zheng |
Now properties can have multiple lines in the metadata section. The new const ekg-property-multivalue-type controls how multivalued properties act. This fixes #110.
This address a bug mentioned in #110 (comment).
Now properties can have multiple lines in the metadata section. The new const ekg-property-multivalue-type controls how multivalued properties act. This fixes #110.
Hello @ahyatt ,
https://github.com/ahyatt/ekg/blob/7811c17453fc6f59f16bb5fa04af06ebee50e00e/ekg.el#L1239C20-L1239C52
I don't think we need to use `ekg--split-metadata-string' for the title, or the title containing "," will be split.
Say, I have a note with title: "This is a test title, with a comma", after save I got this in db:
(Note: the title is split into 2 parts)
Note that titled/title is split into 2 parts.
In this case, keep the original val is okay:
What do you think?
The text was updated successfully, but these errors were encountered: