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

Added getTiddlerTranscludes() #2204

Closed
wants to merge 3 commits into from
Closed

Conversation

flibbles
Copy link
Contributor

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.

*/
exports.getTiddlerLinks = function(title) {
exports.collectFromEachTiddlerNode = function(title, cacheName, treeNodeMethod) {
Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Contributor

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 :-)

felixhayashi referenced this pull request Feb 5, 2016
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?
@pmario
Copy link
Member

pmario commented Jan 3, 2021

@flibbles ... Do you still need this PR, or can do the "relink" plugin much better?

@flibbles
Copy link
Contributor Author

flibbles commented Jan 3, 2021

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.

@flibbles flibbles closed this Jan 3, 2021
@flibbles
Copy link
Contributor Author

flibbles commented Jan 3, 2021

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.

@pmario
Copy link
Member

pmario commented Jan 3, 2021

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 ...

@joshuafontany
Copy link
Contributor

+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.

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

Successfully merging this pull request may close these issues.

5 participants