-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Added getTiddlerTranscludes() #2204
Conversation
*/ | ||
exports.getTiddlerLinks = function(title) { | ||
exports.collectFromEachTiddlerNode = function(title, cacheName, treeNodeMethod) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I like the refactoring, the getTiddlerLinks
function will probably need to stay. What you can do is reroute it to call collectFromEachTiddlerNode
under the hood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobibeer That's what I thought too at first glance but it just moved further below ;) (l.419).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, thanks for removing the blindfold :-)
Again, I needed this for the day job. @felixhayashi I think you submitted a pull request for something similar, would this version meet your needs?
Created the collectFromEachTiddlerNode method which manages to the tree parsing for those methods.
@flibbles ... Do you still need this PR, or can do the "relink" plugin much better? |
I mean, we can. Relink doesn't use getTiddlerTranscludes or getTiddlerLinks. They're too basic. I suggested this PR because it introduced a method which I needed for a plugin I never published, and it seemed like having a generic tree-walking method would be a more extensible practice overall. But yeah, I guess if no one is clambering for transclude lookups, we can just close this unmerged. |
Oh right. I made this originally because of something I was doing with Tiddlymap. This made it possible for Tiddlymap to graph transclusions the same way it transcludes links. But again, I always wanted a ton of features out of Tiddlymap that no one else seemed to really need, so I guess there's not point for this. |
We do have requests in the group, to track transclusions the same way as links. So we should keep this PR in mind, if it still works, with all the indexing going on in the latest core code ... |
+1. I would like to see this available. I have been focused on back-end file-handling (still not 100% sure about those callbacks), but I intend to use TiddlyMap heavily for the next set of projects and this will be usefull. |
Here is a method for getting the transcludes for a given tiddler title. It behaves practically identically to getTiddlerLinks(). I've tested it. It seems fine. I pulled the tree node parsing in getTiddlerLinks out into its own method so there isn't code duplication between the two
There's more that could be done with this. There could be a getTiddlerBacktranscludes. Or maybe a transcludes filter operator. If you guys think it would be a good idea, let me know.