-
Notifications
You must be signed in to change notification settings - Fork 9
Improve citation matching #13
base: master
Are you sure you want to change the base?
Conversation
Another feature I'd like to add in this branch is to refer to citation using abbreviations. For example, when user type "Lev. 1", it can be translated into "Leviticus 1" properly for further processing. I think the implementation can an association list that matches abbreviation as key to the full name as value. I plan to follow common abbrevs in Logos and Nashotah.edu as a start. User may add more definitions themselves. As a result, |
The current implementation definitely has some weaknesses. I'm entirely supportive of moving toward handling both variants that you identify on full citations (abbreviated book names and verse sets/ranges). I see at least two reasons to do so:
With respect to the situation where a citation crosses a line break, we can cross that bridge when we come to it. At this point, I don't believe I've encountered that as a need. Let's put it on the back burner. I wonder whether it would be best to hold off on merging this branch until we clearly establish:
Thanks for investing time in this! Please let me know your thoughts regarding the above. |
If a substantial amount of time is invested, it might be desirable to put together some testing on this. I haven't given much thought to any sort of testing for this project. Maybe go with |
Since our parsing is handed over to
So the structure would look like
I think this is properly handled by Adding a test suite would definitely help. Also, I think adding some elisp formatter/linter would help us maintain the code too. I will keep an eye on these topics and update later. |
It sounds like there isn't much that needs to be dealt with with the representation of sets and ranges with Agreed that elisp formatting needs consistency. Is it time to untabify everything? Maybe formatting/linting is better as a separate issue. Looking forward to upcoming commits. Thanks again. |
Hi @thomp , how's it going? It's been a while and I wish all is well with you.
These days I'm thinking to improve upon citation matching. I believe this may involve some code changes to you so I'd like to discuss.
The idea is to come up with functions that help us identify format such as "Matthew 1:10", "Luke 1:10-20", "Genesis 3", etc. To do this I studied a bit on regular expression in Emacs, the main result is a regexp called
dtk-citation-regexp
that help to detect book/chapter/verse/verse-range. You may test with:Based on it, I rewrote
dtk-parse-citation-at-point
. While there are still some edge cases, it works pretty well over my test buffer:The main benefit being that user can put point somewhere within the citation and it should work as expected. There are still restrictions though: the citation cannot cross between 2 lines. But I suppose it's not a major case.
Your input will be appreciated.