ProfessionalWiki / Network

MediaWiki extension for adding interactive network visualizations to your wiki pages
https://professional.wiki/en/news/mediawiki-page-network
Other
26 stars 9 forks source link

Adding new parameters: AllowOnlyLinksToPages and AllowLinkExpansion #59

Open pwolny opened 2 years ago

pwolny commented 2 years ago

Additional options that allow for example to cleanly graph relations between page list results generated by inline queries of Semantic Mediawiki. The normal behavior from SMW example provided in readme makes graph hard to read: Standard_behaviour

AllowOnlyLinksToPages restricts the graph to nodes from page list, for example when set to true: AllowOnlyLinksToPages

AllowLinkExpansion allows or suppresses adding new nodes to graph by holding nodes: AllowOnlyLinksToPages_with_manualy_expanded_nodes

All images above were generated by following code and by changing the new parameters

{{#network:
{{#ask: [[NextPage::+]]
| format=list
| headers=show
| link=none
| order=ascending
| merge=true
|limit=50
|searchlabel=|
|sep={{!}}
|template=ReturnTemplatesFirstArgument
|outro={{!}}
|intro={{!}}
}}
| class = col-lg-3 mt-0
|AllowOnlyLinksToPages = true
|AllowLinkExpansion = false
|enableDisplayTitle = true
}}

Some translation files and readme with an example were updated.

Probably needs code review and maybe new variable names could be made more consistent with the rest of the code.

Modifications were tested and were working on a debian system with: MediaWiki 1.37.4 PHP 7.4.30 (apache2handler) MariaDB 10.5.15-MariaDB-0+deb11u1 ICU 67.1 LuaSandbox 3.0.3 Lua 5.1.5 Pygments 2.10.0 Semantic Forms Select 4.0.0-alpha Semantic MediaWiki 4.0.2 Semantic Result Formats 4.0.1

TUDTom commented 2 years ago

Hey, thanks a lot for the development. This is exactly what I was looking for. Unfortunately, I was not able to reproduce this example. When I use AllowOnlyLinksToPages = true, no links (pages+external) appear in the graph. If I use AllowOnlyLinksToPages = false, all links appear. I have replaced the Network folder in extensions with your files and restarted everything. Is anything else required?

pwolny commented 2 years ago

Nothing comes to mind, except the template for the SMW ask query (Template:ReturnTemplatesFirstArgument). Basically it contains just {{{1|}}} and returns first parameter as text. In the example the query part

{{#ask: [[NextPage::+]]
| format=list
| headers=show
| link=none
| order=ascending
| merge=true
|limit=50
|searchlabel=|
|sep={{!}}
|template=ReturnTemplatesFirstArgument
|outro={{!}}
|intro={{!}}
}}

returns: |Test8|Test1|Test10|Test11|Test12|Test13|Test14|Test15|Test16|Test2|Test3|Test4|Test5|Test6|Test7|Test9|

Did you try maybe something simpler like this:

{{#network:Test1|Test2|Test3|Test4|Test5
| class = col-lg-3 mt-0
|AllowOnlyLinksToPages = true
|AllowLinkExpansion = false
|enableDisplayTitle = true
}}

Are there any differences between Preview and saved page?

Also the comparison between page list and page name check seems to be case sensitive (check if page list contains exact page titles).

TUDTom commented 2 years ago

Hey there, thanks a lot for the fast reply! Now it works fine. After restarting the VM and resolving a copy-mistake (without error message) it works :)