Tags:
create new tag
, view all tags

MediaWikiSyntaxPlugin idea

In EdinburghReleaseMeeting2006x07x03 we tossed the idea of a Plugin that shows MediaWiki syntax to people used to MediaWiki. MediaWiki has a good market share; some people use more than one flavor of wiki at a time. With a user preferences setting, the Plugin could translate TML (TWiki markup language) into MediaWiki syntax before edit, and translate it back after edit. That way, users can decide which syntax to use, and users could edit the same page with their favorite syntax. Customer focus!

Most users use only a handful of the available syntax, that is, it is not necessary to support the complete MediaWiki syntax. Unsupported syntax is simply presented in the TML.

Example what could be supported:

TML MediaWiki syntax
[[link][label]] [[link|label]]
[[http://twiki.org/][label]] [http://twiki.org/ label]
---+ Heading 1 =Heading 1=
---++ Heading 2 ==Heading 2==
---+++ Heading 3 ===Heading 3===
*bold* '''bold'''
_italic_ ''italic''
=monospace= <tt>monospace</tt>
%ATTACHURL%/image.png [[Image:wiki.png]]
  * Item 1
      * Item 1.1
  * Item 2
* Item 1
  ** Item 1.2
  * Item 2
  1. Item 1
      a. Item 1.a
  1. Item 2
# Item 1
  ## Item 1.2
  # Item 2
  $ term: definition ; term : definition
| *Table* | *Heading* |
  | Table | cell |
Media Wiki table help

Implemenation: The back and forth translation can be done in the beforeEditHandler and afterEditHandler.

-- PeterThoeny - 03 Jul 2006

Spinning this idea further, this can be done as a generic EditSyntaxPlugin that reads configuration files attached to the Plugin topic. That way, multiple syntaxes can be supported of wikis (Mediawiki, Dokuwiki, XWiki), and BBs (Markdown, Textile, BBCode). New syntaxes can be added over time.

Here is a how-to idea to make this seemless for the user:

  • Define a EDITSYNTAX setting in TWikiPreferences as an empty value
  • The user can set EDITSYNTAX in the user preferences to Mediawiki, Dokuwiki, or another supported wiki
  • The registration form can ask for the preferred syntax
  • Each supported syntax has three files:
    • Help summary: Topic %TWIKIWEB%.WikiSyntaxSummary<syntx_name> (example: TWiki.WikiSyntaxSummaryMediawiki)
    • TML to other wiki syntax regex file: Attachment <syntx_name>.t2x= (example: Mediawiki.t2x (suffix means: twiki-to-external))
    • Other wiki syntax to TML regex file: Attachment <syntx_name>.x2t= (example: Mediawiki.x2t)
  • Skins showing the short WikiSyntaxSummary can show the proper syntax summary by including %TWIKIWEB%.TWiki.WikiSyntaxSummary%EDITSYNTAX%

The regex file contains lines of regexes, and may contain # coment lines. The sequence of regexes is relevant. Example Mediawiki.t2x file content:

# TML to Mediawiki converter
/(^|[\s\(])\*(.*?)\*([\s\)]|$)/$1'''$2'''$3/ # bold
/(^|[\s\(])\_(.*?)\_([\s\)]|$)/$1''$2''$3/   # italic
# etc

The Mediawiki.x2t does the reverse. It is more work to define two files; however, using one regex set to translate back and forth is probably challenging for more complex rules, possibly impossible.

The regex eval needs to be done in a secure way, e.g. to prevent exposure of internal variables.

Anyone interested in picking it up from here?

-- PeterThoeny - 05 Jul 2006

A e-mail convesation I had with a corporate TWiki user where the group switched to Mediawiki:

  • Yes, Mediawiki is getting more and more pupular at the workplace just because of the pupularity of Wikipedia. Do you think a TWiki that supports Mediawiki syntax would help? -- PeterThoeny
    • As with different editor key bindings (e.g. vi versus Emacs), having a MediaWiki-compatible markup syntax as an option might be useful for some. We have also incorporated a GUI interface which helps simplify editing sometimes, but it has glitches as well. This whole area is a bit thorny. But in truth it is more than just the syntax, there are plugins and just the look-and-feel familiarity that seems like it would lower the barrier to participation for some. In my view, since gaining critical mass is very important for a Wiki to succeed, thus easing the learning curve is very important. The claim that it is "like Wikipedia" is helpful; even folks who've never contributed to Wikipedia have at least heard of it and seen the articles. In the long run, this mindshare may be difficult for other Wikis to compete with. -- TWikiGuest

-- PeterThoeny - 06 Jul 2006

A first implementation of a generic edit syntax converter is now implemented: EditSyntaxPlugin.

-- PeterThoeny - 09 Jul 2006

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2006-07-09 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.