wikilabs / plugins

TW5 plugins: https://wikilabs.github.io
30 stars 8 forks source link

uni-link: feature request - If no alias exists - check titles #33

Closed pmario closed 3 years ago

pmario commented 5 years ago

see: https://groups.google.com/forum/#!topic/tiddlywiki/WMWXNrMHbt4

IMO aka-macro will be an easy fix. -> Backlink handling will get crazy :/

pmario commented 3 years ago

Will probably be implemented as [[case insensitive title|??]]

pmario commented 3 years ago

@flibbles I will add [[case insensitive title|??]] as a possible "shortcut" for case insensitive tiddler links. ...

I think it would be nice if the "relink plugin" could add a warning, if someone would rename a tiddler like this. ... Is this possible?

I would like to implement the code into my pugin, if possible?!

There is some discussion going on about "link attributes" see: https://groups.google.com/g/tiddlywiki/c/pvc-qqoWHdI ... Do you follow it? ... What do you think?

flibbles commented 3 years ago

So what is the workflow here? There's a tiddler with text...

Awesome games: [[ghosts and goblins|??]]

and then someone renames: Ghosts and Goblins to Ghosts and Ghouls. So it would find and update that link? What is the exact workflow? Does a pop up come up right after you hit "save tiddler" with the new title, and it just gives you a warning without anything actionable about it?

pmario commented 3 years ago

I did get a feature request, for the following workflow.

A user names the tiddler titles like this: Advanced Design and Technology ... Then in the text it should be [[advanced design and technology|Advanced Design and Technology]]

The second link will be OK for relink plugin, BUT it is much more work to write it.

I will implement a function that will do a "title search". ... The problem now is, that the "first part of the link" is kind of misused and needs a "review", if the tiddler title is changed.

pmario commented 3 years ago

The parsetree, that I'm creating atm is:


[
    {
        "type": "element",
        "tag": "p",
        "children": [
            {
                "type": "link",
                "attributes": {
                    "to": {
                        "type": "string",
                        "value": "This is a Test"
                    }
                },
                "children": [
                    {
                        "type": "text",
                        "text": "this is a test"
                    }
                ]
            }
        ]
    }
]

So TW default backlink-mechanism just works.

flibbles commented 3 years ago

I see. So I assume that the purpose is to draw attention to the necessary review that the user must do, and NOT to automatically Relink in these case? Considering the code can't know what sort of capitalization you'd expect for the caption?

pmario commented 3 years ago

...Considering the code can't know what sort of capitalization you'd expect for the caption?

That's exactly the point. The code can't know how capitalization needs to be done. ... And if the "caption" text should stay, it should be easy for the user to go the "alias" route, which doesn't have a renaming problem.

flibbles commented 3 years ago

So just so I know exactly what you're trying to accomplish. let's say I have your ideal uni-link installed, and I have a tiddler "myTiddler" with the body [[ghosts and goblins|??]].

Then I rename a tiddler named Ghosts and Goblins to Ghosts and Ghouls, and I hit confirm.

You'd like relink to provide one of those yellow popups which states something like:

Relink was unable to rename the tiddler in all cases.

* [[myTiddler]]: Link was not an exact match. Unsure what the replacement link would be.

Then the user would have to go open "myTiddler" and make the final updates.

If this is correct, then this isn't that tough to implement. As it is, you can have the "relink" method return {impossible: true} and it will already create that popup saying that the relink wasn't possible in such-and-such tiddler. However, you wouldn't have a nice "link wasn't an exact match..." message. //However//, this will also cause Relink to warn before the rename that there will be instances where Relink will fail, which may scare users.

Am I understanding the workflow correctly?

(If you want to see what I mean about the pre-warning and the yellow popup. Go to the Relink demo and rename Frodo to Frodo ]] Baggins)

pmario commented 3 years ago

Am I understanding the workflow correctly?

(If you want to see what I mean about the pre-warning and the yellow popup. Go to the Relink demo and rename Frodo to Frodo ]] Baggins)

yes. imo that's exactly, what I would expect. The user gets links and a warning prior to changing the title.

And if hey don't take the warning serious, they get an error report. That's fine!

flibbles commented 3 years ago

Oh, if that's all you want, then it's really easy. In your uni-link wikirule, if you detect that it can't be renamed in your relink method, then just take whatever the prettylink relink method returns and set rtnValue.impossible = true before you return it. I think you also need to set output = undefined. Either way, this method will work for V1 and V2.

I'll touch base soon with any changes you'll need to make for V2 support. It should actually open the door to reporting on any aliases in the Relink Info panel even if it wouldn't be renamed on a title change.

pmario commented 3 years ago

Has been released with uni-link V2.1.0 - so close this issue