The lab

From SynchroEdit

Jump to: navigation, search

Contents

The lab

This page contains random, most likely senseless to the uninitiated, stuff.

Opera 9

Someone poked me regarding Opera a few days ago and I decided to give it a shot and see if I could get it to play. I first installed Opera 8 which did nothing right. It made me realize it's time to start looking into fine-tuning some of our code, as Opera was always well known for abiding by standards. However, some googling about made me realize not all was on our end. Opera 8 has some bugs relating to floating divs, and buggy behavior I found in Opera 8 and SynchroEdit did not appear in Opera 9.

Opera 9 was indeed a more pleasant encounter. It did almost everything right. I had to kill the "const" declarations in the JS code, but part from this, it played along well with what I had. Except one, very vital, component; it bugged out when it came to designMode + mutation events. The one most important aspect of, in fact the fundamental concept behind, SynchroEdit. Blargh. Bug filed, but Opera do not seem to share their bugs like others do (how do they cope with duplicate bugs, if people can't even look to see if their bug was filed already??).

Converting SynchroEdit format to another format

As a proof-of-concept, we're working on writing an exporting module experimenting with an XSLT stylesheet that creates clean, manageable, nice looking wiki-code for MediaWiki based on SynchroEdit XHTML output. Most "export-to" functionality out there (that I have seen) does a poor job at producing clean results, and end up creating gook, because the chances are fairly high (or so the developers of such software believe) that noone will actually edit the source directly, for example in a HTML editing tool.

This is not the case with SynchroEdit exports. In order for them to be even remotely useful, they must produce nice-looking and -formatted code, or a single editing session on a human-made document will turn it into vegetable soup. This section contains three sub-sections; xhtml, wiki source, and wiki results. The xhtml section is simply the xhtml data based on SynchroEdit. It's messy and useless, for the most part. The second section contains the same data converted into wiki-format. The third section contains the wiki-data as-is, which means MediaWiki will "use" it to add to this page. We will update this page periodically as we improve the underlying mechanism for exporting.

Here are the pointers that we've spotted that are undesirable about this tool at this point:

  1. The various bold and italic spans should be turned into using '' and ''' wrapping instead.
  2. The centered element only really wraps one single line, but ends up wrapping the remainder of the document, and nested into that is a div which left-justifies. This is a SynchroEdit optimization that must be countered (in export) or tweaked (in client code).
  3. There should be a newline after the </pre>.
  4. The "This is some text in the H1" should not begin with a space, as this turns it into preformatted, in the wiki.
  5. Seems the <pre>
    data
    </pre> approach is adding an extra line to the top.

The XSLT document

The XSLT doc used to convert the Xhtml data below into Wiki data is available from the main web site (so as to not have to mangle its tags like we have the other stuff below). Be warned though, this is very much an experimental learning-by-doing experience! (XSLT-gurus are heartily welcome to grok this or give advice!)

The program used to convert was xsltproc (available on most linuces, but have not investigated Win alternatives), and the command to perform the conversion was

xsltproc mediawiki-xsl.xml stripped.xml

where stripped.xml is the filename of the Xhtml data, obviously.

Source: mediawiki-xsl.xml

Xhtml data

Don't be scared now...

<html><head><style/></head><body>This is a test document.<br/><h1>This is a test H1.</h1><br/>This is 
some text in the H1. And <span style="font-style: italic;">here is some italicised text</span>.<br/><br/><h2>Here is a 
H2.</h2><div style="text-align: center;">Here's a centered area.<br/><br/><div style="text-align: left;">And here is after 
the centering.<br/><br/><pre>Here is some preformated
   text that is formated just so
that you can see it
       is actually not regular.
</pre>And that's <span style="font-weight: bold; text-decoration: underline;">that</span>.<br/><br/><br/><br/></div></div></body></html>

Exported xhtml data (wiki format)

This is a test document. 
 
= This is a test H1. = 
This is some text in the H1. And ''here is some italicised text''. 
 
== Here is a H2. == 
 
<center> 
Here's a centered area. 
<div style="text-align: left;"> 
And here is after the centering. 
<pre>Here is some preformated
   text that is formated just so
that you can see it
       is actually not regular.
</pre> 
And that's <u>'''that'''</u>.</div> 
</center>

Wiki-data as wiki-data

This is a test document.

This is a test H1.

This is some text in the H1. And here is some italicised text.

Here is a H2.

Here's a centered area.

And here is after the centering.

Here is some preformated
   text that is formated just so
that you can see it
       is actually not regular.
And that's that.
Personal tools