Get rid of wikiwordification

Bug #1595294 reported by kaputtnik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Widelands Website
Fix Released
High
Unassigned

Bug Description

This is just a reminder to get rid of wikiwordification (automatically turn words like "WikiHelp" or "GameHelpMultiplayer" into links to wiki articles).

We should instead use markdowns wikilinks extension: http://pythonhosted.org/Markdown/extensions/wikilinks.html

This needs scanning all wikiarticles for "WikiLinksWords" and replace them with the markdown syntax. I think an admin action could this.

Related branches

GunChleoc (gunchleoc)
Changed in widelands-website:
status: New → Triaged
Revision history for this message
kaputtnik (franku) wrote :

The wikilinks extension of markdown has one disadvantage: It is not possible to give a different label, e.g. it is not possible to have a link like:

<a href="/wiki/GameHelpMultiplayer">Multiplayer</a>

or, as bad example but often used:

<a href="/wiki/GameHelpMultiplayer">see here</a>

There is a third party extension to markdown called semanticwikilinks which could solve this, so the syntax is a bit different. The following examples will produce the above links:

[[ GameHelpMultiplayer | Multiplayer ]]

[[ GameHelpMultiplayer | see here ]]

But this extension is quite old and some of the benefits do not work as described. I have proposed a change but had no answer yet.

https://github.com/aleray/mdx_semanticwikilinks

Revision history for this message
GunChleoc (gunchleoc) wrote :

Something like that would be great - it's the same syntax that Wikimedia uses.

kaputtnik (franku)
Changed in widelands-website:
importance: Undecided → High
kaputtnik (franku)
Changed in widelands-website:
status: Triaged → In Progress
Revision history for this message
kaputtnik (franku) wrote :

The second branch contains only one script to convert WikiWords into '[[ WikiWords ]]' in the content for all articles.

This script has to be run only once. So i decided to not make it a part of the website code. Beside this script has to be reviewed, there are some things to consider:

- The script creates a new Changeset for each changed article
- A User is needed: I could use my own username, or we create a new user 'wl_bot' (or similar) to use for automatic changes. I used the second possibility for testing. The script has to be adjusted if a different username is used.
- There is also a need for an IP-address. I used the same as we have used in wl_utils.get_real_ip() as bogus IP
- Because every save triggers also a notification e-mail the script may take a time to run through.

Revision history for this message
kaputtnik (franku) wrote :

Hm, just thought with some modifications to the script it would maybe be useful to have it in the widelands code. e.g calling it with a compiled regular expression as argument.

What i don't like is the creating of a changeset when an article is changed. Currently each function which changes an article has to make sure to create a changeset in that function. IMHO it would be better to have the code for creating a changeset in wiki.models.Article.save(). So every time an article get saved the corresponding changeset is created automatically...

Revision history for this message
kaputtnik (franku) wrote :

> Currently each function which changes an article has to make sure to create a changeset in that function.

I'll try to fix that first by moving the code to create a changeset to the save() method of an article. But this will take some time... i am busy with real live things at the moment (my rooms needs a general restoration because of a huge water damage).

Revision history for this message
kaputtnik (franku) wrote :

After spending dozens of hours on the converting script i found that the proposed new syntax clashes with the syntax for tables :-( .

The pipe-sign in e.g. '[[ Foo | Bar ]]' is used as delimiter for table cells and using this in tables will result in following html:

<td> [[ Foo </td>
<td> Bar ]] </td>

I am bit confused now what to do...

1. Don't use the proposed syntax and only allow the original markdown syntax ('[Label](/wiki/Wikipage)'), which is not very intuitive
2. Using the markdown wikilinks extension ('[[ Wikipage ]]'), which is much better than 1. But this means if one wants to use a Label for a link, he has to use the syntax in 1. I think this is no option.
3. Trying to adjust the markdown table extension. This means we have to change the syntax for tables with could lead into some more side effects (beside it is very complicated)
4. Change the pipe-sign in the proposed syntax, e.g. using '[[ Wikipage @ Label ]]' (didn't test that yet). This means using an unusual syntax

What do you think?

Never thought that this bug causes so much changes and work...

Revision history for this message
GunChleoc (gunchleoc) wrote :

The Battle for Wesnoth wiki uses [http://www.example.com title] for links, with [] instead of [[]]. Would that work?

Revision history for this message
kaputtnik (franku) wrote :

Looking at the Syntax in the Battle of Wesnoth wiki this is the syntax for external links: http://wiki.wesnoth.org/Help:Links

They use also [[ Page | Title of link ]] for internal links (They are using MediaWiki, just like wikipedia does)

Creating 'easy to use' internal links is what i am trying to implement here. E.g. having a syntax

[[ Main Page | look at the main page ]]

the first part will automatically adjusted to '/wiki/Main Page/'. So each Link created with that syntax points to our own wikiand there is no need to write that '/wiki/' each time.

The problem with the syntax for tables is only the pipe sign (|), not the brackets:

A small | table
------- | -----
first cell | second cell

The parser which parses such syntax into html tables assumes each '|' is the beginning of a new table cell. The parser isn't smart enough to find a '|' in between double brackets to prevent creating a new table cell.

In the end i find only one page with a table containing links: https://wl.widelands.org/wiki/EditorHelpHelp/ Maybe we could also live with that exception: Syntax for Wikilinks does not work in tables, use the old syntax then?

Revision history for this message
GunChleoc (gunchleoc) wrote :

How about allowing markdown links within the tables? Then we can still have links within tables, and convenient syntax everywhere else.

Revision history for this message
GunChleoc (gunchleoc) wrote :

P.S. Wesnoth internal links look like this:

[[Link title]]

Title only, no pipe character. So, we can't have a name different from the page's name, but do we need it?

Revision history for this message
kaputtnik (franku) wrote :

> How about allowing markdown links within the tables?

Yes, normal links like [Title](/wiki/Main Page) is always possible.

> P.S. Wesnoth internal links look like this:
> [[Link title]]

The Syntax page linked above would link to a Wikipage named 'Link Title' then. If you want a different Title (displayed as the linktext) for internal links you have to use the Piped link '[[ Link | Title ]]'

> So, we can't have a name different from the page's name,
> but do we need it?

Yes. Sometimes it is better to have a different Text for links. E.g. Linking to a heading:

[[ GameHelpbasicInterface/#in-game ]]
produce html:
<a href="/wiki/GameHelpbasicInterface/#in-game">GameHelpbasicInterface/#in-game</a>
whereas
[[ GameHelpbasicInterface/#in-game | Interface ]]
produce html:
<a href="/wiki/GameHelpbasicInterface/#in-game">Interface</a>

Other examples which will be implemented with this changes:

[[ Main Page ]]
produces html:
<a href="/wiki/Main Page">Main Page</a>

[[ Main Page | Look here ]]
produces html:
<a href="/wiki/Main Page">Look here</a>

So i think consensus is to use the bracketed syntax for all internal links. If needed for tables the old markdown syntax can be used '[linktext](/wiki/Page Title)'.

Revision history for this message
GunChleoc (gunchleoc) wrote :

If the link title will be optional, we can still have [[link]] in tables where we don't need a special title. So, I think this would work very well:

1. [title](link) Everywhere for internal and external links
2. [[link | title]] Outside of tables for internal links
3. [[link]] Everywhere for internal links

Revision history for this message
kaputtnik (franku) wrote :

Yes, this is exactly what this branch will bring.

Maybe i have confused you with the converting-script. I've made this script just to make a consistent use of the new syntax in all wiki articles and to cleanup the use of e.g. '!SirVer' (the exclamation mark was used to NOT make a Link of the following WikiWord).

Thanks for your help :-)

kaputtnik (franku)
Changed in widelands-website:
status: In Progress → Fix Released
Revision history for this message
kaputtnik (franku) wrote :

This is all in now. I go through the articles and may adjust wrong links.

I also describe the new syntax in the WikiSyntax page.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.