SemanticMediaWiki / Mermaid

Provides a parser function to generate diagrams and flowcharts with the help of the mermaid script language
https://www.mediawiki.org/wiki/Extension:Mermaid
Other
36 stars 24 forks source link

internal links not working as expected #31

Closed squirrelslair closed 5 years ago

squirrelslair commented 5 years ago

Setup and configuration

Issue

I would expect an entry click mypage "nameofa page" to go the page "nameofa page". Instead, at least on my wiki, it goes to my wiki's domain and just appends the name of the page. For example, what should end up at "https://wiki.umintmed.ca/index.php?title=Dale_Gustafson" ends up at "https://wiki.umintmed.ca/Dale_Gustafson", which of course doesn't work. I know I can work around this using the http link but then I lose the wiki functionality for tracking page use.

krabina commented 5 years ago

I can confirm this. I am using short links im my wiki, to it works, but the problem for me is that every internal wiki link gets opened in another browser tab. This can also be seen here: https://wiki.umintmed.ca/index.php?title=User:Ttenbergen/Mermaid_example a clock on any item opens a separate page

mwjames commented 5 years ago

I can confirm this. I am using short links im my wiki, to it works, but the problem for me is that every internal wiki link gets opened in another browser tab.

The extension is only responsible for invoking and loading the JS related modules required by the Mermaid.js. Any Mermaid specific issues on how links work, the syntax is interpret, or data are displayed has nothing to do with this extension and is the solely responsibility of the Mermaid.js.

If you think something doesn't work or should work differently in how Mermaid.js interprets the graphs then questions should be to directed towards Mermaid.js.

Cheers

On 5/18/19, Bernhard Krabina notifications@github.com wrote:

I can confirm this. I am using short links im my wiki, to it works, but the problem for me is that every internal wiki link gets opened in another browser tab. This can also be seen here: https://wiki.umintmed.ca/index.php?title=User:Ttenbergen/Mermaid_example a clock on any item opens a separate page

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/SemanticMediaWiki/Mermaid/issues/31#issuecomment-493512228

kghbln commented 5 years ago

Best to be reported here: https://github.com/knsv/mermaid/

squirrelslair commented 5 years ago

Posted there as https://github.com/knsv/mermaid/issues/844

mwjames commented 5 years ago

Posted there as https://github.com/knsv/mermaid/issues/844

I think the linked ticket doesn't very well describe the issue in a manner that a mermaid maintainer could understand what you expect and how to respond to it.

mermaid doesn't know anything about SemanticMediaWiki/Mermaid or MediaWiki (and it shouldn't) the only relevance for the mermaid package is how to deal with links on the given syntax.

I would expect an entry click mypage "nameofa page" to go the page "nameofa page". Instead, at least on my wiki, it goes to my wiki's domain and just appends the name of the page. For example, what should end up at "https://wiki.umintmed.ca/index.php?title=Dale_Gustafson" ends up at "https://wiki.umintmed.ca/Dale_Gustafson",

Well, the extension and mermaid does what is suppose to do and if the default assumption about links doesn't work on your wiki and you expect something like /index.php?title=Dale_Gustafson as a link then this is an issue of your wiki or setup.

The extension could try to parse those links and replace them with something else (either on the PHP or JS side) but that would be a feature request and I cannot see myself devoting any time to this but we are welcome contributions that may tackle the issue on either side.

"https://wiki.umintmed.ca/Dale_Gustafson", which of course doesn't work. I know I can work around this using the http link but then I lose the wiki functionality for tracking page use.

If you can work around this then this is the solution and as for "I lose the wiki functionality for tracking page use." describes a totally different issue which seems like a feature request.

On 5/22/19, kuality notifications@github.com wrote:

Posted there as https://github.com/knsv/mermaid/issues/844

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/SemanticMediaWiki/Mermaid/issues/31#issuecomment-494641717

squirrelslair commented 5 years ago

I think the linked ticket doesn't very well describe the issue in a manner that a mermaid maintainer could understand what you expect and how to respond to it.

mermaid doesn't know anything about SemanticMediaWiki/Mermaid or MediaWiki (and it shouldn't) the only relevance for the mermaid package is how to deal with links on the given syntax.

I agree, the maintainer of Mermaid probably can't do much with that ticket. As I wrote it I realized I don't know enough about how the extension works with mermaid to explain the problem to someone who doesn't know the extension.

...if the default assumption about links doesn't work on your wiki and you expect something like /index.php?title=Dale_Gustafson as a link then this is an issue of your wiki or setup.

As far as I know that's how a mediawiki install works out of the box, so I would have assumed that is the default assumption. Bernhard mentioned somewhere that he uses short URL, but that was the first I heard of that. When I look at https://www.mediawiki.org/wiki/Manual:Short_URL it seems to specifically recommend against the equivalent of https://wiki.umintmed.ca/Dale_Gustafson . So, are we working form the same basic assumptions?

welcome contributions that may tackle the issue on either side.

I had a brief look at the files that come with the extension, but like every other time when I have looked at extension code, I am mystified. If there is ever a bootcamp somewhere to get people into this I'd actually travel to attend. I am not copping out, I want to make this system better, but for now my capabilities taper off at trying to write bug reports. Sorry.

If you can work around this then this is the solution and as for "I lose the wiki functionality for tracking page use." describes a totally different issue which seems like a feature request.

I just want to make sure we are talking about the same thing. What I meant was how the wiki internally keeps track of pages that use internal wiki links to the current page. When normal internal links are used, this works hands-off. We use this functionality pretty extensively to treat our content as a knowledge network, and I think of it as one of the big features that makes mediawiki better than many other tools. When all I provide is a page name, then the behaviour I would expect to come from that is an internal link. It never even ocurred to me that the extension would implement this as external links. Do you mean that even with short URL the extension would just generate an external link?


From: mwjames [notifications@github.com] Sent: May 22, 2019 06:47 To: SemanticMediaWiki/Mermaid Cc: kuality; Author Subject: Re: [SemanticMediaWiki/Mermaid] internal links not working as expected (#31)

Posted there as https://github.com/knsv/mermaid/issues/844

I think the linked ticket doesn't very well describe the issue in a manner that a mermaid maintainer could understand what you expect and how to respond to it.

mermaid doesn't know anything about SemanticMediaWiki/Mermaid or MediaWiki (and it shouldn't) the only relevance for the mermaid package is how to deal with links on the given syntax.

I would expect an entry click mypage "nameofa page" to go the page "nameofa page". Instead, at least on my wiki, it goes to my wiki's domain and just appends the name of the page. For example, what should end up at "https://wiki.umintmed.ca/index.php?title=Dale_Gustafson" ends up at "https://wiki.umintmed.ca/Dale_Gustafson",

Well, the extension and mermaid does what is suppose to do and if the default assumption about links doesn't work on your wiki and you expect something like /index.php?title=Dale_Gustafson as a link then this is an issue of your wiki or setup.

The extension could try to parse those links and replace them with something else (either on the PHP or JS side) but that would be a feature request and I cannot see myself devoting any time to this but we are welcome contributions that may tackle the issue on either side.

"https://wiki.umintmed.ca/Dale_Gustafson", which of course doesn't work. I know I can work around this using the http link but then I lose the wiki functionality for tracking page use.

If you can work around this then this is the solution and as for "I lose the wiki functionality for tracking page use." describes a totally different issue which seems like a feature request.

On 5/22/19, kuality notifications@github.com wrote:

Posted there as https://github.com/knsv/mermaid/issues/844

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/SemanticMediaWiki/Mermaid/issues/31#issuecomment-494641717

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SemanticMediaWiki/Mermaid/issues/31?email_source=notifications&email_token=AF2TXUH7F7GQHNC3BJCEWITPWUXDRA5CNFSM4G7D3USKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV6ZDHI#issuecomment-494768541, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF2TXUDAXYGPXYSH2YAG3BLPWUXDRANCNFSM4G7D3USA. This email and/or any documents in this transmission is intended for the addressee(s) only and may contain legally privileged or confidential information. Any unauthorized use, disclosure, distribution, copying or dissemination is strictly prohibited. If you receive this transmission in error, please notify the sender immediately and return the original.

Ce courriel et tout document dans cette transmission est destiné à la personne ou aux personnes à qui il est adressé. Il peut contenir des informations privilégiées ou confidentielles. Toute utilisation, divulgation, distribution, copie, ou diffusion non autorisée est strictement défendue. Si vous n'êtes pas le destinataire de ce message, veuillez en informer l'expéditeur immédiatement et lui remettre l'original.

mwjames commented 5 years ago

As far as I know that's how a mediawiki install works out of the box, so I would have assumed that is the default assumption. Bernhard mentioned somewhere that he uses short URL, but that was the first I heard of that. When I look at https://www.mediawiki.org/wiki/Manual:Short_URL it seems to specifically recommend against the equivalent of https://wiki.umintmed.ca/Dale_Gustafson . So, are we working form the same basic assumptions?

"Assumptions" refers to what MediaWiki understands as a link in a sense of its supported syntax [[ ... ]] and the technical interpretation of how to build HTML around it. It further refers to how mermaid expects links to be formatted to be clickable.

SemanticMediaWiki/Mermaid doesn't manipulate not cater for any of these assumptions since it just transfers the data (as JSON) from MW to the mermaid JS component.

I had a brief look at the files that come with the extension, but like every other time when I have looked at extension code, I am mystified. If there is ever a bootcamp somewhere to get people into this I'd actually travel to attend. I am not copping out, I want to make this system better, but for now my capabilities taper off at trying to write bug reports. Sorry.

Understanding how MediaWiki works "under" the hood would be the first order of business which requires some effort otherwise the entry barrier is rather high to actually understand how an extension works.

For example, SemanticMediaWiki/Mermaid doesn't do much as to provide a parser function (#mermaid) and a JS module to call the actual mermaid JavaScript. How to register JS modules and how to work with the MediaWiki Parser isn't really part of the extension itself and more a question of [0].

If you want to educate yourself, I would suggest you read through [0, 1] and build a simple parser functions that just creates a simple output of the user input and by doing so you are going to understand how certain components interact with each other to create a functional extension.

Building on that foundation, you could try adding a JS module and see how that creates some HTML and how it interacts with a wiki page, after that I think you may have a better understanding how a MediaWiki extension is suppose to work and will be easier to elaborate when dealing with specific issues around MediaWiki and its services.

I just want to make sure we are talking about the same thing. What I meant was how the wiki internally keeps track of pages that use internal wiki links to the current page. When normal internal links are used, this works hands-off. We use this functionality pretty extensively to treat our content as a knowledge network, and I think of it as one of the big features that

When the MediaWiki Parser "sees" a [[ ... ]] element it parses the content and creates a LinksUpdate [2] entry to keep track of the links, yet when a text only contains a simple link (such as [ ]) it isn't part of the LinksUpdate and therefore isn't tracked. If you know the MediaWiki Parser and ParserOutput you would be able to manipulate the LinksUpdate object and inject linkable objects but that is not part of SemanticMediaWiki/Mermaid since SemanticMediaWiki/Mermaid doesn't have any specific knowledge about what the content should represent or how its is interpreted by mermaid.

[0] https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker [1] https://www.mediawiki.org/wiki/Manual:Parser_functions [2] https://github.com/wikimedia/mediawiki/blob/013b6fac88f03a7417c09e578a3bf1828e1101c6/includes/deferred/LinksUpdate.php

On 5/22/19, kuality notifications@github.com wrote:

I think the linked ticket doesn't very well describe the issue in a

manner that a mermaid maintainer could understand what you expect

and how to respond to it.

mermaid doesn't know anything about SemanticMediaWiki/Mermaid or

MediaWiki (and it shouldn't) the only relevance for the mermaid

package is how to deal with links on the given syntax.

I agree, the maintainer of Mermaid probably can't do much with that ticket. As I wrote it I realized I don't know enough about how the extension works with mermaid to explain the problem to someone who doesn't know the extension.

...if the default assumption about links doesn't work on your wiki and you expect something like /index.php?title=Dale_Gustafson as a link then this is an issue of your wiki or setup.

As far as I know that's how a mediawiki install works out of the box, so I would have assumed that is the default assumption. Bernhard mentioned somewhere that he uses short URL, but that was the first I heard of that. When I look at https://www.mediawiki.org/wiki/Manual:Short_URL it seems to specifically recommend against the equivalent of https://wiki.umintmed.ca/Dale_Gustafson . So, are we working form the same basic assumptions?

welcome contributions that may tackle the issue on either side.

I had a brief look at the files that come with the extension, but like every other time when I have looked at extension code, I am mystified. If there is ever a bootcamp somewhere to get people into this I'd actually travel to attend. I am not copping out, I want to make this system better, but for now my capabilities taper off at trying to write bug reports. Sorry.

If you can work around this then this is the solution and as for "I

lose the wiki functionality for tracking page use." describes a

totally different issue which seems like a feature request.

I just want to make sure we are talking about the same thing. What I meant was how the wiki internally keeps track of pages that use internal wiki links to the current page. When normal internal links are used, this works hands-off. We use this functionality pretty extensively to treat our content as a knowledge network, and I think of it as one of the big features that makes mediawiki better than many other tools. When all I provide is a page name, then the behaviour I would expect to come from that is an internal link. It never even ocurred to me that the extension would implement this as external links. Do you mean that even with short URL the extension would just generate an external link?


From: mwjames [notifications@github.com]

Sent: May 22, 2019 06:47

To: SemanticMediaWiki/Mermaid

Cc: kuality; Author

Subject: Re: [SemanticMediaWiki/Mermaid] internal links not working as expected (#31)

Posted there as https://github.com/knsv/mermaid/issues/844

I think the linked ticket doesn't very well describe the issue in a

manner that a mermaid maintainer could understand what you expect

and how to respond to it.

mermaid doesn't know anything about SemanticMediaWiki/Mermaid or

MediaWiki (and it shouldn't) the only relevance for the mermaid

package is how to deal with links on the given syntax.

I would expect an entry click mypage "nameofa page" to go the page "nameofa page". Instead, at least on my wiki, it goes to my wiki's domain and just appends the name of the page. For example, what should end up at "https://wiki.umintmed.ca/index.php?title=Dale_Gustafson" ends up at "https://wiki.umintmed.ca/Dale_Gustafson",

Well, the extension and mermaid does what is suppose to do and if

the default assumption about links doesn't work on your wiki and you

expect something like /index.php?title=Dale_Gustafson as a link then

this is an issue of your wiki or setup.

The extension could try to parse those links and replace them with

something else (either on the PHP or JS side) but that would be a

feature request and I cannot see myself devoting any time to this but

we are welcome contributions that may tackle the issue on either side.

"https://wiki.umintmed.ca/Dale_Gustafson", which of course doesn't work. I know I can work around this using the http link but then I lose the wiki functionality for tracking page use.

If you can work around this then this is the solution and as for "I

lose the wiki functionality for tracking page use." describes a

totally different issue which seems like a feature request.

On 5/22/19, kuality notifications@github.com wrote:

Posted there as https://github.com/knsv/mermaid/issues/844

--

You are receiving this because you commented.

Reply to this email directly or view it on GitHub:

https://github.com/SemanticMediaWiki/Mermaid/issues/31#issuecomment-494641717

You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHubhttps://github.com/SemanticMediaWiki/Mermaid/issues/31?email_source=notifications&email_token=AF2TXUH7F7GQHNC3BJCEWITPWUXDRA5CNFSM4G7D3USKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV6ZDHI#issuecomment-494768541, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF2TXUDAXYGPXYSH2YAG3BLPWUXDRANCNFSM4G7D3USA.

This email and/or any documents in this transmission is intended for the addressee(s) only and may contain legally privileged or confidential information. Any unauthorized use, disclosure, distribution, copying or dissemination is strictly prohibited. If you receive this transmission in error, please notify the sender immediately and return the original.

Ce courriel et tout document dans cette transmission est destiné à la personne ou aux personnes à qui il est adressé. Il peut contenir des informations privilégiées ou confidentielles. Toute utilisation, divulgation, distribution, copie, ou diffusion non autorisée est strictement défendue. Si vous n'êtes pas le destinataire de ce message, veuillez en informer l'expéditeur immédiatement et lui remettre l'original.

--

You are receiving this because you commented.

Reply to this email directly or view it on GitHub:

https://github.com/SemanticMediaWiki/Mermaid/issues/31#issuecomment-494787668

hexmode commented 5 years ago

kuality notifications@github.com writes:

I had a brief look at the files that come with the extension, but like every other time when I have looked at extension code, I am mystified. If there is ever a bootcamp somewhere to get people into this I'd actually travel to attend. I am not copping out, I want to make this system better, but for now my capabilities taper off at trying to write bug reports. Sorry.

It sounds like you might benefit from attending the SMWCon this September in Paris. There will be a lot of other SMW users there and even some tutorials.

SMWCon is not a boot-camp to learn how to work with SMW code, but it would put you in direct contact with developers who could help.

That said, @mwjames has provided a lot of information to fix this issue. I would suggest creating a new, clearer issue here that refers to his comments as the direction for implementing your desired functionality.